1 ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,SIMD128
2 ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s --check-prefixes CHECK,NO-SIMD128
4 ; Test that basic SIMD128 vector manipulation operations assemble as expected.
6 target triple = "wasm32-unknown-unknown"
8 ; ==============================================================================
10 ; ==============================================================================
11 ; CHECK-LABEL: const_v16i8:
12 ; NO-SIMD128-NOT: i8x16
13 ; SIMD128-NEXT: .functype const_v16i8 () -> (v128){{$}}
14 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=,
15 ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
16 ; SIMD128-NEXT: return $pop[[R]]{{$}}
17 define <16 x i8> @const_v16i8() {
18 ret <16 x i8> <i8 00, i8 01, i8 02, i8 03, i8 04, i8 05, i8 06, i8 07,
19 i8 08, i8 09, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
22 ; CHECK-LABEL: splat_v16i8:
23 ; NO-SIMD128-NOT: i8x16
24 ; SIMD128-NEXT: .functype splat_v16i8 (i32) -> (v128){{$}}
25 ; SIMD128-NEXT: i8x16.splat $push[[R:[0-9]+]]=, $0{{$}}
26 ; SIMD128-NEXT: return $pop[[R]]{{$}}
27 define <16 x i8> @splat_v16i8(i8 %x) {
28 %v = insertelement <16 x i8> undef, i8 %x, i32 0
29 %res = shufflevector <16 x i8> %v, <16 x i8> undef,
30 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
31 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
35 ; CHECK-LABEL: const_splat_v16i8:
36 ; SIMD128: v128.const $push0=, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42{{$}}
37 define <16 x i8> @const_splat_v16i8() {
38 ret <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42,
39 i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>
42 ; CHECK-LABEL: extract_v16i8_s:
43 ; NO-SIMD128-NOT: i8x16
44 ; SIMD128-NEXT: .functype extract_v16i8_s (v128) -> (i32){{$}}
45 ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 13{{$}}
46 ; SIMD128-NEXT: return $pop[[R]]{{$}}
47 define i32 @extract_v16i8_s(<16 x i8> %v) {
48 %elem = extractelement <16 x i8> %v, i8 13
49 %a = sext i8 %elem to i32
53 ; CHECK-LABEL: extract_var_v16i8_s:
54 ; NO-SIMD128-NOT: i8x16
55 ; SIMD128-NEXT: .functype extract_var_v16i8_s (v128, i32) -> (i32){{$}}
56 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer
57 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16
58 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]
59 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]
60 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0
61 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15
62 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]
63 ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]]
64 ; SIMD128-NEXT: i32.load8_s $push[[R:[0-9]+]]=, 0($pop[[L6]])
65 ; SIMD128-NEXT: return $pop[[R]]
66 define i32 @extract_var_v16i8_s(<16 x i8> %v, i32 %i) {
67 %elem = extractelement <16 x i8> %v, i32 %i
68 %a = sext i8 %elem to i32
72 ; CHECK-LABEL: extract_undef_v16i8_s:
73 ; NO-SIMD128-NOT: i8x16
74 ; SIMD128-NEXT: .functype extract_undef_v16i8_s (v128) -> (i32){{$}}
75 ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}}
76 ; SIMD128-NEXT: return $pop[[R]]{{$}}
77 define i32 @extract_undef_v16i8_s(<16 x i8> %v) {
78 %elem = extractelement <16 x i8> %v, i8 undef
79 %a = sext i8 %elem to i32
83 ; CHECK-LABEL: extract_v16i8_u:
84 ; NO-SIMD128-NOT: i8x16
85 ; SIMD128-NEXT: .functype extract_v16i8_u (v128) -> (i32){{$}}
86 ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 13{{$}}
87 ; SIMD128-NEXT: return $pop[[R]]{{$}}
88 define i32 @extract_v16i8_u(<16 x i8> %v) {
89 %elem = extractelement <16 x i8> %v, i8 13
90 %a = zext i8 %elem to i32
94 ; CHECK-LABEL: extract_var_v16i8_u:
95 ; NO-SIMD128-NOT: i8x16
96 ; SIMD128-NEXT: .functype extract_var_v16i8_u (v128, i32) -> (i32){{$}}
97 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
98 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
99 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
100 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
101 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
102 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}}
103 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
104 ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]]{{$}}
105 ; SIMD128-NEXT: i32.load8_u $push[[R:[0-9]+]]=, 0($pop[[L6]]){{$}}
106 ; SIMD128-NEXT: return $pop[[R]]{{$}}
107 define i32 @extract_var_v16i8_u(<16 x i8> %v, i32 %i) {
108 %elem = extractelement <16 x i8> %v, i32 %i
109 %a = zext i8 %elem to i32
113 ; CHECK-LABEL: extract_undef_v16i8_u:
114 ; NO-SIMD128-NOT: i8x16
115 ; SIMD128-NEXT: .functype extract_undef_v16i8_u (v128) -> (i32){{$}}
116 ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}}
117 ; SIMD128-NEXT: return $pop[[R]]{{$}}
118 define i32 @extract_undef_v16i8_u(<16 x i8> %v) {
119 %elem = extractelement <16 x i8> %v, i8 undef
120 %a = zext i8 %elem to i32
124 ; CHECK-LABEL: extract_v16i8:
125 ; NO-SIMD128-NOT: i8x16
126 ; SIMD128-NEXT: .functype extract_v16i8 (v128) -> (i32){{$}}
127 ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 13{{$}}
128 ; SIMD128-NEXT: return $pop[[R]]{{$}}
129 define i8 @extract_v16i8(<16 x i8> %v) {
130 %elem = extractelement <16 x i8> %v, i8 13
134 ; CHECK-LABEL: extract_var_v16i8:
135 ; NO-SIMD128-NOT: i8x16
136 ; SIMD128-NEXT: .functype extract_var_v16i8 (v128, i32) -> (i32){{$}}
137 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
138 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
139 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
140 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
141 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
142 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}}
143 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
144 ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]]{{$}}
145 ; SIMD128-NEXT: i32.load8_u $push[[R:[0-9]+]]=, 0($pop[[L6]]){{$}}
146 ; SIMD128-NEXT: return $pop[[R]]{{$}}
147 define i8 @extract_var_v16i8(<16 x i8> %v, i32 %i) {
148 %elem = extractelement <16 x i8> %v, i32 %i
152 ; CHECK-LABEL: extract_undef_v16i8:
153 ; NO-SIMD128-NOT: i8x16
154 ; SIMD128-NEXT: .functype extract_undef_v16i8 (v128) -> (i32){{$}}
155 ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}}
156 ; SIMD128-NEXT: return $pop[[R]]{{$}}
157 define i8 @extract_undef_v16i8(<16 x i8> %v) {
158 %elem = extractelement <16 x i8> %v, i8 undef
162 ; CHECK-LABEL: replace_v16i8:
163 ; NO-SIMD128-NOT: i8x16
164 ; SIMD128-NEXT: .functype replace_v16i8 (v128, i32) -> (v128){{$}}
165 ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $0, 11, $1{{$}}
166 ; SIMD128-NEXT: return $pop[[R]]{{$}}
167 define <16 x i8> @replace_v16i8(<16 x i8> %v, i8 %x) {
168 %res = insertelement <16 x i8> %v, i8 %x, i32 11
172 ; CHECK-LABEL: replace_var_v16i8:
173 ; NO-SIMD128-NOT: i8x16
174 ; SIMD128-NEXT: .functype replace_var_v16i8 (v128, i32, i32) -> (v128){{$}}
175 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
176 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
177 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
178 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
179 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
180 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}}
181 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
182 ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $3, $pop[[L5]]{{$}}
183 ; SIMD128-NEXT: i32.store8 0($pop[[L6]]), $2{{$}}
184 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
185 ; SIMD128-NEXT: return $pop[[R]]{{$}}
186 define <16 x i8> @replace_var_v16i8(<16 x i8> %v, i32 %i, i8 %x) {
187 %res = insertelement <16 x i8> %v, i8 %x, i32 %i
191 ; CHECK-LABEL: replace_zero_v16i8:
192 ; NO-SIMD128-NOT: i8x16
193 ; SIMD128-NEXT: .functype replace_zero_v16i8 (v128, i32) -> (v128){{$}}
194 ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
195 ; SIMD128-NEXT: return $pop[[R]]{{$}}
196 define <16 x i8> @replace_zero_v16i8(<16 x i8> %v, i8 %x) {
197 %res = insertelement <16 x i8> %v, i8 %x, i32 0
201 ; CHECK-LABEL: shuffle_v16i8:
202 ; NO-SIMD128-NOT: i8x16
203 ; SIMD128-NEXT: .functype shuffle_v16i8 (v128, v128) -> (v128){{$}}
204 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
205 ; SIMD128-SAME: 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31{{$}}
206 ; SIMD128-NEXT: return $pop[[R]]{{$}}
207 define <16 x i8> @shuffle_v16i8(<16 x i8> %x, <16 x i8> %y) {
208 %res = shufflevector <16 x i8> %x, <16 x i8> %y,
209 <16 x i32> <i32 0, i32 17, i32 2, i32 19, i32 4, i32 21, i32 6, i32 23,
210 i32 8, i32 25, i32 10, i32 27, i32 12, i32 29, i32 14, i32 31>
214 ; CHECK-LABEL: shuffle_undef_v16i8:
215 ; NO-SIMD128-NOT: i8x16
216 ; SIMD128-NEXT: .functype shuffle_undef_v16i8 (v128, v128) -> (v128){{$}}
217 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
218 ; SIMD128-SAME: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
219 ; SIMD128-NEXT: return $pop[[R]]{{$}}
220 define <16 x i8> @shuffle_undef_v16i8(<16 x i8> %x, <16 x i8> %y) {
221 %res = shufflevector <16 x i8> %x, <16 x i8> %y,
222 <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef,
223 i32 undef, i32 undef, i32 undef, i32 undef,
224 i32 undef, i32 undef, i32 undef, i32 undef,
225 i32 undef, i32 undef, i32 undef, i32 undef>
229 ; CHECK-LABEL: build_v16i8:
230 ; NO-SIMD128-NOT: i8x16
231 ; SIMD128-NEXT: .functype build_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (v128){{$}}
232 ; SIMD128-NEXT: i8x16.splat $push[[L0:[0-9]+]]=, $0{{$}}
233 ; SIMD128-NEXT: i8x16.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
234 ; SIMD128-NEXT: i8x16.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}}
235 ; SIMD128-NEXT: i8x16.replace_lane $push[[L3:[0-9]+]]=, $pop[[L2]], 3, $3{{$}}
236 ; SIMD128-NEXT: i8x16.replace_lane $push[[L4:[0-9]+]]=, $pop[[L3]], 4, $4{{$}}
237 ; SIMD128-NEXT: i8x16.replace_lane $push[[L5:[0-9]+]]=, $pop[[L4]], 5, $5{{$}}
238 ; SIMD128-NEXT: i8x16.replace_lane $push[[L6:[0-9]+]]=, $pop[[L5]], 6, $6{{$}}
239 ; SIMD128-NEXT: i8x16.replace_lane $push[[L7:[0-9]+]]=, $pop[[L6]], 7, $7{{$}}
240 ; SIMD128-NEXT: i8x16.replace_lane $push[[L8:[0-9]+]]=, $pop[[L7]], 8, $8{{$}}
241 ; SIMD128-NEXT: i8x16.replace_lane $push[[L9:[0-9]+]]=, $pop[[L8]], 9, $9{{$}}
242 ; SIMD128-NEXT: i8x16.replace_lane $push[[L10:[0-9]+]]=, $pop[[L9]], 10, $10{{$}}
243 ; SIMD128-NEXT: i8x16.replace_lane $push[[L11:[0-9]+]]=, $pop[[L10]], 11, $11{{$}}
244 ; SIMD128-NEXT: i8x16.replace_lane $push[[L12:[0-9]+]]=, $pop[[L11]], 12, $12{{$}}
245 ; SIMD128-NEXT: i8x16.replace_lane $push[[L13:[0-9]+]]=, $pop[[L12]], 13, $13{{$}}
246 ; SIMD128-NEXT: i8x16.replace_lane $push[[L14:[0-9]+]]=, $pop[[L13]], 14, $14{{$}}
247 ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $pop[[L14]], 15, $15{{$}}
248 ; SIMD128-NEXT: return $pop[[R]]{{$}}
249 define <16 x i8> @build_v16i8(i8 %x0, i8 %x1, i8 %x2, i8 %x3,
250 i8 %x4, i8 %x5, i8 %x6, i8 %x7,
251 i8 %x8, i8 %x9, i8 %x10, i8 %x11,
252 i8 %x12, i8 %x13, i8 %x14, i8 %x15) {
253 %t0 = insertelement <16 x i8> undef, i8 %x0, i32 0
254 %t1 = insertelement <16 x i8> %t0, i8 %x1, i32 1
255 %t2 = insertelement <16 x i8> %t1, i8 %x2, i32 2
256 %t3 = insertelement <16 x i8> %t2, i8 %x3, i32 3
257 %t4 = insertelement <16 x i8> %t3, i8 %x4, i32 4
258 %t5 = insertelement <16 x i8> %t4, i8 %x5, i32 5
259 %t6 = insertelement <16 x i8> %t5, i8 %x6, i32 6
260 %t7 = insertelement <16 x i8> %t6, i8 %x7, i32 7
261 %t8 = insertelement <16 x i8> %t7, i8 %x8, i32 8
262 %t9 = insertelement <16 x i8> %t8, i8 %x9, i32 9
263 %t10 = insertelement <16 x i8> %t9, i8 %x10, i32 10
264 %t11 = insertelement <16 x i8> %t10, i8 %x11, i32 11
265 %t12 = insertelement <16 x i8> %t11, i8 %x12, i32 12
266 %t13 = insertelement <16 x i8> %t12, i8 %x13, i32 13
267 %t14 = insertelement <16 x i8> %t13, i8 %x14, i32 14
268 %res = insertelement <16 x i8> %t14, i8 %x15, i32 15
272 ; ==============================================================================
274 ; ==============================================================================
275 ; CHECK-LABEL: const_v8i16:
276 ; NO-SIMD128-NOT: i16x8
277 ; SIMD128-NEXT: .functype const_v8i16 () -> (v128){{$}}
278 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 256, 770, 1284, 1798, 2312, 2826, 3340, 3854{{$}}
279 ; SIMD128-NEXT: return $pop[[R]]{{$}}
280 define <8 x i16> @const_v8i16() {
281 ret <8 x i16> <i16 256, i16 770, i16 1284, i16 1798,
282 i16 2312, i16 2826, i16 3340, i16 3854>
285 ; CHECK-LABEL: splat_v8i16:
286 ; NO-SIMD128-NOT: i16x8
287 ; SIMD128-NEXT: .functype splat_v8i16 (i32) -> (v128){{$}}
288 ; SIMD128-NEXT: i16x8.splat $push[[R:[0-9]+]]=, $0{{$}}
289 ; SIMD128-NEXT: return $pop[[R]]{{$}}
290 define <8 x i16> @splat_v8i16(i16 %x) {
291 %v = insertelement <8 x i16> undef, i16 %x, i32 0
292 %res = shufflevector <8 x i16> %v, <8 x i16> undef,
293 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
297 ; CHECK-LABEL: const_splat_v8i16:
298 ; SIMD128: v128.const $push0=, 42, 42, 42, 42, 42, 42, 42, 42{{$}}
299 define <8 x i16> @const_splat_v8i16() {
300 ret <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42>
303 ; CHECK-LABEL: extract_v8i16_s:
304 ; NO-SIMD128-NOT: i16x8
305 ; SIMD128-NEXT: .functype extract_v8i16_s (v128) -> (i32){{$}}
306 ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 5{{$}}
307 ; SIMD128-NEXT: return $pop[[R]]{{$}}
308 define i32 @extract_v8i16_s(<8 x i16> %v) {
309 %elem = extractelement <8 x i16> %v, i16 5
310 %a = sext i16 %elem to i32
314 ; CHECK-LABEL: extract_var_v8i16_s:
315 ; NO-SIMD128-NOT: i16x8
316 ; SIMD128-NEXT: .functype extract_var_v8i16_s (v128, i32) -> (i32){{$}}
317 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
318 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
319 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
320 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
321 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
322 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}}
323 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
324 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}}
325 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
326 ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}}
327 ; SIMD128-NEXT: i32.load16_s $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}}
328 ; SIMD128-NEXT: return $pop[[R]]{{$}}
329 define i32 @extract_var_v8i16_s(<8 x i16> %v, i32 %i) {
330 %elem = extractelement <8 x i16> %v, i32 %i
331 %a = sext i16 %elem to i32
335 ; CHECK-LABEL: extract_undef_v8i16_s:
336 ; NO-SIMD128-NOT: i16x8
337 ; SIMD128-NEXT: .functype extract_undef_v8i16_s (v128) -> (i32){{$}}
338 ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}}
339 ; SIMD128-NEXT: return $pop[[R]]{{$}}
340 define i32 @extract_undef_v8i16_s(<8 x i16> %v) {
341 %elem = extractelement <8 x i16> %v, i16 undef
342 %a = sext i16 %elem to i32
346 ; CHECK-LABEL: extract_v8i16_u:
347 ; NO-SIMD128-NOT: i16x8
348 ; SIMD128-NEXT: .functype extract_v8i16_u (v128) -> (i32){{$}}
349 ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 5{{$}}
350 ; SIMD128-NEXT: return $pop[[R]]{{$}}
351 define i32 @extract_v8i16_u(<8 x i16> %v) {
352 %elem = extractelement <8 x i16> %v, i16 5
353 %a = zext i16 %elem to i32
357 ; CHECK-LABEL: extract_var_v8i16_u:
358 ; NO-SIMD128-NOT: i16x8
359 ; SIMD128-NEXT: .functype extract_var_v8i16_u (v128, i32) -> (i32){{$}}
360 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
361 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
362 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
363 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
364 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
365 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}}
366 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
367 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}}
368 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
369 ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}}
370 ; SIMD128-NEXT: i32.load16_u $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}}
371 ; SIMD128-NEXT: return $pop[[R]]{{$}}
372 define i32 @extract_var_v8i16_u(<8 x i16> %v, i32 %i) {
373 %elem = extractelement <8 x i16> %v, i32 %i
374 %a = zext i16 %elem to i32
378 ; CHECK-LABEL: extract_undef_v8i16_u:
379 ; NO-SIMD128-NOT: i16x8
380 ; SIMD128-NEXT: .functype extract_undef_v8i16_u (v128) -> (i32){{$}}
381 ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}}
382 ; SIMD128-NEXT: return $pop[[R]]{{$}}
383 define i32 @extract_undef_v8i16_u(<8 x i16> %v) {
384 %elem = extractelement <8 x i16> %v, i16 undef
385 %a = zext i16 %elem to i32
389 ; CHECK-LABEL: extract_v8i16:
390 ; NO-SIMD128-NOT: i16x8
391 ; SIMD128-NEXT: .functype extract_v8i16 (v128) -> (i32){{$}}
392 ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 5{{$}}
393 ; SIMD128-NEXT: return $pop[[R]]{{$}}
394 define i16 @extract_v8i16(<8 x i16> %v) {
395 %elem = extractelement <8 x i16> %v, i16 5
399 ; CHECK-LABEL: extract_var_v8i16:
400 ; NO-SIMD128-NOT: i16x8
401 ; SIMD128-NEXT: .functype extract_var_v8i16 (v128, i32) -> (i32){{$}}
402 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
403 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
404 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
405 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
406 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
407 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}}
408 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
409 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}}
410 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
411 ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}}
412 ; SIMD128-NEXT: i32.load16_u $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}}
413 ; SIMD128-NEXT: return $pop[[R]]{{$}}
414 define i16 @extract_var_v8i16(<8 x i16> %v, i32 %i) {
415 %elem = extractelement <8 x i16> %v, i32 %i
419 ; CHECK-LABEL: extract_undef_v8i16:
420 ; NO-SIMD128-NOT: i16x8
421 ; SIMD128-NEXT: .functype extract_undef_v8i16 (v128) -> (i32){{$}}
422 ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}}
423 ; SIMD128-NEXT: return $pop[[R]]{{$}}
424 define i16 @extract_undef_v8i16(<8 x i16> %v) {
425 %elem = extractelement <8 x i16> %v, i16 undef
429 ; CHECK-LABEL: replace_v8i16:
430 ; NO-SIMD128-NOT: i16x8
431 ; SIMD128-NEXT: .functype replace_v8i16 (v128, i32) -> (v128){{$}}
432 ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $0, 7, $1{{$}}
433 ; SIMD128-NEXT: return $pop[[R]]{{$}}
434 define <8 x i16> @replace_v8i16(<8 x i16> %v, i16 %x) {
435 %res = insertelement <8 x i16> %v, i16 %x, i32 7
439 ; CHECK-LABEL: replace_var_v8i16:
440 ; NO-SIMD128-NOT: i16x8
441 ; SIMD128-NEXT: .functype replace_var_v8i16 (v128, i32, i32) -> (v128){{$}}
442 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
443 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
444 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
445 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
446 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
447 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}}
448 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
449 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}}
450 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
451 ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $3, $pop[[L7]]{{$}}
452 ; SIMD128-NEXT: i32.store16 0($pop[[L8]]), $2{{$}}
453 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
454 ; SIMD128-NEXT: return $pop[[R]]{{$}}
455 define <8 x i16> @replace_var_v8i16(<8 x i16> %v, i32 %i, i16 %x) {
456 %res = insertelement <8 x i16> %v, i16 %x, i32 %i
460 ; CHECK-LABEL: replace_zero_v8i16:
461 ; NO-SIMD128-NOT: i16x8
462 ; SIMD128-NEXT: .functype replace_zero_v8i16 (v128, i32) -> (v128){{$}}
463 ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
464 ; SIMD128-NEXT: return $pop[[R]]{{$}}
465 define <8 x i16> @replace_zero_v8i16(<8 x i16> %v, i16 %x) {
466 %res = insertelement <8 x i16> %v, i16 %x, i32 0
470 ; CHECK-LABEL: shuffle_v8i16:
471 ; NO-SIMD128-NOT: i8x16
472 ; SIMD128-NEXT: .functype shuffle_v8i16 (v128, v128) -> (v128){{$}}
473 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
474 ; SIMD128-SAME: 0, 1, 18, 19, 4, 5, 22, 23, 8, 9, 26, 27, 12, 13, 30, 31{{$}}
475 ; SIMD128-NEXT: return $pop[[R]]{{$}}
476 define <8 x i16> @shuffle_v8i16(<8 x i16> %x, <8 x i16> %y) {
477 %res = shufflevector <8 x i16> %x, <8 x i16> %y,
478 <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 15>
482 ; CHECK-LABEL: shuffle_undef_v8i16:
483 ; NO-SIMD128-NOT: i8x16
484 ; SIMD128-NEXT: .functype shuffle_undef_v8i16 (v128, v128) -> (v128){{$}}
485 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
486 ; SIMD128-SAME: 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
487 ; SIMD128-NEXT: return $pop[[R]]{{$}}
488 define <8 x i16> @shuffle_undef_v8i16(<8 x i16> %x, <8 x i16> %y) {
489 %res = shufflevector <8 x i16> %x, <8 x i16> %y,
490 <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef,
491 i32 undef, i32 undef, i32 undef, i32 undef>
495 ; CHECK-LABEL: build_v8i16:
496 ; NO-SIMD128-NOT: i16x8
497 ; SIMD128-NEXT: .functype build_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32) -> (v128){{$}}
498 ; SIMD128-NEXT: i16x8.splat $push[[L0:[0-9]+]]=, $0{{$}}
499 ; SIMD128-NEXT: i16x8.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
500 ; SIMD128-NEXT: i16x8.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}}
501 ; SIMD128-NEXT: i16x8.replace_lane $push[[L3:[0-9]+]]=, $pop[[L2]], 3, $3{{$}}
502 ; SIMD128-NEXT: i16x8.replace_lane $push[[L4:[0-9]+]]=, $pop[[L3]], 4, $4{{$}}
503 ; SIMD128-NEXT: i16x8.replace_lane $push[[L5:[0-9]+]]=, $pop[[L4]], 5, $5{{$}}
504 ; SIMD128-NEXT: i16x8.replace_lane $push[[L6:[0-9]+]]=, $pop[[L5]], 6, $6{{$}}
505 ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $pop[[L6]], 7, $7{{$}}
506 ; SIMD128-NEXT: return $pop[[R]]{{$}}
507 define <8 x i16> @build_v8i16(i16 %x0, i16 %x1, i16 %x2, i16 %x3,
508 i16 %x4, i16 %x5, i16 %x6, i16 %x7) {
509 %t0 = insertelement <8 x i16> undef, i16 %x0, i32 0
510 %t1 = insertelement <8 x i16> %t0, i16 %x1, i32 1
511 %t2 = insertelement <8 x i16> %t1, i16 %x2, i32 2
512 %t3 = insertelement <8 x i16> %t2, i16 %x3, i32 3
513 %t4 = insertelement <8 x i16> %t3, i16 %x4, i32 4
514 %t5 = insertelement <8 x i16> %t4, i16 %x5, i32 5
515 %t6 = insertelement <8 x i16> %t5, i16 %x6, i32 6
516 %res = insertelement <8 x i16> %t6, i16 %x7, i32 7
520 ; ==============================================================================
522 ; ==============================================================================
523 ; CHECK-LABEL: const_v4i32:
524 ; NO-SIMD128-NOT: i32x4
525 ; SIMD128-NEXT: .functype const_v4i32 () -> (v128){{$}}
526 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 50462976, 117835012, 185207048, 252579084{{$}}
527 ; SIMD128-NEXT: return $pop[[R]]{{$}}
528 define <4 x i32> @const_v4i32() {
529 ret <4 x i32> <i32 50462976, i32 117835012, i32 185207048, i32 252579084>
532 ; CHECK-LABEL: splat_v4i32:
533 ; NO-SIMD128-NOT: i32x4
534 ; SIMD128-NEXT: .functype splat_v4i32 (i32) -> (v128){{$}}
535 ; SIMD128-NEXT: i32x4.splat $push[[R:[0-9]+]]=, $0{{$}}
536 ; SIMD128-NEXT: return $pop[[R]]{{$}}
537 define <4 x i32> @splat_v4i32(i32 %x) {
538 %v = insertelement <4 x i32> undef, i32 %x, i32 0
539 %res = shufflevector <4 x i32> %v, <4 x i32> undef,
540 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
544 ; CHECK-LABEL: const_splat_v4i32:
545 ; SIMD128: v128.const $push0=, 42, 42, 42, 42{{$}}
546 define <4 x i32> @const_splat_v4i32() {
547 ret <4 x i32> <i32 42, i32 42, i32 42, i32 42>
550 ; CHECK-LABEL: extract_v4i32:
551 ; NO-SIMD128-NOT: i32x4
552 ; SIMD128-NEXT: .functype extract_v4i32 (v128) -> (i32){{$}}
553 ; SIMD128-NEXT: i32x4.extract_lane $push[[R:[0-9]+]]=, $0, 3{{$}}
554 ; SIMD128-NEXT: return $pop[[R]]{{$}}
555 define i32 @extract_v4i32(<4 x i32> %v) {
556 %elem = extractelement <4 x i32> %v, i32 3
560 ; CHECK-LABEL: extract_var_v4i32:
561 ; NO-SIMD128-NOT: i32x4
562 ; SIMD128-NEXT: .functype extract_var_v4i32 (v128, i32) -> (i32){{$}}
563 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
564 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
565 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
566 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
567 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
568 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 3{{$}}
569 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
570 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}}
571 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
572 ; SIMD128-NEXT: i32.or $push[[L4:[0-9]+]]=, $2, $pop[[L7]]{{$}}
573 ; SIMD128-NEXT: i32.load $push[[R:[0-9]+]]=, 0($pop[[L4]]){{$}}
574 ; SIMD128-NEXT: return $pop[[R]]{{$}}
575 define i32 @extract_var_v4i32(<4 x i32> %v, i32 %i) {
576 %elem = extractelement <4 x i32> %v, i32 %i
580 ; CHECK-LABEL: extract_zero_v4i32:
581 ; NO-SIMD128-NOT: i32x4
582 ; SIMD128-NEXT: .functype extract_zero_v4i32 (v128) -> (i32){{$}}
583 ; SIMD128-NEXT: i32x4.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}}
584 ; SIMD128-NEXT: return $pop[[R]]{{$}}
585 define i32 @extract_zero_v4i32(<4 x i32> %v) {
586 %elem = extractelement <4 x i32> %v, i32 0
590 ; CHECK-LABEL: replace_v4i32:
591 ; NO-SIMD128-NOT: i32x4
592 ; SIMD128-NEXT: .functype replace_v4i32 (v128, i32) -> (v128){{$}}
593 ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $0, 2, $1{{$}}
594 ; SIMD128-NEXT: return $pop[[R]]{{$}}
595 define <4 x i32> @replace_v4i32(<4 x i32> %v, i32 %x) {
596 %res = insertelement <4 x i32> %v, i32 %x, i32 2
600 ; CHECK-LABEL: replace_var_v4i32:
601 ; NO-SIMD128-NOT: i32x4
602 ; SIMD128-NEXT: .functype replace_var_v4i32 (v128, i32, i32) -> (v128){{$}}
603 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
604 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
605 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
606 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
607 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
608 ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 3{{$}}
609 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}}
610 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}}
611 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
612 ; SIMD128-NEXT: i32.or $push[[L4:[0-9]+]]=, $3, $pop[[L7]]{{$}}
613 ; SIMD128-NEXT: i32.store 0($pop[[L4]]), $2{{$}}
614 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
615 ; SIMD128-NEXT: return $pop[[R]]{{$}}
616 define <4 x i32> @replace_var_v4i32(<4 x i32> %v, i32 %i, i32 %x) {
617 %res = insertelement <4 x i32> %v, i32 %x, i32 %i
621 ; CHECK-LABEL: replace_zero_v4i32:
622 ; NO-SIMD128-NOT: i32x4
623 ; SIMD128-NEXT: .functype replace_zero_v4i32 (v128, i32) -> (v128){{$}}
624 ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
625 ; SIMD128-NEXT: return $pop[[R]]{{$}}
626 define <4 x i32> @replace_zero_v4i32(<4 x i32> %v, i32 %x) {
627 %res = insertelement <4 x i32> %v, i32 %x, i32 0
631 ; CHECK-LABEL: shuffle_v4i32:
632 ; NO-SIMD128-NOT: i8x16
633 ; SIMD128-NEXT: .functype shuffle_v4i32 (v128, v128) -> (v128){{$}}
634 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
635 ; SIMD128-SAME: 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31{{$}}
636 ; SIMD128-NEXT: return $pop[[R]]{{$}}
637 define <4 x i32> @shuffle_v4i32(<4 x i32> %x, <4 x i32> %y) {
638 %res = shufflevector <4 x i32> %x, <4 x i32> %y,
639 <4 x i32> <i32 0, i32 5, i32 2, i32 7>
643 ; CHECK-LABEL: shuffle_undef_v4i32:
644 ; NO-SIMD128-NOT: i8x16
645 ; SIMD128-NEXT: .functype shuffle_undef_v4i32 (v128, v128) -> (v128){{$}}
646 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
647 ; SIMD128-SAME: 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
648 ; SIMD128-NEXT: return $pop[[R]]{{$}}
649 define <4 x i32> @shuffle_undef_v4i32(<4 x i32> %x, <4 x i32> %y) {
650 %res = shufflevector <4 x i32> %x, <4 x i32> %y,
651 <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
655 ; CHECK-LABEL: build_v4i32:
656 ; NO-SIMD128-NOT: i32x4
657 ; SIMD128-NEXT: .functype build_v4i32 (i32, i32, i32, i32) -> (v128){{$}}
658 ; SIMD128-NEXT: i32x4.splat $push[[L0:[0-9]+]]=, $0{{$}}
659 ; SIMD128-NEXT: i32x4.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
660 ; SIMD128-NEXT: i32x4.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}}
661 ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L2]], 3, $3{{$}}
662 ; SIMD128-NEXT: return $pop[[R]]{{$}}
663 define <4 x i32> @build_v4i32(i32 %x0, i32 %x1, i32 %x2, i32 %x3) {
664 %t0 = insertelement <4 x i32> undef, i32 %x0, i32 0
665 %t1 = insertelement <4 x i32> %t0, i32 %x1, i32 1
666 %t2 = insertelement <4 x i32> %t1, i32 %x2, i32 2
667 %res = insertelement <4 x i32> %t2, i32 %x3, i32 3
671 ; ==============================================================================
673 ; ==============================================================================
674 ; CHECK-LABEL: const_v2i64:
675 ; NO-SIMD128-NOT: i64x2
676 ; SIMD128-NEXT: .functype const_v2i64 () -> (v128){{$}}
677 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 506097522914230528, 1084818905618843912{{$}}
678 ; SIMD128-NEXT: return $pop[[R]]{{$}}
679 define <2 x i64> @const_v2i64() {
680 ret <2 x i64> <i64 506097522914230528, i64 1084818905618843912>
683 ; CHECK-LABEL: splat_v2i64:
684 ; NO-SIMD128-NOT: i64x2
685 ; SIMD128-NEXT: .functype splat_v2i64 (i64) -> (v128){{$}}
686 ; SIMD128-NEXT: i64x2.splat $push[[R:[0-9]+]]=, $0{{$}}
687 ; SIMD128-NEXT: return $pop[[R]]{{$}}
688 define <2 x i64> @splat_v2i64(i64 %x) {
689 %t1 = insertelement <2 x i64> zeroinitializer, i64 %x, i32 0
690 %res = insertelement <2 x i64> %t1, i64 %x, i32 1
694 ; CHECK-LABEL: const_splat_v2i64:
695 ; SIMD128: v128.const $push0=, 42, 42{{$}}
696 define <2 x i64> @const_splat_v2i64() {
697 ret <2 x i64> <i64 42, i64 42>
700 ; CHECK-LABEL: extract_v2i64:
701 ; NO-SIMD128-NOT: i64x2
702 ; SIMD128-NEXT: .functype extract_v2i64 (v128) -> (i64){{$}}
703 ; SIMD128-NEXT: i64x2.extract_lane $push[[R:[0-9]+]]=, $0, 1{{$}}
704 ; SIMD128-NEXT: return $pop[[R]]{{$}}
705 define i64 @extract_v2i64(<2 x i64> %v) {
706 %elem = extractelement <2 x i64> %v, i64 1
710 ; CHECK-LABEL: extract_var_v2i64:
711 ; NO-SIMD128-NOT: i64x2
712 ; SIMD128-NEXT: .functype extract_var_v2i64 (v128, i32) -> (i64){{$}}
713 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
714 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
715 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
716 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
717 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
718 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}}
719 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
720 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}}
721 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
722 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}}
723 ; SIMD128-NEXT: i64.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}}
724 ; SIMD128-NEXT: return $pop[[R]]{{$}}
725 define i64 @extract_var_v2i64(<2 x i64> %v, i32 %i) {
726 %elem = extractelement <2 x i64> %v, i32 %i
730 ; CHECK-LABEL: extract_zero_v2i64:
731 ; NO-SIMD128-NOT: i64x2
732 ; SIMD128-NEXT: .functype extract_zero_v2i64 (v128) -> (i64){{$}}
733 ; SIMD128-NEXT: i64x2.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}}
734 ; SIMD128-NEXT: return $pop[[R]]{{$}}
735 define i64 @extract_zero_v2i64(<2 x i64> %v) {
736 %elem = extractelement <2 x i64> %v, i64 0
740 ; CHECK-LABEL: replace_v2i64:
741 ; NO-SIMD128-NOT: i64x2
742 ; SIMD128-NEXT: .functype replace_v2i64 (v128, i64) -> (v128){{$}}
743 ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
744 ; SIMD128-NEXT: return $pop[[R]]{{$}}
745 define <2 x i64> @replace_v2i64(<2 x i64> %v, i64 %x) {
746 %res = insertelement <2 x i64> %v, i64 %x, i32 0
750 ; CHECK-LABEL: replace_var_v2i64:
751 ; NO-SIMD128-NOT: i64x2
752 ; SIMD128-NEXT: .functype replace_var_v2i64 (v128, i32, i64) -> (v128){{$}}
753 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
754 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
755 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
756 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
757 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
758 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}}
759 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
760 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}}
761 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
762 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}}
763 ; SIMD128-NEXT: i64.store 0($pop[[L2]]), $2{{$}}
764 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
765 ; SIMD128-NEXT: return $pop[[R]]{{$}}
766 define <2 x i64> @replace_var_v2i64(<2 x i64> %v, i32 %i, i64 %x) {
767 %res = insertelement <2 x i64> %v, i64 %x, i32 %i
771 ; CHECK-LABEL: replace_zero_v2i64:
772 ; NO-SIMD128-NOT: i64x2
773 ; SIMD128-NEXT: .functype replace_zero_v2i64 (v128, i64) -> (v128){{$}}
774 ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
775 ; SIMD128-NEXT: return $pop[[R]]{{$}}
776 define <2 x i64> @replace_zero_v2i64(<2 x i64> %v, i64 %x) {
777 %res = insertelement <2 x i64> %v, i64 %x, i32 0
781 ; CHECK-LABEL: shuffle_v2i64:
782 ; NO-SIMD128-NOT: i8x16
783 ; SIMD128-NEXT: .functype shuffle_v2i64 (v128, v128) -> (v128){{$}}
784 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
785 ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31{{$}}
786 ; SIMD128-NEXT: return $pop[[R]]{{$}}
787 define <2 x i64> @shuffle_v2i64(<2 x i64> %x, <2 x i64> %y) {
788 %res = shufflevector <2 x i64> %x, <2 x i64> %y, <2 x i32> <i32 0, i32 3>
792 ; CHECK-LABEL: shuffle_undef_v2i64:
793 ; NO-SIMD128-NOT: i8x16
794 ; SIMD128-NEXT: .functype shuffle_undef_v2i64 (v128, v128) -> (v128){{$}}
795 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
796 ; SIMD128-SAME: 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
797 ; SIMD128-NEXT: return $pop[[R]]{{$}}
798 define <2 x i64> @shuffle_undef_v2i64(<2 x i64> %x, <2 x i64> %y) {
799 %res = shufflevector <2 x i64> %x, <2 x i64> %y,
800 <2 x i32> <i32 1, i32 undef>
804 ; CHECK-LABEL: build_v2i64:
805 ; NO-SIMD128-NOT: i64x2
806 ; SIMD128-NEXT: .functype build_v2i64 (i64, i64) -> (v128){{$}}
807 ; SIMD128-NEXT: i64x2.splat $push[[L0:[0-9]+]]=, $0{{$}}
808 ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
809 ; SIMD128-NEXT: return $pop[[R]]{{$}}
810 define <2 x i64> @build_v2i64(i64 %x0, i64 %x1) {
811 %t0 = insertelement <2 x i64> undef, i64 %x0, i32 0
812 %res = insertelement <2 x i64> %t0, i64 %x1, i32 1
816 ; ==============================================================================
818 ; ==============================================================================
819 ; CHECK-LABEL: const_v4f32:
820 ; NO-SIMD128-NOT: f32x4
821 ; SIMD128-NEXT: .functype const_v4f32 () -> (v128){{$}}
822 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=,
823 ; SIMD128-SAME: 0x1.0402p-121, 0x1.0c0a08p-113, 0x1.14121p-105, 0x1.1c1a18p-97{{$}}
824 ; SIMD128-NEXT: return $pop[[R]]{{$}}
825 define <4 x float> @const_v4f32() {
826 ret <4 x float> <float 0x3860402000000000, float 0x38e0c0a080000000,
827 float 0x3961412100000000, float 0x39e1c1a180000000>
830 ; CHECK-LABEL: splat_v4f32:
831 ; NO-SIMD128-NOT: f32x4
832 ; SIMD128-NEXT: .functype splat_v4f32 (f32) -> (v128){{$}}
833 ; SIMD128-NEXT: f32x4.splat $push[[R:[0-9]+]]=, $0{{$}}
834 ; SIMD128-NEXT: return $pop[[R]]{{$}}
835 define <4 x float> @splat_v4f32(float %x) {
836 %v = insertelement <4 x float> undef, float %x, i32 0
837 %res = shufflevector <4 x float> %v, <4 x float> undef,
838 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
842 ; CHECK-LABEL: const_splat_v4f32
843 ; SIMD128: v128.const $push0=, 0x1.5p5, 0x1.5p5, 0x1.5p5, 0x1.5p5{{$}}
844 define <4 x float> @const_splat_v4f32() {
845 ret <4 x float> <float 42., float 42., float 42., float 42.>
848 ; CHECK-LABEL: extract_v4f32:
849 ; NO-SIMD128-NOT: f32x4
850 ; SIMD128-NEXT: .functype extract_v4f32 (v128) -> (f32){{$}}
851 ; SIMD128-NEXT: f32x4.extract_lane $push[[R:[0-9]+]]=, $0, 3{{$}}
852 ; SIMD128-NEXT: return $pop[[R]]{{$}}
853 define float @extract_v4f32(<4 x float> %v) {
854 %elem = extractelement <4 x float> %v, i32 3
858 ; CHECK-LABEL: extract_var_v4f32:
859 ; NO-SIMD128-NOT: i64x2
860 ; SIMD128-NEXT: .functype extract_var_v4f32 (v128, i32) -> (f32){{$}}
861 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
862 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
863 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
864 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
865 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
866 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 3{{$}}
867 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
868 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}}
869 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
870 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}}
871 ; SIMD128-NEXT: f32.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}}
872 ; SIMD128-NEXT: return $pop[[R]]{{$}}
873 define float @extract_var_v4f32(<4 x float> %v, i32 %i) {
874 %elem = extractelement <4 x float> %v, i32 %i
878 ; CHECK-LABEL: extract_zero_v4f32:
879 ; NO-SIMD128-NOT: f32x4
880 ; SIMD128-NEXT: .functype extract_zero_v4f32 (v128) -> (f32){{$}}
881 ; SIMD128-NEXT: f32x4.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}}
882 ; SIMD128-NEXT: return $pop[[R]]{{$}}
883 define float @extract_zero_v4f32(<4 x float> %v) {
884 %elem = extractelement <4 x float> %v, i32 0
888 ; CHECK-LABEL: replace_v4f32:
889 ; NO-SIMD128-NOT: f32x4
890 ; SIMD128-NEXT: .functype replace_v4f32 (v128, f32) -> (v128){{$}}
891 ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $0, 2, $1{{$}}
892 ; SIMD128-NEXT: return $pop[[R]]{{$}}
893 define <4 x float> @replace_v4f32(<4 x float> %v, float %x) {
894 %res = insertelement <4 x float> %v, float %x, i32 2
898 ; CHECK-LABEL: replace_var_v4f32:
899 ; NO-SIMD128-NOT: f32x4
900 ; SIMD128-NEXT: .functype replace_var_v4f32 (v128, i32, f32) -> (v128){{$}}
901 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
902 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
903 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
904 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
905 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
906 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 3{{$}}
907 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
908 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}}
909 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
910 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}}
911 ; SIMD128-NEXT: f32.store 0($pop[[L2]]), $2{{$}}
912 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
913 ; SIMD128-NEXT: return $pop[[R]]{{$}}
914 define <4 x float> @replace_var_v4f32(<4 x float> %v, i32 %i, float %x) {
915 %res = insertelement <4 x float> %v, float %x, i32 %i
919 ; CHECK-LABEL: replace_zero_v4f32:
920 ; NO-SIMD128-NOT: f32x4
921 ; SIMD128-NEXT: .functype replace_zero_v4f32 (v128, f32) -> (v128){{$}}
922 ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
923 ; SIMD128-NEXT: return $pop[[R]]{{$}}
924 define <4 x float> @replace_zero_v4f32(<4 x float> %v, float %x) {
925 %res = insertelement <4 x float> %v, float %x, i32 0
929 ; CHECK-LABEL: shuffle_v4f32:
930 ; NO-SIMD128-NOT: i8x16
931 ; SIMD128-NEXT: .functype shuffle_v4f32 (v128, v128) -> (v128){{$}}
932 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
933 ; SIMD128-SAME: 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31{{$}}
934 ; SIMD128-NEXT: return $pop[[R]]{{$}}
935 define <4 x float> @shuffle_v4f32(<4 x float> %x, <4 x float> %y) {
936 %res = shufflevector <4 x float> %x, <4 x float> %y,
937 <4 x i32> <i32 0, i32 5, i32 2, i32 7>
941 ; CHECK-LABEL: shuffle_undef_v4f32:
942 ; NO-SIMD128-NOT: i8x16
943 ; SIMD128-NEXT: .functype shuffle_undef_v4f32 (v128, v128) -> (v128){{$}}
944 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
945 ; SIMD128-SAME: 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
946 ; SIMD128-NEXT: return $pop[[R]]{{$}}
947 define <4 x float> @shuffle_undef_v4f32(<4 x float> %x, <4 x float> %y) {
948 %res = shufflevector <4 x float> %x, <4 x float> %y,
949 <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
953 ; CHECK-LABEL: build_v4f32:
954 ; NO-SIMD128-NOT: f32x4
955 ; SIMD128-NEXT: .functype build_v4f32 (f32, f32, f32, f32) -> (v128){{$}}
956 ; SIMD128-NEXT: f32x4.splat $push[[L0:[0-9]+]]=, $0{{$}}
957 ; SIMD128-NEXT: f32x4.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
958 ; SIMD128-NEXT: f32x4.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}}
959 ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L2]], 3, $3{{$}}
960 ; SIMD128-NEXT: return $pop[[R]]{{$}}
961 define <4 x float> @build_v4f32(float %x0, float %x1, float %x2, float %x3) {
962 %t0 = insertelement <4 x float> undef, float %x0, i32 0
963 %t1 = insertelement <4 x float> %t0, float %x1, i32 1
964 %t2 = insertelement <4 x float> %t1, float %x2, i32 2
965 %res = insertelement <4 x float> %t2, float %x3, i32 3
969 ; ==============================================================================
971 ; ==============================================================================
972 ; CHECK-LABEL: const_v2f64:
973 ; NO-SIMD128-NOT: f64x2
974 ; SIMD128-NEXT: .functype const_v2f64 () -> (v128){{$}}
975 ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 0x1.60504030201p-911, 0x1.e0d0c0b0a0908p-783{{$}}
976 ; SIMD128-NEXT: return $pop[[R]]{{$}}
977 define <2 x double> @const_v2f64() {
978 ret <2 x double> <double 0x0706050403020100, double 0x0F0E0D0C0B0A0908>
981 ; CHECK-LABEL: splat_v2f64:
982 ; NO-SIMD128-NOT: f64x2
983 ; SIMD128-NEXT: .functype splat_v2f64 (f64) -> (v128){{$}}
984 ; SIMD128-NEXT: f64x2.splat $push[[R:[0-9]+]]=, $0{{$}}
985 ; SIMD128-NEXT: return $pop[[R]]{{$}}
986 define <2 x double> @splat_v2f64(double %x) {
987 %t1 = insertelement <2 x double> zeroinitializer, double %x, i3 0
988 %res = insertelement <2 x double> %t1, double %x, i32 1
989 ret <2 x double> %res
992 ; CHECK-LABEL: const_splat_v2f64:
993 ; SIMD128: v128.const $push0=, 0x1.5p5, 0x1.5p5{{$}}
994 define <2 x double> @const_splat_v2f64() {
995 ret <2 x double> <double 42., double 42.>
998 ; CHECK-LABEL: extract_v2f64:
999 ; NO-SIMD128-NOT: f64x2
1000 ; SIMD128-NEXT: .functype extract_v2f64 (v128) -> (f64){{$}}
1001 ; SIMD128-NEXT: f64x2.extract_lane $push[[R:[0-9]+]]=, $0, 1{{$}}
1002 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1003 define double @extract_v2f64(<2 x double> %v) {
1004 %elem = extractelement <2 x double> %v, i32 1
1008 ; CHECK-LABEL: extract_var_v2f64:
1009 ; NO-SIMD128-NOT: i62x2
1010 ; SIMD128-NEXT: .functype extract_var_v2f64 (v128, i32) -> (f64){{$}}
1011 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
1012 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
1013 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
1014 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}}
1015 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
1016 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}}
1017 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
1018 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}}
1019 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
1020 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}}
1021 ; SIMD128-NEXT: f64.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}}
1022 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1023 define double @extract_var_v2f64(<2 x double> %v, i32 %i) {
1024 %elem = extractelement <2 x double> %v, i32 %i
1028 ; CHECK-LABEL: extract_zero_v2f64:
1029 ; NO-SIMD128-NOT: f64x2
1030 ; SIMD128-NEXT: .functype extract_zero_v2f64 (v128) -> (f64){{$}}
1031 ; SIMD128-NEXT: f64x2.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}}
1032 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1033 define double @extract_zero_v2f64(<2 x double> %v) {
1034 %elem = extractelement <2 x double> %v, i32 0
1038 ; CHECK-LABEL: replace_v2f64:
1039 ; NO-SIMD128-NOT: f64x2
1040 ; SIMD128-NEXT: .functype replace_v2f64 (v128, f64) -> (v128){{$}}
1041 ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
1042 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1043 define <2 x double> @replace_v2f64(<2 x double> %v, double %x) {
1044 %res = insertelement <2 x double> %v, double %x, i32 0
1045 ret <2 x double> %res
1048 ; CHECK-LABEL: replace_var_v2f64:
1049 ; NO-SIMD128-NOT: f64x2
1050 ; SIMD128-NEXT: .functype replace_var_v2f64 (v128, i32, f64) -> (v128){{$}}
1051 ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}}
1052 ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}}
1053 ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
1054 ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}}
1055 ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}}
1056 ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}}
1057 ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}}
1058 ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}}
1059 ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}}
1060 ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}}
1061 ; SIMD128-NEXT: f64.store 0($pop[[L2]]), $2{{$}}
1062 ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}}
1063 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1064 define <2 x double> @replace_var_v2f64(<2 x double> %v, i32 %i, double %x) {
1065 %res = insertelement <2 x double> %v, double %x, i32 %i
1066 ret <2 x double> %res
1069 ; CHECK-LABEL: replace_zero_v2f64:
1070 ; NO-SIMD128-NOT: f64x2
1071 ; SIMD128-NEXT: .functype replace_zero_v2f64 (v128, f64) -> (v128){{$}}
1072 ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}}
1073 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1074 define <2 x double> @replace_zero_v2f64(<2 x double> %v, double %x) {
1075 %res = insertelement <2 x double> %v, double %x, i32 0
1076 ret <2 x double> %res
1079 ; CHECK-LABEL: shuffle_v2f64:
1080 ; NO-SIMD128-NOT: i8x16
1081 ; SIMD128-NEXT: .functype shuffle_v2f64 (v128, v128) -> (v128){{$}}
1082 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $1,
1083 ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31{{$}}
1084 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1085 define <2 x double> @shuffle_v2f64(<2 x double> %x, <2 x double> %y) {
1086 %res = shufflevector <2 x double> %x, <2 x double> %y,
1087 <2 x i32> <i32 0, i32 3>
1088 ret <2 x double> %res
1091 ; CHECK-LABEL: shuffle_undef_v2f64:
1092 ; NO-SIMD128-NOT: i8x16
1093 ; SIMD128-NEXT: .functype shuffle_undef_v2f64 (v128, v128) -> (v128){{$}}
1094 ; SIMD128-NEXT: i8x16.shuffle $push[[R:[0-9]+]]=, $0, $0,
1095 ; SIMD128-SAME: 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0{{$}}
1096 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1097 define <2 x double> @shuffle_undef_v2f64(<2 x double> %x, <2 x double> %y) {
1098 %res = shufflevector <2 x double> %x, <2 x double> %y,
1099 <2 x i32> <i32 1, i32 undef>
1100 ret <2 x double> %res
1103 ; CHECK-LABEL: build_v2f64:
1104 ; NO-SIMD128-NOT: f64x2
1105 ; SIMD128-NEXT: .functype build_v2f64 (f64, f64) -> (v128){{$}}
1106 ; SIMD128-NEXT: f64x2.splat $push[[L0:[0-9]+]]=, $0{{$}}
1107 ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L0]], 1, $1{{$}}
1108 ; SIMD128-NEXT: return $pop[[R]]{{$}}
1109 define <2 x double> @build_v2f64(double %x0, double %x1) {
1110 %t0 = insertelement <2 x double> undef, double %x0, i32 0
1111 %res = insertelement <2 x double> %t0, double %x1, i32 1
1112 ret <2 x double> %res