File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
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
+ // }
You can’t perform that action at this time.
0 commit comments