OLD | NEW |
| (Empty) |
1 ; RUN: llc -emscripten-precise-f32 < %s | FileCheck %s | |
2 | |
3 target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64
:64:64-p:32:32:32-v128:32:128-n32-S128" | |
4 target triple = "asmjs-unknown-emscripten" | |
5 | |
6 ; Basic constructor. | |
7 | |
8 ; CHECK: function _test0($x,$y,$z,$w) { | |
9 ; CHECK: $d = SIMD_float32x4($x, $y, $z, $w) | |
10 ; CHECK: } | |
11 define <4 x float> @test0(float %x, float %y, float %z, float %w) { | |
12 %a = insertelement <4 x float> undef, float %x, i32 0 | |
13 %b = insertelement <4 x float> %a, float %y, i32 1 | |
14 %c = insertelement <4 x float> %b, float %z, i32 2 | |
15 %d = insertelement <4 x float> %c, float %w, i32 3 | |
16 ret <4 x float> %d | |
17 } | |
18 | |
19 ; Same as test0 but elements inserted in a different order. | |
20 | |
21 ; CHECK: function _test1($x,$y,$z,$w) { | |
22 ; CHECK: $d = SIMD_float32x4($x, $y, $z, $w) | |
23 ; CHECK: } | |
24 define <4 x float> @test1(float %x, float %y, float %z, float %w) { | |
25 %a = insertelement <4 x float> undef, float %w, i32 3 | |
26 %b = insertelement <4 x float> %a, float %y, i32 1 | |
27 %c = insertelement <4 x float> %b, float %z, i32 2 | |
28 %d = insertelement <4 x float> %c, float %x, i32 0 | |
29 ret <4 x float> %d | |
30 } | |
31 | |
32 ; Overwriting elements. | |
33 | |
34 ; CHECK: function _test2($x,$y,$z,$w) { | |
35 ; CHECK: $h = SIMD_float32x4($x, $y, $z, $w) | |
36 ; CHECK: } | |
37 define <4 x float> @test2(float %x, float %y, float %z, float %w) { | |
38 %a = insertelement <4 x float> undef, float %z, i32 0 | |
39 %b = insertelement <4 x float> %a, float %x, i32 0 | |
40 %c = insertelement <4 x float> %b, float %w, i32 1 | |
41 %d = insertelement <4 x float> %c, float %y, i32 1 | |
42 %e = insertelement <4 x float> %d, float %x, i32 2 | |
43 %f = insertelement <4 x float> %e, float %z, i32 2 | |
44 %g = insertelement <4 x float> %f, float %y, i32 3 | |
45 %h = insertelement <4 x float> %g, float %w, i32 3 | |
46 ret <4 x float> %h | |
47 } | |
48 | |
49 ; Basic splat testcase. | |
50 | |
51 ; CHECK: function _test3($x) { | |
52 ; CHECK: $d = SIMD_float32x4_splat($x) | |
53 ; CHECK: } | |
54 define <4 x float> @test3(float %x) { | |
55 %a = insertelement <4 x float> undef, float %x, i32 0 | |
56 %b = insertelement <4 x float> %a, float %x, i32 1 | |
57 %c = insertelement <4 x float> %b, float %x, i32 2 | |
58 %d = insertelement <4 x float> %c, float %x, i32 3 | |
59 ret <4 x float> %d | |
60 } | |
61 | |
62 ; Same as test3 but elements inserted in a different order. | |
63 | |
64 ; CHECK: function _test4($x) { | |
65 ; CHECK: $d = SIMD_float32x4_splat($x) | |
66 ; CHECK: } | |
67 define <4 x float> @test4(float %x) { | |
68 %a = insertelement <4 x float> undef, float %x, i32 3 | |
69 %b = insertelement <4 x float> %a, float %x, i32 1 | |
70 %c = insertelement <4 x float> %b, float %x, i32 2 | |
71 %d = insertelement <4 x float> %c, float %x, i32 0 | |
72 ret <4 x float> %d | |
73 } | |
74 | |
75 ; Insert chain. | |
76 | |
77 ; CHECK: function _test5($x,$y,$z,$w) { | |
78 ; CHECK: $f = SIMD_float32x4_withZ(SIMD_float32x4_withY(SIMD_float32x4_withX(S
IMD_float32x4_splat(Math_fround(0)),$x),$y),$z) | |
79 ; CHECK: } | |
80 define <4 x float> @test5(float %x, float %y, float %z, float %w) { | |
81 %a = insertelement <4 x float> undef, float %z, i32 0 | |
82 %b = insertelement <4 x float> %a, float %x, i32 0 | |
83 %c = insertelement <4 x float> %b, float %w, i32 1 | |
84 %d = insertelement <4 x float> %c, float %y, i32 1 | |
85 %e = insertelement <4 x float> %d, float %x, i32 2 | |
86 %f = insertelement <4 x float> %e, float %z, i32 2 | |
87 ret <4 x float> %f | |
88 } | |
89 | |
90 ; Splat via insert+shuffle. | |
91 | |
92 ; CHECK: function _test6($x) { | |
93 ; CHECK: $b = SIMD_float32x4_splat($x) | |
94 ; CHECK: } | |
95 define <4 x float> @test6(float %x) { | |
96 %a = insertelement <4 x float> undef, float %x, i32 0 | |
97 %b = shufflevector <4 x float> %a, <4 x float> undef, <4 x i32> zeroinitiali
zer | |
98 ret <4 x float> %b | |
99 } | |
OLD | NEW |