Skip to content

Commit 6d0af48

Browse files
committed
Add a test to ensure correct output of translate-c when __builtin_convertvector funcion is used.
1 parent cef8d7b commit 6d0af48

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
typedef int i32x2 __attribute__((__vector_size__(8)));
2+
typedef float f32x2 __attribute__((__vector_size__(8)));
3+
4+
f32x2 cast_function(i32x2 x) {
5+
return (f32x2) __builtin_convertvector((i32x2) { x[0], x[1] }, f32x2);
6+
}
7+
8+
// translate-c
9+
// c_frontend=clang
10+
//
11+
// pub export fn cast_function(arg_x: i32x2) f32x2 {
12+
// var x = arg_x;
13+
// _ = &x;
14+
// return blk: {
15+
// const tmp = blk_1: {
16+
// const tmp_2 = x[@as(c_uint, @intCast(@as(c_int, 0)))];
17+
// const tmp_3 = x[@as(c_uint, @intCast(@as(c_int, 1)))];
18+
// break :blk_1 i32x2{
19+
// tmp_2,
20+
// tmp_3,
21+
// };
22+
// };
23+
// const tmp_1 = @as(f32, @floatFromInt(tmp[0]));
24+
// const tmp_2 = @as(f32, @floatFromInt(tmp[1]));
25+
// break :blk f32x2{
26+
// tmp_1,
27+
// tmp_2,
28+
// };
29+
// };
30+
// }

0 commit comments

Comments
 (0)