1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128,+sign-ext | FileCheck %s --check-prefix=SIMD128
3 ; RUN: llc < %s -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s --check-prefix=NO-SIMD128
5 ; Test that basic SIMD128 vector manipulation operations assemble as expected.
7 target triple = "wasm32-unknown-unknown"
9 ; ==============================================================================
11 ; ==============================================================================
12 define <16 x i8> @const_v16i8() {
13 ; SIMD128-LABEL: const_v16i8:
14 ; SIMD128: .functype const_v16i8 () -> (v128)
15 ; SIMD128-NEXT: # %bb.0:
16 ; SIMD128-NEXT: v128.const $push0=, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
17 ; SIMD128-NEXT: return $pop0
19 ; NO-SIMD128-LABEL: const_v16i8:
20 ; NO-SIMD128: .functype const_v16i8 (i32) -> ()
21 ; NO-SIMD128-NEXT: # %bb.0:
22 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
23 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
24 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
25 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
26 ; NO-SIMD128-NEXT: return
27 ret <16 x i8> <i8 00, i8 01, i8 02, i8 03, i8 04, i8 05, i8 06, i8 07,
28 i8 08, i8 09, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>
31 define <16 x i8> @splat_v16i8(i8 %x) {
32 ; SIMD128-LABEL: splat_v16i8:
33 ; SIMD128: .functype splat_v16i8 (i32) -> (v128)
34 ; SIMD128-NEXT: # %bb.0:
35 ; SIMD128-NEXT: i8x16.splat $push0=, $0
36 ; SIMD128-NEXT: return $pop0
38 ; NO-SIMD128-LABEL: splat_v16i8:
39 ; NO-SIMD128: .functype splat_v16i8 (i32, i32) -> ()
40 ; NO-SIMD128-NEXT: # %bb.0:
41 ; NO-SIMD128-NEXT: i32.store8 15($0), $1
42 ; NO-SIMD128-NEXT: i32.store8 14($0), $1
43 ; NO-SIMD128-NEXT: i32.store8 13($0), $1
44 ; NO-SIMD128-NEXT: i32.store8 12($0), $1
45 ; NO-SIMD128-NEXT: i32.store8 11($0), $1
46 ; NO-SIMD128-NEXT: i32.store8 10($0), $1
47 ; NO-SIMD128-NEXT: i32.store8 9($0), $1
48 ; NO-SIMD128-NEXT: i32.store8 8($0), $1
49 ; NO-SIMD128-NEXT: i32.store8 7($0), $1
50 ; NO-SIMD128-NEXT: i32.store8 6($0), $1
51 ; NO-SIMD128-NEXT: i32.store8 5($0), $1
52 ; NO-SIMD128-NEXT: i32.store8 4($0), $1
53 ; NO-SIMD128-NEXT: i32.store8 3($0), $1
54 ; NO-SIMD128-NEXT: i32.store8 2($0), $1
55 ; NO-SIMD128-NEXT: i32.store8 1($0), $1
56 ; NO-SIMD128-NEXT: i32.store8 0($0), $1
57 ; NO-SIMD128-NEXT: return
58 %v = insertelement <16 x i8> undef, i8 %x, i32 0
59 %res = shufflevector <16 x i8> %v, <16 x i8> undef,
60 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
61 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
65 define <16 x i8> @const_splat_v16i8() {
66 ; SIMD128-LABEL: const_splat_v16i8:
67 ; SIMD128: .functype const_splat_v16i8 () -> (v128)
68 ; SIMD128-NEXT: # %bb.0:
69 ; SIMD128-NEXT: v128.const $push0=, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42
70 ; SIMD128-NEXT: return $pop0
72 ; NO-SIMD128-LABEL: const_splat_v16i8:
73 ; NO-SIMD128: .functype const_splat_v16i8 (i32) -> ()
74 ; NO-SIMD128-NEXT: # %bb.0:
75 ; NO-SIMD128-NEXT: i64.const $push0=, 3038287259199220266
76 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
77 ; NO-SIMD128-NEXT: i64.const $push1=, 3038287259199220266
78 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
79 ; NO-SIMD128-NEXT: return
80 ret <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42,
81 i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>
84 define i32 @extract_v16i8_s(<16 x i8> %v) {
85 ; SIMD128-LABEL: extract_v16i8_s:
86 ; SIMD128: .functype extract_v16i8_s (v128) -> (i32)
87 ; SIMD128-NEXT: # %bb.0:
88 ; SIMD128-NEXT: i8x16.extract_lane_s $push0=, $0, 13
89 ; SIMD128-NEXT: return $pop0
91 ; NO-SIMD128-LABEL: extract_v16i8_s:
92 ; NO-SIMD128: .functype extract_v16i8_s (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
93 ; NO-SIMD128-NEXT: # %bb.0:
94 ; NO-SIMD128-NEXT: i32.extend8_s $push0=, $13
95 ; NO-SIMD128-NEXT: return $pop0
96 %elem = extractelement <16 x i8> %v, i8 13
97 %a = sext i8 %elem to i32
101 define i32 @extract_var_v16i8_s(<16 x i8> %v, i32 %i) {
102 ; SIMD128-LABEL: extract_var_v16i8_s:
103 ; SIMD128: .functype extract_var_v16i8_s (v128, i32) -> (i32)
104 ; SIMD128-NEXT: # %bb.0:
105 ; SIMD128-NEXT: global.get $push4=, __stack_pointer
106 ; SIMD128-NEXT: i32.const $push5=, 16
107 ; SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
108 ; SIMD128-NEXT: local.tee $push6=, $2=, $pop7
109 ; SIMD128-NEXT: v128.store 0($pop6), $0
110 ; SIMD128-NEXT: i32.const $push0=, 15
111 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
112 ; SIMD128-NEXT: i32.or $push2=, $2, $pop1
113 ; SIMD128-NEXT: i32.load8_s $push3=, 0($pop2)
114 ; SIMD128-NEXT: return $pop3
116 ; NO-SIMD128-LABEL: extract_var_v16i8_s:
117 ; NO-SIMD128: .functype extract_var_v16i8_s (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
118 ; NO-SIMD128-NEXT: # %bb.0:
119 ; NO-SIMD128-NEXT: global.get $push4=, __stack_pointer
120 ; NO-SIMD128-NEXT: i32.const $push5=, 16
121 ; NO-SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
122 ; NO-SIMD128-NEXT: local.tee $push6=, $17=, $pop7
123 ; NO-SIMD128-NEXT: i32.store8 15($pop6), $15
124 ; NO-SIMD128-NEXT: i32.store8 14($17), $14
125 ; NO-SIMD128-NEXT: i32.store8 13($17), $13
126 ; NO-SIMD128-NEXT: i32.store8 12($17), $12
127 ; NO-SIMD128-NEXT: i32.store8 11($17), $11
128 ; NO-SIMD128-NEXT: i32.store8 10($17), $10
129 ; NO-SIMD128-NEXT: i32.store8 9($17), $9
130 ; NO-SIMD128-NEXT: i32.store8 8($17), $8
131 ; NO-SIMD128-NEXT: i32.store8 7($17), $7
132 ; NO-SIMD128-NEXT: i32.store8 6($17), $6
133 ; NO-SIMD128-NEXT: i32.store8 5($17), $5
134 ; NO-SIMD128-NEXT: i32.store8 4($17), $4
135 ; NO-SIMD128-NEXT: i32.store8 3($17), $3
136 ; NO-SIMD128-NEXT: i32.store8 2($17), $2
137 ; NO-SIMD128-NEXT: i32.store8 1($17), $1
138 ; NO-SIMD128-NEXT: i32.store8 0($17), $0
139 ; NO-SIMD128-NEXT: i32.const $push0=, 15
140 ; NO-SIMD128-NEXT: i32.and $push1=, $16, $pop0
141 ; NO-SIMD128-NEXT: i32.or $push2=, $17, $pop1
142 ; NO-SIMD128-NEXT: i32.load8_s $push3=, 0($pop2)
143 ; NO-SIMD128-NEXT: return $pop3
144 %elem = extractelement <16 x i8> %v, i32 %i
145 %a = sext i8 %elem to i32
149 define i32 @extract_undef_v16i8_s(<16 x i8> %v) {
150 ; SIMD128-LABEL: extract_undef_v16i8_s:
151 ; SIMD128: .functype extract_undef_v16i8_s (v128) -> (i32)
152 ; SIMD128-NEXT: # %bb.0:
153 ; SIMD128-NEXT: i8x16.extract_lane_s $push0=, $0, 0
154 ; SIMD128-NEXT: return $pop0
156 ; NO-SIMD128-LABEL: extract_undef_v16i8_s:
157 ; NO-SIMD128: .functype extract_undef_v16i8_s (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
158 ; NO-SIMD128-NEXT: # %bb.0:
159 ; NO-SIMD128-NEXT: i32.extend8_s $push0=, $0
160 ; NO-SIMD128-NEXT: return $pop0
161 %elem = extractelement <16 x i8> %v, i8 undef
162 %a = sext i8 %elem to i32
166 define i32 @extract_v16i8_u(<16 x i8> %v) {
167 ; SIMD128-LABEL: extract_v16i8_u:
168 ; SIMD128: .functype extract_v16i8_u (v128) -> (i32)
169 ; SIMD128-NEXT: # %bb.0:
170 ; SIMD128-NEXT: i8x16.extract_lane_u $push0=, $0, 13
171 ; SIMD128-NEXT: return $pop0
173 ; NO-SIMD128-LABEL: extract_v16i8_u:
174 ; NO-SIMD128: .functype extract_v16i8_u (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
175 ; NO-SIMD128-NEXT: # %bb.0:
176 ; NO-SIMD128-NEXT: i32.const $push0=, 255
177 ; NO-SIMD128-NEXT: i32.and $push1=, $13, $pop0
178 ; NO-SIMD128-NEXT: return $pop1
179 %elem = extractelement <16 x i8> %v, i8 13
180 %a = zext i8 %elem to i32
184 define i32 @extract_var_v16i8_u(<16 x i8> %v, i32 %i) {
185 ; SIMD128-LABEL: extract_var_v16i8_u:
186 ; SIMD128: .functype extract_var_v16i8_u (v128, i32) -> (i32)
187 ; SIMD128-NEXT: # %bb.0:
188 ; SIMD128-NEXT: global.get $push4=, __stack_pointer
189 ; SIMD128-NEXT: i32.const $push5=, 16
190 ; SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
191 ; SIMD128-NEXT: local.tee $push6=, $2=, $pop7
192 ; SIMD128-NEXT: v128.store 0($pop6), $0
193 ; SIMD128-NEXT: i32.const $push0=, 15
194 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
195 ; SIMD128-NEXT: i32.or $push2=, $2, $pop1
196 ; SIMD128-NEXT: i32.load8_u $push3=, 0($pop2)
197 ; SIMD128-NEXT: return $pop3
199 ; NO-SIMD128-LABEL: extract_var_v16i8_u:
200 ; NO-SIMD128: .functype extract_var_v16i8_u (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
201 ; NO-SIMD128-NEXT: # %bb.0:
202 ; NO-SIMD128-NEXT: global.get $push4=, __stack_pointer
203 ; NO-SIMD128-NEXT: i32.const $push5=, 16
204 ; NO-SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
205 ; NO-SIMD128-NEXT: local.tee $push6=, $17=, $pop7
206 ; NO-SIMD128-NEXT: i32.store8 15($pop6), $15
207 ; NO-SIMD128-NEXT: i32.store8 14($17), $14
208 ; NO-SIMD128-NEXT: i32.store8 13($17), $13
209 ; NO-SIMD128-NEXT: i32.store8 12($17), $12
210 ; NO-SIMD128-NEXT: i32.store8 11($17), $11
211 ; NO-SIMD128-NEXT: i32.store8 10($17), $10
212 ; NO-SIMD128-NEXT: i32.store8 9($17), $9
213 ; NO-SIMD128-NEXT: i32.store8 8($17), $8
214 ; NO-SIMD128-NEXT: i32.store8 7($17), $7
215 ; NO-SIMD128-NEXT: i32.store8 6($17), $6
216 ; NO-SIMD128-NEXT: i32.store8 5($17), $5
217 ; NO-SIMD128-NEXT: i32.store8 4($17), $4
218 ; NO-SIMD128-NEXT: i32.store8 3($17), $3
219 ; NO-SIMD128-NEXT: i32.store8 2($17), $2
220 ; NO-SIMD128-NEXT: i32.store8 1($17), $1
221 ; NO-SIMD128-NEXT: i32.store8 0($17), $0
222 ; NO-SIMD128-NEXT: i32.const $push0=, 15
223 ; NO-SIMD128-NEXT: i32.and $push1=, $16, $pop0
224 ; NO-SIMD128-NEXT: i32.or $push2=, $17, $pop1
225 ; NO-SIMD128-NEXT: i32.load8_u $push3=, 0($pop2)
226 ; NO-SIMD128-NEXT: return $pop3
227 %elem = extractelement <16 x i8> %v, i32 %i
228 %a = zext i8 %elem to i32
232 define i32 @extract_undef_v16i8_u(<16 x i8> %v) {
233 ; SIMD128-LABEL: extract_undef_v16i8_u:
234 ; SIMD128: .functype extract_undef_v16i8_u (v128) -> (i32)
235 ; SIMD128-NEXT: # %bb.0:
236 ; SIMD128-NEXT: i8x16.extract_lane_u $push0=, $0, 0
237 ; SIMD128-NEXT: return $pop0
239 ; NO-SIMD128-LABEL: extract_undef_v16i8_u:
240 ; NO-SIMD128: .functype extract_undef_v16i8_u (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
241 ; NO-SIMD128-NEXT: # %bb.0:
242 ; NO-SIMD128-NEXT: i32.const $push0=, 255
243 ; NO-SIMD128-NEXT: i32.and $push1=, $0, $pop0
244 ; NO-SIMD128-NEXT: return $pop1
245 %elem = extractelement <16 x i8> %v, i8 undef
246 %a = zext i8 %elem to i32
250 define i8 @extract_v16i8(<16 x i8> %v) {
251 ; SIMD128-LABEL: extract_v16i8:
252 ; SIMD128: .functype extract_v16i8 (v128) -> (i32)
253 ; SIMD128-NEXT: # %bb.0:
254 ; SIMD128-NEXT: i8x16.extract_lane_u $push0=, $0, 13
255 ; SIMD128-NEXT: return $pop0
257 ; NO-SIMD128-LABEL: extract_v16i8:
258 ; NO-SIMD128: .functype extract_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
259 ; NO-SIMD128-NEXT: # %bb.0:
260 ; NO-SIMD128-NEXT: return $13
261 %elem = extractelement <16 x i8> %v, i8 13
265 define i8 @extract_var_v16i8(<16 x i8> %v, i32 %i) {
266 ; SIMD128-LABEL: extract_var_v16i8:
267 ; SIMD128: .functype extract_var_v16i8 (v128, i32) -> (i32)
268 ; SIMD128-NEXT: # %bb.0:
269 ; SIMD128-NEXT: global.get $push4=, __stack_pointer
270 ; SIMD128-NEXT: i32.const $push5=, 16
271 ; SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
272 ; SIMD128-NEXT: local.tee $push6=, $2=, $pop7
273 ; SIMD128-NEXT: v128.store 0($pop6), $0
274 ; SIMD128-NEXT: i32.const $push0=, 15
275 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
276 ; SIMD128-NEXT: i32.or $push2=, $2, $pop1
277 ; SIMD128-NEXT: i32.load8_u $push3=, 0($pop2)
278 ; SIMD128-NEXT: return $pop3
280 ; NO-SIMD128-LABEL: extract_var_v16i8:
281 ; NO-SIMD128: .functype extract_var_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
282 ; NO-SIMD128-NEXT: # %bb.0:
283 ; NO-SIMD128-NEXT: global.get $push4=, __stack_pointer
284 ; NO-SIMD128-NEXT: i32.const $push5=, 16
285 ; NO-SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
286 ; NO-SIMD128-NEXT: local.tee $push6=, $17=, $pop7
287 ; NO-SIMD128-NEXT: i32.store8 15($pop6), $15
288 ; NO-SIMD128-NEXT: i32.store8 14($17), $14
289 ; NO-SIMD128-NEXT: i32.store8 13($17), $13
290 ; NO-SIMD128-NEXT: i32.store8 12($17), $12
291 ; NO-SIMD128-NEXT: i32.store8 11($17), $11
292 ; NO-SIMD128-NEXT: i32.store8 10($17), $10
293 ; NO-SIMD128-NEXT: i32.store8 9($17), $9
294 ; NO-SIMD128-NEXT: i32.store8 8($17), $8
295 ; NO-SIMD128-NEXT: i32.store8 7($17), $7
296 ; NO-SIMD128-NEXT: i32.store8 6($17), $6
297 ; NO-SIMD128-NEXT: i32.store8 5($17), $5
298 ; NO-SIMD128-NEXT: i32.store8 4($17), $4
299 ; NO-SIMD128-NEXT: i32.store8 3($17), $3
300 ; NO-SIMD128-NEXT: i32.store8 2($17), $2
301 ; NO-SIMD128-NEXT: i32.store8 1($17), $1
302 ; NO-SIMD128-NEXT: i32.store8 0($17), $0
303 ; NO-SIMD128-NEXT: i32.const $push0=, 15
304 ; NO-SIMD128-NEXT: i32.and $push1=, $16, $pop0
305 ; NO-SIMD128-NEXT: i32.or $push2=, $17, $pop1
306 ; NO-SIMD128-NEXT: i32.load8_u $push3=, 0($pop2)
307 ; NO-SIMD128-NEXT: return $pop3
308 %elem = extractelement <16 x i8> %v, i32 %i
312 define i8 @extract_undef_v16i8(<16 x i8> %v) {
313 ; SIMD128-LABEL: extract_undef_v16i8:
314 ; SIMD128: .functype extract_undef_v16i8 (v128) -> (i32)
315 ; SIMD128-NEXT: # %bb.0:
316 ; SIMD128-NEXT: i8x16.extract_lane_u $push0=, $0, 0
317 ; SIMD128-NEXT: return $pop0
319 ; NO-SIMD128-LABEL: extract_undef_v16i8:
320 ; NO-SIMD128: .functype extract_undef_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
321 ; NO-SIMD128-NEXT: # %bb.0:
322 ; NO-SIMD128-NEXT: return $0
323 %elem = extractelement <16 x i8> %v, i8 undef
327 define <16 x i8> @replace_v16i8(<16 x i8> %v, i8 %x) {
328 ; SIMD128-LABEL: replace_v16i8:
329 ; SIMD128: .functype replace_v16i8 (v128, i32) -> (v128)
330 ; SIMD128-NEXT: # %bb.0:
331 ; SIMD128-NEXT: i8x16.replace_lane $push0=, $0, 11, $1
332 ; SIMD128-NEXT: return $pop0
334 ; NO-SIMD128-LABEL: replace_v16i8:
335 ; NO-SIMD128: .functype replace_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
336 ; NO-SIMD128-NEXT: # %bb.0:
337 ; NO-SIMD128-NEXT: i32.store8 15($0), $16
338 ; NO-SIMD128-NEXT: i32.store8 14($0), $15
339 ; NO-SIMD128-NEXT: i32.store8 13($0), $14
340 ; NO-SIMD128-NEXT: i32.store8 12($0), $13
341 ; NO-SIMD128-NEXT: i32.store8 11($0), $17
342 ; NO-SIMD128-NEXT: i32.store8 10($0), $11
343 ; NO-SIMD128-NEXT: i32.store8 9($0), $10
344 ; NO-SIMD128-NEXT: i32.store8 8($0), $9
345 ; NO-SIMD128-NEXT: i32.store8 7($0), $8
346 ; NO-SIMD128-NEXT: i32.store8 6($0), $7
347 ; NO-SIMD128-NEXT: i32.store8 5($0), $6
348 ; NO-SIMD128-NEXT: i32.store8 4($0), $5
349 ; NO-SIMD128-NEXT: i32.store8 3($0), $4
350 ; NO-SIMD128-NEXT: i32.store8 2($0), $3
351 ; NO-SIMD128-NEXT: i32.store8 1($0), $2
352 ; NO-SIMD128-NEXT: i32.store8 0($0), $1
353 ; NO-SIMD128-NEXT: return
354 %res = insertelement <16 x i8> %v, i8 %x, i32 11
358 define <16 x i8> @replace_var_v16i8(<16 x i8> %v, i32 %i, i8 %x) {
359 ; SIMD128-LABEL: replace_var_v16i8:
360 ; SIMD128: .functype replace_var_v16i8 (v128, i32, i32) -> (v128)
361 ; SIMD128-NEXT: # %bb.0:
362 ; SIMD128-NEXT: global.get $push4=, __stack_pointer
363 ; SIMD128-NEXT: i32.const $push5=, 16
364 ; SIMD128-NEXT: i32.sub $push7=, $pop4, $pop5
365 ; SIMD128-NEXT: local.tee $push6=, $3=, $pop7
366 ; SIMD128-NEXT: v128.store 0($pop6), $0
367 ; SIMD128-NEXT: i32.const $push0=, 15
368 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
369 ; SIMD128-NEXT: i32.or $push2=, $3, $pop1
370 ; SIMD128-NEXT: i32.store8 0($pop2), $2
371 ; SIMD128-NEXT: v128.load $push3=, 0($3)
372 ; SIMD128-NEXT: return $pop3
374 ; NO-SIMD128-LABEL: replace_var_v16i8:
375 ; NO-SIMD128: .functype replace_var_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
376 ; NO-SIMD128-NEXT: # %bb.0:
377 ; NO-SIMD128-NEXT: global.get $push5=, __stack_pointer
378 ; NO-SIMD128-NEXT: i32.const $push6=, 16
379 ; NO-SIMD128-NEXT: i32.sub $push8=, $pop5, $pop6
380 ; NO-SIMD128-NEXT: local.tee $push7=, $19=, $pop8
381 ; NO-SIMD128-NEXT: i32.store8 15($pop7), $16
382 ; NO-SIMD128-NEXT: i32.store8 14($19), $15
383 ; NO-SIMD128-NEXT: i32.store8 13($19), $14
384 ; NO-SIMD128-NEXT: i32.store8 12($19), $13
385 ; NO-SIMD128-NEXT: i32.store8 11($19), $12
386 ; NO-SIMD128-NEXT: i32.store8 10($19), $11
387 ; NO-SIMD128-NEXT: i32.store8 9($19), $10
388 ; NO-SIMD128-NEXT: i32.store8 8($19), $9
389 ; NO-SIMD128-NEXT: i32.store8 7($19), $8
390 ; NO-SIMD128-NEXT: i32.store8 6($19), $7
391 ; NO-SIMD128-NEXT: i32.store8 5($19), $6
392 ; NO-SIMD128-NEXT: i32.store8 4($19), $5
393 ; NO-SIMD128-NEXT: i32.store8 3($19), $4
394 ; NO-SIMD128-NEXT: i32.store8 2($19), $3
395 ; NO-SIMD128-NEXT: i32.store8 1($19), $2
396 ; NO-SIMD128-NEXT: i32.store8 0($19), $1
397 ; NO-SIMD128-NEXT: i32.const $push0=, 15
398 ; NO-SIMD128-NEXT: i32.and $push1=, $17, $pop0
399 ; NO-SIMD128-NEXT: i32.or $push2=, $19, $pop1
400 ; NO-SIMD128-NEXT: i32.store8 0($pop2), $18
401 ; NO-SIMD128-NEXT: i64.load $push3=, 8($19)
402 ; NO-SIMD128-NEXT: i64.store 8($0), $pop3
403 ; NO-SIMD128-NEXT: i64.load $push4=, 0($19)
404 ; NO-SIMD128-NEXT: i64.store 0($0), $pop4
405 ; NO-SIMD128-NEXT: return
406 %res = insertelement <16 x i8> %v, i8 %x, i32 %i
410 define <16 x i8> @replace_zero_v16i8(<16 x i8> %v, i8 %x) {
411 ; SIMD128-LABEL: replace_zero_v16i8:
412 ; SIMD128: .functype replace_zero_v16i8 (v128, i32) -> (v128)
413 ; SIMD128-NEXT: # %bb.0:
414 ; SIMD128-NEXT: i8x16.replace_lane $push0=, $0, 0, $1
415 ; SIMD128-NEXT: return $pop0
417 ; NO-SIMD128-LABEL: replace_zero_v16i8:
418 ; NO-SIMD128: .functype replace_zero_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
419 ; NO-SIMD128-NEXT: # %bb.0:
420 ; NO-SIMD128-NEXT: i32.store8 15($0), $16
421 ; NO-SIMD128-NEXT: i32.store8 14($0), $15
422 ; NO-SIMD128-NEXT: i32.store8 13($0), $14
423 ; NO-SIMD128-NEXT: i32.store8 12($0), $13
424 ; NO-SIMD128-NEXT: i32.store8 11($0), $12
425 ; NO-SIMD128-NEXT: i32.store8 10($0), $11
426 ; NO-SIMD128-NEXT: i32.store8 9($0), $10
427 ; NO-SIMD128-NEXT: i32.store8 8($0), $9
428 ; NO-SIMD128-NEXT: i32.store8 7($0), $8
429 ; NO-SIMD128-NEXT: i32.store8 6($0), $7
430 ; NO-SIMD128-NEXT: i32.store8 5($0), $6
431 ; NO-SIMD128-NEXT: i32.store8 4($0), $5
432 ; NO-SIMD128-NEXT: i32.store8 3($0), $4
433 ; NO-SIMD128-NEXT: i32.store8 2($0), $3
434 ; NO-SIMD128-NEXT: i32.store8 1($0), $2
435 ; NO-SIMD128-NEXT: i32.store8 0($0), $17
436 ; NO-SIMD128-NEXT: return
437 %res = insertelement <16 x i8> %v, i8 %x, i32 0
441 define <16 x i8> @shuffle_v16i8(<16 x i8> %x, <16 x i8> %y) {
442 ; SIMD128-LABEL: shuffle_v16i8:
443 ; SIMD128: .functype shuffle_v16i8 (v128, v128) -> (v128)
444 ; SIMD128-NEXT: # %bb.0:
445 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31
446 ; SIMD128-NEXT: return $pop0
448 ; NO-SIMD128-LABEL: shuffle_v16i8:
449 ; NO-SIMD128: .functype shuffle_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
450 ; NO-SIMD128-NEXT: # %bb.0:
451 ; NO-SIMD128-NEXT: i32.store8 15($0), $32
452 ; NO-SIMD128-NEXT: i32.store8 14($0), $15
453 ; NO-SIMD128-NEXT: i32.store8 13($0), $30
454 ; NO-SIMD128-NEXT: i32.store8 12($0), $13
455 ; NO-SIMD128-NEXT: i32.store8 11($0), $28
456 ; NO-SIMD128-NEXT: i32.store8 10($0), $11
457 ; NO-SIMD128-NEXT: i32.store8 9($0), $26
458 ; NO-SIMD128-NEXT: i32.store8 8($0), $9
459 ; NO-SIMD128-NEXT: i32.store8 7($0), $24
460 ; NO-SIMD128-NEXT: i32.store8 6($0), $7
461 ; NO-SIMD128-NEXT: i32.store8 5($0), $22
462 ; NO-SIMD128-NEXT: i32.store8 4($0), $5
463 ; NO-SIMD128-NEXT: i32.store8 3($0), $20
464 ; NO-SIMD128-NEXT: i32.store8 2($0), $3
465 ; NO-SIMD128-NEXT: i32.store8 1($0), $18
466 ; NO-SIMD128-NEXT: i32.store8 0($0), $1
467 ; NO-SIMD128-NEXT: return
468 %res = shufflevector <16 x i8> %x, <16 x i8> %y,
469 <16 x i32> <i32 0, i32 17, i32 2, i32 19, i32 4, i32 21, i32 6, i32 23,
470 i32 8, i32 25, i32 10, i32 27, i32 12, i32 29, i32 14, i32 31>
474 define <16 x i8> @shuffle_undef_v16i8(<16 x i8> %x, <16 x i8> %y) {
475 ; SIMD128-LABEL: shuffle_undef_v16i8:
476 ; SIMD128: .functype shuffle_undef_v16i8 (v128, v128) -> (v128)
477 ; SIMD128-NEXT: # %bb.0:
478 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
479 ; SIMD128-NEXT: return $pop0
481 ; NO-SIMD128-LABEL: shuffle_undef_v16i8:
482 ; NO-SIMD128: .functype shuffle_undef_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
483 ; NO-SIMD128-NEXT: # %bb.0:
484 ; NO-SIMD128-NEXT: i32.store8 0($0), $2
485 ; NO-SIMD128-NEXT: return
486 %res = shufflevector <16 x i8> %x, <16 x i8> %y,
487 <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef,
488 i32 undef, i32 undef, i32 undef, i32 undef,
489 i32 undef, i32 undef, i32 undef, i32 undef,
490 i32 undef, i32 undef, i32 undef, i32 undef>
494 define <16 x i8> @build_v16i8(i8 %x0, i8 %x1, i8 %x2, i8 %x3,
495 ; SIMD128-LABEL: build_v16i8:
496 ; SIMD128: .functype build_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (v128)
497 ; SIMD128-NEXT: # %bb.0:
498 ; SIMD128-NEXT: i8x16.splat $push0=, $0
499 ; SIMD128-NEXT: i8x16.replace_lane $push1=, $pop0, 1, $1
500 ; SIMD128-NEXT: i8x16.replace_lane $push2=, $pop1, 2, $2
501 ; SIMD128-NEXT: i8x16.replace_lane $push3=, $pop2, 3, $3
502 ; SIMD128-NEXT: i8x16.replace_lane $push4=, $pop3, 4, $4
503 ; SIMD128-NEXT: i8x16.replace_lane $push5=, $pop4, 5, $5
504 ; SIMD128-NEXT: i8x16.replace_lane $push6=, $pop5, 6, $6
505 ; SIMD128-NEXT: i8x16.replace_lane $push7=, $pop6, 7, $7
506 ; SIMD128-NEXT: i8x16.replace_lane $push8=, $pop7, 8, $8
507 ; SIMD128-NEXT: i8x16.replace_lane $push9=, $pop8, 9, $9
508 ; SIMD128-NEXT: i8x16.replace_lane $push10=, $pop9, 10, $10
509 ; SIMD128-NEXT: i8x16.replace_lane $push11=, $pop10, 11, $11
510 ; SIMD128-NEXT: i8x16.replace_lane $push12=, $pop11, 12, $12
511 ; SIMD128-NEXT: i8x16.replace_lane $push13=, $pop12, 13, $13
512 ; SIMD128-NEXT: i8x16.replace_lane $push14=, $pop13, 14, $14
513 ; SIMD128-NEXT: i8x16.replace_lane $push15=, $pop14, 15, $15
514 ; SIMD128-NEXT: return $pop15
516 ; NO-SIMD128-LABEL: build_v16i8:
517 ; NO-SIMD128: .functype build_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
518 ; NO-SIMD128-NEXT: # %bb.0:
519 ; NO-SIMD128-NEXT: i32.store8 15($0), $16
520 ; NO-SIMD128-NEXT: i32.store8 14($0), $15
521 ; NO-SIMD128-NEXT: i32.store8 13($0), $14
522 ; NO-SIMD128-NEXT: i32.store8 12($0), $13
523 ; NO-SIMD128-NEXT: i32.store8 11($0), $12
524 ; NO-SIMD128-NEXT: i32.store8 10($0), $11
525 ; NO-SIMD128-NEXT: i32.store8 9($0), $10
526 ; NO-SIMD128-NEXT: i32.store8 8($0), $9
527 ; NO-SIMD128-NEXT: i32.store8 7($0), $8
528 ; NO-SIMD128-NEXT: i32.store8 6($0), $7
529 ; NO-SIMD128-NEXT: i32.store8 5($0), $6
530 ; NO-SIMD128-NEXT: i32.store8 4($0), $5
531 ; NO-SIMD128-NEXT: i32.store8 3($0), $4
532 ; NO-SIMD128-NEXT: i32.store8 2($0), $3
533 ; NO-SIMD128-NEXT: i32.store8 1($0), $2
534 ; NO-SIMD128-NEXT: i32.store8 0($0), $1
535 ; NO-SIMD128-NEXT: return
536 i8 %x4, i8 %x5, i8 %x6, i8 %x7,
537 i8 %x8, i8 %x9, i8 %x10, i8 %x11,
538 i8 %x12, i8 %x13, i8 %x14, i8 %x15) {
539 %t0 = insertelement <16 x i8> undef, i8 %x0, i32 0
540 %t1 = insertelement <16 x i8> %t0, i8 %x1, i32 1
541 %t2 = insertelement <16 x i8> %t1, i8 %x2, i32 2
542 %t3 = insertelement <16 x i8> %t2, i8 %x3, i32 3
543 %t4 = insertelement <16 x i8> %t3, i8 %x4, i32 4
544 %t5 = insertelement <16 x i8> %t4, i8 %x5, i32 5
545 %t6 = insertelement <16 x i8> %t5, i8 %x6, i32 6
546 %t7 = insertelement <16 x i8> %t6, i8 %x7, i32 7
547 %t8 = insertelement <16 x i8> %t7, i8 %x8, i32 8
548 %t9 = insertelement <16 x i8> %t8, i8 %x9, i32 9
549 %t10 = insertelement <16 x i8> %t9, i8 %x10, i32 10
550 %t11 = insertelement <16 x i8> %t10, i8 %x11, i32 11
551 %t12 = insertelement <16 x i8> %t11, i8 %x12, i32 12
552 %t13 = insertelement <16 x i8> %t12, i8 %x13, i32 13
553 %t14 = insertelement <16 x i8> %t13, i8 %x14, i32 14
554 %res = insertelement <16 x i8> %t14, i8 %x15, i32 15
558 ; ==============================================================================
560 ; ==============================================================================
561 define <8 x i16> @const_v8i16() {
562 ; SIMD128-LABEL: const_v8i16:
563 ; SIMD128: .functype const_v8i16 () -> (v128)
564 ; SIMD128-NEXT: # %bb.0:
565 ; SIMD128-NEXT: v128.const $push0=, 256, 770, 1284, 1798, 2312, 2826, 3340, 3854
566 ; SIMD128-NEXT: return $pop0
568 ; NO-SIMD128-LABEL: const_v8i16:
569 ; NO-SIMD128: .functype const_v8i16 (i32) -> ()
570 ; NO-SIMD128-NEXT: # %bb.0:
571 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
572 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
573 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
574 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
575 ; NO-SIMD128-NEXT: return
576 ret <8 x i16> <i16 256, i16 770, i16 1284, i16 1798,
577 i16 2312, i16 2826, i16 3340, i16 3854>
580 define <8 x i16> @splat_v8i16(i16 %x) {
581 ; SIMD128-LABEL: splat_v8i16:
582 ; SIMD128: .functype splat_v8i16 (i32) -> (v128)
583 ; SIMD128-NEXT: # %bb.0:
584 ; SIMD128-NEXT: i16x8.splat $push0=, $0
585 ; SIMD128-NEXT: return $pop0
587 ; NO-SIMD128-LABEL: splat_v8i16:
588 ; NO-SIMD128: .functype splat_v8i16 (i32, i32) -> ()
589 ; NO-SIMD128-NEXT: # %bb.0:
590 ; NO-SIMD128-NEXT: i32.store16 14($0), $1
591 ; NO-SIMD128-NEXT: i32.store16 12($0), $1
592 ; NO-SIMD128-NEXT: i32.store16 10($0), $1
593 ; NO-SIMD128-NEXT: i32.store16 8($0), $1
594 ; NO-SIMD128-NEXT: i32.store16 6($0), $1
595 ; NO-SIMD128-NEXT: i32.store16 4($0), $1
596 ; NO-SIMD128-NEXT: i32.store16 2($0), $1
597 ; NO-SIMD128-NEXT: i32.store16 0($0), $1
598 ; NO-SIMD128-NEXT: return
599 %v = insertelement <8 x i16> undef, i16 %x, i32 0
600 %res = shufflevector <8 x i16> %v, <8 x i16> undef,
601 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
605 define <8 x i16> @const_splat_v8i16() {
606 ; SIMD128-LABEL: const_splat_v8i16:
607 ; SIMD128: .functype const_splat_v8i16 () -> (v128)
608 ; SIMD128-NEXT: # %bb.0:
609 ; SIMD128-NEXT: v128.const $push0=, 42, 42, 42, 42, 42, 42, 42, 42
610 ; SIMD128-NEXT: return $pop0
612 ; NO-SIMD128-LABEL: const_splat_v8i16:
613 ; NO-SIMD128: .functype const_splat_v8i16 (i32) -> ()
614 ; NO-SIMD128-NEXT: # %bb.0:
615 ; NO-SIMD128-NEXT: i64.const $push0=, 11822129413226538
616 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
617 ; NO-SIMD128-NEXT: i64.const $push1=, 11822129413226538
618 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
619 ; NO-SIMD128-NEXT: return
620 ret <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42>
623 define i32 @extract_v8i16_s(<8 x i16> %v) {
624 ; SIMD128-LABEL: extract_v8i16_s:
625 ; SIMD128: .functype extract_v8i16_s (v128) -> (i32)
626 ; SIMD128-NEXT: # %bb.0:
627 ; SIMD128-NEXT: i16x8.extract_lane_s $push0=, $0, 5
628 ; SIMD128-NEXT: return $pop0
630 ; NO-SIMD128-LABEL: extract_v8i16_s:
631 ; NO-SIMD128: .functype extract_v8i16_s (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
632 ; NO-SIMD128-NEXT: # %bb.0:
633 ; NO-SIMD128-NEXT: i32.extend16_s $push0=, $5
634 ; NO-SIMD128-NEXT: return $pop0
635 %elem = extractelement <8 x i16> %v, i16 5
636 %a = sext i16 %elem to i32
640 define i32 @extract_var_v8i16_s(<8 x i16> %v, i32 %i) {
641 ; SIMD128-LABEL: extract_var_v8i16_s:
642 ; SIMD128: .functype extract_var_v8i16_s (v128, i32) -> (i32)
643 ; SIMD128-NEXT: # %bb.0:
644 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
645 ; SIMD128-NEXT: i32.const $push7=, 16
646 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
647 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
648 ; SIMD128-NEXT: v128.store 0($pop8), $0
649 ; SIMD128-NEXT: i32.const $push0=, 7
650 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
651 ; SIMD128-NEXT: i32.const $push2=, 1
652 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
653 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
654 ; SIMD128-NEXT: i32.load16_s $push5=, 0($pop4)
655 ; SIMD128-NEXT: return $pop5
657 ; NO-SIMD128-LABEL: extract_var_v8i16_s:
658 ; NO-SIMD128: .functype extract_var_v8i16_s (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
659 ; NO-SIMD128-NEXT: # %bb.0:
660 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
661 ; NO-SIMD128-NEXT: i32.const $push7=, 16
662 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
663 ; NO-SIMD128-NEXT: local.tee $push8=, $9=, $pop9
664 ; NO-SIMD128-NEXT: i32.store16 14($pop8), $7
665 ; NO-SIMD128-NEXT: i32.store16 12($9), $6
666 ; NO-SIMD128-NEXT: i32.store16 10($9), $5
667 ; NO-SIMD128-NEXT: i32.store16 8($9), $4
668 ; NO-SIMD128-NEXT: i32.store16 6($9), $3
669 ; NO-SIMD128-NEXT: i32.store16 4($9), $2
670 ; NO-SIMD128-NEXT: i32.store16 2($9), $1
671 ; NO-SIMD128-NEXT: i32.store16 0($9), $0
672 ; NO-SIMD128-NEXT: i32.const $push0=, 7
673 ; NO-SIMD128-NEXT: i32.and $push1=, $8, $pop0
674 ; NO-SIMD128-NEXT: i32.const $push2=, 1
675 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
676 ; NO-SIMD128-NEXT: i32.or $push4=, $9, $pop3
677 ; NO-SIMD128-NEXT: i32.load16_s $push5=, 0($pop4)
678 ; NO-SIMD128-NEXT: return $pop5
679 %elem = extractelement <8 x i16> %v, i32 %i
680 %a = sext i16 %elem to i32
684 define i32 @extract_undef_v8i16_s(<8 x i16> %v) {
685 ; SIMD128-LABEL: extract_undef_v8i16_s:
686 ; SIMD128: .functype extract_undef_v8i16_s (v128) -> (i32)
687 ; SIMD128-NEXT: # %bb.0:
688 ; SIMD128-NEXT: i16x8.extract_lane_s $push0=, $0, 0
689 ; SIMD128-NEXT: return $pop0
691 ; NO-SIMD128-LABEL: extract_undef_v8i16_s:
692 ; NO-SIMD128: .functype extract_undef_v8i16_s (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
693 ; NO-SIMD128-NEXT: # %bb.0:
694 ; NO-SIMD128-NEXT: i32.extend16_s $push0=, $0
695 ; NO-SIMD128-NEXT: return $pop0
696 %elem = extractelement <8 x i16> %v, i16 undef
697 %a = sext i16 %elem to i32
701 define i32 @extract_v8i16_u(<8 x i16> %v) {
702 ; SIMD128-LABEL: extract_v8i16_u:
703 ; SIMD128: .functype extract_v8i16_u (v128) -> (i32)
704 ; SIMD128-NEXT: # %bb.0:
705 ; SIMD128-NEXT: i16x8.extract_lane_u $push0=, $0, 5
706 ; SIMD128-NEXT: return $pop0
708 ; NO-SIMD128-LABEL: extract_v8i16_u:
709 ; NO-SIMD128: .functype extract_v8i16_u (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
710 ; NO-SIMD128-NEXT: # %bb.0:
711 ; NO-SIMD128-NEXT: i32.const $push0=, 65535
712 ; NO-SIMD128-NEXT: i32.and $push1=, $5, $pop0
713 ; NO-SIMD128-NEXT: return $pop1
714 %elem = extractelement <8 x i16> %v, i16 5
715 %a = zext i16 %elem to i32
719 define i32 @extract_var_v8i16_u(<8 x i16> %v, i32 %i) {
720 ; SIMD128-LABEL: extract_var_v8i16_u:
721 ; SIMD128: .functype extract_var_v8i16_u (v128, i32) -> (i32)
722 ; SIMD128-NEXT: # %bb.0:
723 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
724 ; SIMD128-NEXT: i32.const $push7=, 16
725 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
726 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
727 ; SIMD128-NEXT: v128.store 0($pop8), $0
728 ; SIMD128-NEXT: i32.const $push0=, 7
729 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
730 ; SIMD128-NEXT: i32.const $push2=, 1
731 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
732 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
733 ; SIMD128-NEXT: i32.load16_u $push5=, 0($pop4)
734 ; SIMD128-NEXT: return $pop5
736 ; NO-SIMD128-LABEL: extract_var_v8i16_u:
737 ; NO-SIMD128: .functype extract_var_v8i16_u (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
738 ; NO-SIMD128-NEXT: # %bb.0:
739 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
740 ; NO-SIMD128-NEXT: i32.const $push7=, 16
741 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
742 ; NO-SIMD128-NEXT: local.tee $push8=, $9=, $pop9
743 ; NO-SIMD128-NEXT: i32.store16 14($pop8), $7
744 ; NO-SIMD128-NEXT: i32.store16 12($9), $6
745 ; NO-SIMD128-NEXT: i32.store16 10($9), $5
746 ; NO-SIMD128-NEXT: i32.store16 8($9), $4
747 ; NO-SIMD128-NEXT: i32.store16 6($9), $3
748 ; NO-SIMD128-NEXT: i32.store16 4($9), $2
749 ; NO-SIMD128-NEXT: i32.store16 2($9), $1
750 ; NO-SIMD128-NEXT: i32.store16 0($9), $0
751 ; NO-SIMD128-NEXT: i32.const $push0=, 7
752 ; NO-SIMD128-NEXT: i32.and $push1=, $8, $pop0
753 ; NO-SIMD128-NEXT: i32.const $push2=, 1
754 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
755 ; NO-SIMD128-NEXT: i32.or $push4=, $9, $pop3
756 ; NO-SIMD128-NEXT: i32.load16_u $push5=, 0($pop4)
757 ; NO-SIMD128-NEXT: return $pop5
758 %elem = extractelement <8 x i16> %v, i32 %i
759 %a = zext i16 %elem to i32
763 define i32 @extract_undef_v8i16_u(<8 x i16> %v) {
764 ; SIMD128-LABEL: extract_undef_v8i16_u:
765 ; SIMD128: .functype extract_undef_v8i16_u (v128) -> (i32)
766 ; SIMD128-NEXT: # %bb.0:
767 ; SIMD128-NEXT: i16x8.extract_lane_u $push0=, $0, 0
768 ; SIMD128-NEXT: return $pop0
770 ; NO-SIMD128-LABEL: extract_undef_v8i16_u:
771 ; NO-SIMD128: .functype extract_undef_v8i16_u (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
772 ; NO-SIMD128-NEXT: # %bb.0:
773 ; NO-SIMD128-NEXT: i32.const $push0=, 65535
774 ; NO-SIMD128-NEXT: i32.and $push1=, $0, $pop0
775 ; NO-SIMD128-NEXT: return $pop1
776 %elem = extractelement <8 x i16> %v, i16 undef
777 %a = zext i16 %elem to i32
781 define i16 @extract_v8i16(<8 x i16> %v) {
782 ; SIMD128-LABEL: extract_v8i16:
783 ; SIMD128: .functype extract_v8i16 (v128) -> (i32)
784 ; SIMD128-NEXT: # %bb.0:
785 ; SIMD128-NEXT: i16x8.extract_lane_u $push0=, $0, 5
786 ; SIMD128-NEXT: return $pop0
788 ; NO-SIMD128-LABEL: extract_v8i16:
789 ; NO-SIMD128: .functype extract_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
790 ; NO-SIMD128-NEXT: # %bb.0:
791 ; NO-SIMD128-NEXT: return $5
792 %elem = extractelement <8 x i16> %v, i16 5
796 define i16 @extract_var_v8i16(<8 x i16> %v, i32 %i) {
797 ; SIMD128-LABEL: extract_var_v8i16:
798 ; SIMD128: .functype extract_var_v8i16 (v128, i32) -> (i32)
799 ; SIMD128-NEXT: # %bb.0:
800 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
801 ; SIMD128-NEXT: i32.const $push7=, 16
802 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
803 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
804 ; SIMD128-NEXT: v128.store 0($pop8), $0
805 ; SIMD128-NEXT: i32.const $push0=, 7
806 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
807 ; SIMD128-NEXT: i32.const $push2=, 1
808 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
809 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
810 ; SIMD128-NEXT: i32.load16_u $push5=, 0($pop4)
811 ; SIMD128-NEXT: return $pop5
813 ; NO-SIMD128-LABEL: extract_var_v8i16:
814 ; NO-SIMD128: .functype extract_var_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
815 ; NO-SIMD128-NEXT: # %bb.0:
816 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
817 ; NO-SIMD128-NEXT: i32.const $push7=, 16
818 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
819 ; NO-SIMD128-NEXT: local.tee $push8=, $9=, $pop9
820 ; NO-SIMD128-NEXT: i32.store16 14($pop8), $7
821 ; NO-SIMD128-NEXT: i32.store16 12($9), $6
822 ; NO-SIMD128-NEXT: i32.store16 10($9), $5
823 ; NO-SIMD128-NEXT: i32.store16 8($9), $4
824 ; NO-SIMD128-NEXT: i32.store16 6($9), $3
825 ; NO-SIMD128-NEXT: i32.store16 4($9), $2
826 ; NO-SIMD128-NEXT: i32.store16 2($9), $1
827 ; NO-SIMD128-NEXT: i32.store16 0($9), $0
828 ; NO-SIMD128-NEXT: i32.const $push0=, 7
829 ; NO-SIMD128-NEXT: i32.and $push1=, $8, $pop0
830 ; NO-SIMD128-NEXT: i32.const $push2=, 1
831 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
832 ; NO-SIMD128-NEXT: i32.or $push4=, $9, $pop3
833 ; NO-SIMD128-NEXT: i32.load16_u $push5=, 0($pop4)
834 ; NO-SIMD128-NEXT: return $pop5
835 %elem = extractelement <8 x i16> %v, i32 %i
839 define i16 @extract_undef_v8i16(<8 x i16> %v) {
840 ; SIMD128-LABEL: extract_undef_v8i16:
841 ; SIMD128: .functype extract_undef_v8i16 (v128) -> (i32)
842 ; SIMD128-NEXT: # %bb.0:
843 ; SIMD128-NEXT: i16x8.extract_lane_u $push0=, $0, 0
844 ; SIMD128-NEXT: return $pop0
846 ; NO-SIMD128-LABEL: extract_undef_v8i16:
847 ; NO-SIMD128: .functype extract_undef_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)
848 ; NO-SIMD128-NEXT: # %bb.0:
849 ; NO-SIMD128-NEXT: return $0
850 %elem = extractelement <8 x i16> %v, i16 undef
854 define <8 x i16> @replace_v8i16(<8 x i16> %v, i16 %x) {
855 ; SIMD128-LABEL: replace_v8i16:
856 ; SIMD128: .functype replace_v8i16 (v128, i32) -> (v128)
857 ; SIMD128-NEXT: # %bb.0:
858 ; SIMD128-NEXT: i16x8.replace_lane $push0=, $0, 7, $1
859 ; SIMD128-NEXT: return $pop0
861 ; NO-SIMD128-LABEL: replace_v8i16:
862 ; NO-SIMD128: .functype replace_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
863 ; NO-SIMD128-NEXT: # %bb.0:
864 ; NO-SIMD128-NEXT: i32.store16 14($0), $9
865 ; NO-SIMD128-NEXT: i32.store16 12($0), $7
866 ; NO-SIMD128-NEXT: i32.store16 10($0), $6
867 ; NO-SIMD128-NEXT: i32.store16 8($0), $5
868 ; NO-SIMD128-NEXT: i32.store16 6($0), $4
869 ; NO-SIMD128-NEXT: i32.store16 4($0), $3
870 ; NO-SIMD128-NEXT: i32.store16 2($0), $2
871 ; NO-SIMD128-NEXT: i32.store16 0($0), $1
872 ; NO-SIMD128-NEXT: return
873 %res = insertelement <8 x i16> %v, i16 %x, i32 7
877 define <8 x i16> @replace_var_v8i16(<8 x i16> %v, i32 %i, i16 %x) {
878 ; SIMD128-LABEL: replace_var_v8i16:
879 ; SIMD128: .functype replace_var_v8i16 (v128, i32, i32) -> (v128)
880 ; SIMD128-NEXT: # %bb.0:
881 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
882 ; SIMD128-NEXT: i32.const $push7=, 16
883 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
884 ; SIMD128-NEXT: local.tee $push8=, $3=, $pop9
885 ; SIMD128-NEXT: v128.store 0($pop8), $0
886 ; SIMD128-NEXT: i32.const $push0=, 7
887 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
888 ; SIMD128-NEXT: i32.const $push2=, 1
889 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
890 ; SIMD128-NEXT: i32.or $push4=, $3, $pop3
891 ; SIMD128-NEXT: i32.store16 0($pop4), $2
892 ; SIMD128-NEXT: v128.load $push5=, 0($3)
893 ; SIMD128-NEXT: return $pop5
895 ; NO-SIMD128-LABEL: replace_var_v8i16:
896 ; NO-SIMD128: .functype replace_var_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
897 ; NO-SIMD128-NEXT: # %bb.0:
898 ; NO-SIMD128-NEXT: global.get $push7=, __stack_pointer
899 ; NO-SIMD128-NEXT: i32.const $push8=, 16
900 ; NO-SIMD128-NEXT: i32.sub $push10=, $pop7, $pop8
901 ; NO-SIMD128-NEXT: local.tee $push9=, $11=, $pop10
902 ; NO-SIMD128-NEXT: i32.store16 14($pop9), $8
903 ; NO-SIMD128-NEXT: i32.store16 12($11), $7
904 ; NO-SIMD128-NEXT: i32.store16 10($11), $6
905 ; NO-SIMD128-NEXT: i32.store16 8($11), $5
906 ; NO-SIMD128-NEXT: i32.store16 6($11), $4
907 ; NO-SIMD128-NEXT: i32.store16 4($11), $3
908 ; NO-SIMD128-NEXT: i32.store16 2($11), $2
909 ; NO-SIMD128-NEXT: i32.store16 0($11), $1
910 ; NO-SIMD128-NEXT: i32.const $push0=, 7
911 ; NO-SIMD128-NEXT: i32.and $push1=, $9, $pop0
912 ; NO-SIMD128-NEXT: i32.const $push2=, 1
913 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
914 ; NO-SIMD128-NEXT: i32.or $push4=, $11, $pop3
915 ; NO-SIMD128-NEXT: i32.store16 0($pop4), $10
916 ; NO-SIMD128-NEXT: i64.load $push5=, 8($11)
917 ; NO-SIMD128-NEXT: i64.store 8($0), $pop5
918 ; NO-SIMD128-NEXT: i64.load $push6=, 0($11)
919 ; NO-SIMD128-NEXT: i64.store 0($0), $pop6
920 ; NO-SIMD128-NEXT: return
921 %res = insertelement <8 x i16> %v, i16 %x, i32 %i
925 define <8 x i16> @replace_zero_v8i16(<8 x i16> %v, i16 %x) {
926 ; SIMD128-LABEL: replace_zero_v8i16:
927 ; SIMD128: .functype replace_zero_v8i16 (v128, i32) -> (v128)
928 ; SIMD128-NEXT: # %bb.0:
929 ; SIMD128-NEXT: i16x8.replace_lane $push0=, $0, 0, $1
930 ; SIMD128-NEXT: return $pop0
932 ; NO-SIMD128-LABEL: replace_zero_v8i16:
933 ; NO-SIMD128: .functype replace_zero_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
934 ; NO-SIMD128-NEXT: # %bb.0:
935 ; NO-SIMD128-NEXT: i32.store16 14($0), $8
936 ; NO-SIMD128-NEXT: i32.store16 12($0), $7
937 ; NO-SIMD128-NEXT: i32.store16 10($0), $6
938 ; NO-SIMD128-NEXT: i32.store16 8($0), $5
939 ; NO-SIMD128-NEXT: i32.store16 6($0), $4
940 ; NO-SIMD128-NEXT: i32.store16 4($0), $3
941 ; NO-SIMD128-NEXT: i32.store16 2($0), $2
942 ; NO-SIMD128-NEXT: i32.store16 0($0), $9
943 ; NO-SIMD128-NEXT: return
944 %res = insertelement <8 x i16> %v, i16 %x, i32 0
948 define <8 x i16> @shuffle_v8i16(<8 x i16> %x, <8 x i16> %y) {
949 ; SIMD128-LABEL: shuffle_v8i16:
950 ; SIMD128: .functype shuffle_v8i16 (v128, v128) -> (v128)
951 ; SIMD128-NEXT: # %bb.0:
952 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 1, 18, 19, 4, 5, 22, 23, 8, 9, 26, 27, 12, 13, 30, 31
953 ; SIMD128-NEXT: return $pop0
955 ; NO-SIMD128-LABEL: shuffle_v8i16:
956 ; NO-SIMD128: .functype shuffle_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
957 ; NO-SIMD128-NEXT: # %bb.0:
958 ; NO-SIMD128-NEXT: i32.store16 14($0), $16
959 ; NO-SIMD128-NEXT: i32.store16 12($0), $7
960 ; NO-SIMD128-NEXT: i32.store16 10($0), $14
961 ; NO-SIMD128-NEXT: i32.store16 8($0), $5
962 ; NO-SIMD128-NEXT: i32.store16 6($0), $12
963 ; NO-SIMD128-NEXT: i32.store16 4($0), $3
964 ; NO-SIMD128-NEXT: i32.store16 2($0), $10
965 ; NO-SIMD128-NEXT: i32.store16 0($0), $1
966 ; NO-SIMD128-NEXT: return
967 %res = shufflevector <8 x i16> %x, <8 x i16> %y,
968 <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 15>
972 define <8 x i16> @shuffle_undef_v8i16(<8 x i16> %x, <8 x i16> %y) {
973 ; SIMD128-LABEL: shuffle_undef_v8i16:
974 ; SIMD128: .functype shuffle_undef_v8i16 (v128, v128) -> (v128)
975 ; SIMD128-NEXT: # %bb.0:
976 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 2, 3, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
977 ; SIMD128-NEXT: return $pop0
979 ; NO-SIMD128-LABEL: shuffle_undef_v8i16:
980 ; NO-SIMD128: .functype shuffle_undef_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
981 ; NO-SIMD128-NEXT: # %bb.0:
982 ; NO-SIMD128-NEXT: i32.store16 0($0), $2
983 ; NO-SIMD128-NEXT: return
984 %res = shufflevector <8 x i16> %x, <8 x i16> %y,
985 <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef,
986 i32 undef, i32 undef, i32 undef, i32 undef>
990 define <8 x i16> @build_v8i16(i16 %x0, i16 %x1, i16 %x2, i16 %x3,
991 ; SIMD128-LABEL: build_v8i16:
992 ; SIMD128: .functype build_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32) -> (v128)
993 ; SIMD128-NEXT: # %bb.0:
994 ; SIMD128-NEXT: i16x8.splat $push0=, $0
995 ; SIMD128-NEXT: i16x8.replace_lane $push1=, $pop0, 1, $1
996 ; SIMD128-NEXT: i16x8.replace_lane $push2=, $pop1, 2, $2
997 ; SIMD128-NEXT: i16x8.replace_lane $push3=, $pop2, 3, $3
998 ; SIMD128-NEXT: i16x8.replace_lane $push4=, $pop3, 4, $4
999 ; SIMD128-NEXT: i16x8.replace_lane $push5=, $pop4, 5, $5
1000 ; SIMD128-NEXT: i16x8.replace_lane $push6=, $pop5, 6, $6
1001 ; SIMD128-NEXT: i16x8.replace_lane $push7=, $pop6, 7, $7
1002 ; SIMD128-NEXT: return $pop7
1004 ; NO-SIMD128-LABEL: build_v8i16:
1005 ; NO-SIMD128: .functype build_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
1006 ; NO-SIMD128-NEXT: # %bb.0:
1007 ; NO-SIMD128-NEXT: i32.store16 14($0), $8
1008 ; NO-SIMD128-NEXT: i32.store16 12($0), $7
1009 ; NO-SIMD128-NEXT: i32.store16 10($0), $6
1010 ; NO-SIMD128-NEXT: i32.store16 8($0), $5
1011 ; NO-SIMD128-NEXT: i32.store16 6($0), $4
1012 ; NO-SIMD128-NEXT: i32.store16 4($0), $3
1013 ; NO-SIMD128-NEXT: i32.store16 2($0), $2
1014 ; NO-SIMD128-NEXT: i32.store16 0($0), $1
1015 ; NO-SIMD128-NEXT: return
1016 i16 %x4, i16 %x5, i16 %x6, i16 %x7) {
1017 %t0 = insertelement <8 x i16> undef, i16 %x0, i32 0
1018 %t1 = insertelement <8 x i16> %t0, i16 %x1, i32 1
1019 %t2 = insertelement <8 x i16> %t1, i16 %x2, i32 2
1020 %t3 = insertelement <8 x i16> %t2, i16 %x3, i32 3
1021 %t4 = insertelement <8 x i16> %t3, i16 %x4, i32 4
1022 %t5 = insertelement <8 x i16> %t4, i16 %x5, i32 5
1023 %t6 = insertelement <8 x i16> %t5, i16 %x6, i32 6
1024 %res = insertelement <8 x i16> %t6, i16 %x7, i32 7
1028 ; ==============================================================================
1030 ; ==============================================================================
1031 define <4 x i32> @const_v4i32() {
1032 ; SIMD128-LABEL: const_v4i32:
1033 ; SIMD128: .functype const_v4i32 () -> (v128)
1034 ; SIMD128-NEXT: # %bb.0:
1035 ; SIMD128-NEXT: v128.const $push0=, 50462976, 117835012, 185207048, 252579084
1036 ; SIMD128-NEXT: return $pop0
1038 ; NO-SIMD128-LABEL: const_v4i32:
1039 ; NO-SIMD128: .functype const_v4i32 (i32) -> ()
1040 ; NO-SIMD128-NEXT: # %bb.0:
1041 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
1042 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1043 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
1044 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1045 ; NO-SIMD128-NEXT: return
1046 ret <4 x i32> <i32 50462976, i32 117835012, i32 185207048, i32 252579084>
1049 define <4 x i32> @splat_v4i32(i32 %x) {
1050 ; SIMD128-LABEL: splat_v4i32:
1051 ; SIMD128: .functype splat_v4i32 (i32) -> (v128)
1052 ; SIMD128-NEXT: # %bb.0:
1053 ; SIMD128-NEXT: i32x4.splat $push0=, $0
1054 ; SIMD128-NEXT: return $pop0
1056 ; NO-SIMD128-LABEL: splat_v4i32:
1057 ; NO-SIMD128: .functype splat_v4i32 (i32, i32) -> ()
1058 ; NO-SIMD128-NEXT: # %bb.0:
1059 ; NO-SIMD128-NEXT: i32.store 12($0), $1
1060 ; NO-SIMD128-NEXT: i32.store 8($0), $1
1061 ; NO-SIMD128-NEXT: i32.store 4($0), $1
1062 ; NO-SIMD128-NEXT: i32.store 0($0), $1
1063 ; NO-SIMD128-NEXT: return
1064 %v = insertelement <4 x i32> undef, i32 %x, i32 0
1065 %res = shufflevector <4 x i32> %v, <4 x i32> undef,
1066 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1070 define <4 x i32> @const_splat_v4i32() {
1071 ; SIMD128-LABEL: const_splat_v4i32:
1072 ; SIMD128: .functype const_splat_v4i32 () -> (v128)
1073 ; SIMD128-NEXT: # %bb.0:
1074 ; SIMD128-NEXT: v128.const $push0=, 42, 42, 42, 42
1075 ; SIMD128-NEXT: return $pop0
1077 ; NO-SIMD128-LABEL: const_splat_v4i32:
1078 ; NO-SIMD128: .functype const_splat_v4i32 (i32) -> ()
1079 ; NO-SIMD128-NEXT: # %bb.0:
1080 ; NO-SIMD128-NEXT: i64.const $push0=, 180388626474
1081 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1082 ; NO-SIMD128-NEXT: i64.const $push1=, 180388626474
1083 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1084 ; NO-SIMD128-NEXT: return
1085 ret <4 x i32> <i32 42, i32 42, i32 42, i32 42>
1088 define i32 @extract_v4i32(<4 x i32> %v) {
1089 ; SIMD128-LABEL: extract_v4i32:
1090 ; SIMD128: .functype extract_v4i32 (v128) -> (i32)
1091 ; SIMD128-NEXT: # %bb.0:
1092 ; SIMD128-NEXT: i32x4.extract_lane $push0=, $0, 3
1093 ; SIMD128-NEXT: return $pop0
1095 ; NO-SIMD128-LABEL: extract_v4i32:
1096 ; NO-SIMD128: .functype extract_v4i32 (i32, i32, i32, i32) -> (i32)
1097 ; NO-SIMD128-NEXT: # %bb.0:
1098 ; NO-SIMD128-NEXT: return $3
1099 %elem = extractelement <4 x i32> %v, i32 3
1103 define i32 @extract_var_v4i32(<4 x i32> %v, i32 %i) {
1104 ; SIMD128-LABEL: extract_var_v4i32:
1105 ; SIMD128: .functype extract_var_v4i32 (v128, i32) -> (i32)
1106 ; SIMD128-NEXT: # %bb.0:
1107 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1108 ; SIMD128-NEXT: i32.const $push7=, 16
1109 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1110 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
1111 ; SIMD128-NEXT: v128.store 0($pop8), $0
1112 ; SIMD128-NEXT: i32.const $push0=, 3
1113 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1114 ; SIMD128-NEXT: i32.const $push2=, 2
1115 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1116 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
1117 ; SIMD128-NEXT: i32.load $push5=, 0($pop4)
1118 ; SIMD128-NEXT: return $pop5
1120 ; NO-SIMD128-LABEL: extract_var_v4i32:
1121 ; NO-SIMD128: .functype extract_var_v4i32 (i32, i32, i32, i32, i32) -> (i32)
1122 ; NO-SIMD128-NEXT: # %bb.0:
1123 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
1124 ; NO-SIMD128-NEXT: i32.const $push7=, 16
1125 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1126 ; NO-SIMD128-NEXT: local.tee $push8=, $5=, $pop9
1127 ; NO-SIMD128-NEXT: i32.store 12($pop8), $3
1128 ; NO-SIMD128-NEXT: i32.store 8($5), $2
1129 ; NO-SIMD128-NEXT: i32.store 4($5), $1
1130 ; NO-SIMD128-NEXT: i32.store 0($5), $0
1131 ; NO-SIMD128-NEXT: i32.const $push0=, 3
1132 ; NO-SIMD128-NEXT: i32.and $push1=, $4, $pop0
1133 ; NO-SIMD128-NEXT: i32.const $push2=, 2
1134 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1135 ; NO-SIMD128-NEXT: i32.or $push4=, $5, $pop3
1136 ; NO-SIMD128-NEXT: i32.load $push5=, 0($pop4)
1137 ; NO-SIMD128-NEXT: return $pop5
1138 %elem = extractelement <4 x i32> %v, i32 %i
1142 define i32 @extract_zero_v4i32(<4 x i32> %v) {
1143 ; SIMD128-LABEL: extract_zero_v4i32:
1144 ; SIMD128: .functype extract_zero_v4i32 (v128) -> (i32)
1145 ; SIMD128-NEXT: # %bb.0:
1146 ; SIMD128-NEXT: i32x4.extract_lane $push0=, $0, 0
1147 ; SIMD128-NEXT: return $pop0
1149 ; NO-SIMD128-LABEL: extract_zero_v4i32:
1150 ; NO-SIMD128: .functype extract_zero_v4i32 (i32, i32, i32, i32) -> (i32)
1151 ; NO-SIMD128-NEXT: # %bb.0:
1152 ; NO-SIMD128-NEXT: return $0
1153 %elem = extractelement <4 x i32> %v, i32 0
1157 define <4 x i32> @replace_v4i32(<4 x i32> %v, i32 %x) {
1158 ; SIMD128-LABEL: replace_v4i32:
1159 ; SIMD128: .functype replace_v4i32 (v128, i32) -> (v128)
1160 ; SIMD128-NEXT: # %bb.0:
1161 ; SIMD128-NEXT: i32x4.replace_lane $push0=, $0, 2, $1
1162 ; SIMD128-NEXT: return $pop0
1164 ; NO-SIMD128-LABEL: replace_v4i32:
1165 ; NO-SIMD128: .functype replace_v4i32 (i32, i32, i32, i32, i32, i32) -> ()
1166 ; NO-SIMD128-NEXT: # %bb.0:
1167 ; NO-SIMD128-NEXT: i32.store 12($0), $4
1168 ; NO-SIMD128-NEXT: i32.store 8($0), $5
1169 ; NO-SIMD128-NEXT: i32.store 4($0), $2
1170 ; NO-SIMD128-NEXT: i32.store 0($0), $1
1171 ; NO-SIMD128-NEXT: return
1172 %res = insertelement <4 x i32> %v, i32 %x, i32 2
1176 define <4 x i32> @replace_var_v4i32(<4 x i32> %v, i32 %i, i32 %x) {
1177 ; SIMD128-LABEL: replace_var_v4i32:
1178 ; SIMD128: .functype replace_var_v4i32 (v128, i32, i32) -> (v128)
1179 ; SIMD128-NEXT: # %bb.0:
1180 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1181 ; SIMD128-NEXT: i32.const $push7=, 16
1182 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1183 ; SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1184 ; SIMD128-NEXT: v128.store 0($pop8), $0
1185 ; SIMD128-NEXT: i32.const $push0=, 3
1186 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1187 ; SIMD128-NEXT: i32.const $push2=, 2
1188 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1189 ; SIMD128-NEXT: i32.or $push4=, $3, $pop3
1190 ; SIMD128-NEXT: i32.store 0($pop4), $2
1191 ; SIMD128-NEXT: v128.load $push5=, 0($3)
1192 ; SIMD128-NEXT: return $pop5
1194 ; NO-SIMD128-LABEL: replace_var_v4i32:
1195 ; NO-SIMD128: .functype replace_var_v4i32 (i32, i32, i32, i32, i32, i32, i32) -> ()
1196 ; NO-SIMD128-NEXT: # %bb.0:
1197 ; NO-SIMD128-NEXT: global.get $push7=, __stack_pointer
1198 ; NO-SIMD128-NEXT: i32.const $push8=, 16
1199 ; NO-SIMD128-NEXT: i32.sub $push10=, $pop7, $pop8
1200 ; NO-SIMD128-NEXT: local.tee $push9=, $7=, $pop10
1201 ; NO-SIMD128-NEXT: i32.store 12($pop9), $4
1202 ; NO-SIMD128-NEXT: i32.store 8($7), $3
1203 ; NO-SIMD128-NEXT: i32.store 4($7), $2
1204 ; NO-SIMD128-NEXT: i32.store 0($7), $1
1205 ; NO-SIMD128-NEXT: i32.const $push0=, 3
1206 ; NO-SIMD128-NEXT: i32.and $push1=, $5, $pop0
1207 ; NO-SIMD128-NEXT: i32.const $push2=, 2
1208 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1209 ; NO-SIMD128-NEXT: i32.or $push4=, $7, $pop3
1210 ; NO-SIMD128-NEXT: i32.store 0($pop4), $6
1211 ; NO-SIMD128-NEXT: i64.load $push5=, 8($7)
1212 ; NO-SIMD128-NEXT: i64.store 8($0), $pop5
1213 ; NO-SIMD128-NEXT: i64.load $push6=, 0($7)
1214 ; NO-SIMD128-NEXT: i64.store 0($0), $pop6
1215 ; NO-SIMD128-NEXT: return
1216 %res = insertelement <4 x i32> %v, i32 %x, i32 %i
1220 define <4 x i32> @replace_zero_v4i32(<4 x i32> %v, i32 %x) {
1221 ; SIMD128-LABEL: replace_zero_v4i32:
1222 ; SIMD128: .functype replace_zero_v4i32 (v128, i32) -> (v128)
1223 ; SIMD128-NEXT: # %bb.0:
1224 ; SIMD128-NEXT: i32x4.replace_lane $push0=, $0, 0, $1
1225 ; SIMD128-NEXT: return $pop0
1227 ; NO-SIMD128-LABEL: replace_zero_v4i32:
1228 ; NO-SIMD128: .functype replace_zero_v4i32 (i32, i32, i32, i32, i32, i32) -> ()
1229 ; NO-SIMD128-NEXT: # %bb.0:
1230 ; NO-SIMD128-NEXT: i32.store 12($0), $4
1231 ; NO-SIMD128-NEXT: i32.store 8($0), $3
1232 ; NO-SIMD128-NEXT: i32.store 4($0), $2
1233 ; NO-SIMD128-NEXT: i32.store 0($0), $5
1234 ; NO-SIMD128-NEXT: return
1235 %res = insertelement <4 x i32> %v, i32 %x, i32 0
1239 define <4 x i32> @shuffle_v4i32(<4 x i32> %x, <4 x i32> %y) {
1240 ; SIMD128-LABEL: shuffle_v4i32:
1241 ; SIMD128: .functype shuffle_v4i32 (v128, v128) -> (v128)
1242 ; SIMD128-NEXT: # %bb.0:
1243 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31
1244 ; SIMD128-NEXT: return $pop0
1246 ; NO-SIMD128-LABEL: shuffle_v4i32:
1247 ; NO-SIMD128: .functype shuffle_v4i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
1248 ; NO-SIMD128-NEXT: # %bb.0:
1249 ; NO-SIMD128-NEXT: i32.store 12($0), $8
1250 ; NO-SIMD128-NEXT: i32.store 8($0), $3
1251 ; NO-SIMD128-NEXT: i32.store 4($0), $6
1252 ; NO-SIMD128-NEXT: i32.store 0($0), $1
1253 ; NO-SIMD128-NEXT: return
1254 %res = shufflevector <4 x i32> %x, <4 x i32> %y,
1255 <4 x i32> <i32 0, i32 5, i32 2, i32 7>
1259 define <4 x i32> @shuffle_undef_v4i32(<4 x i32> %x, <4 x i32> %y) {
1260 ; SIMD128-LABEL: shuffle_undef_v4i32:
1261 ; SIMD128: .functype shuffle_undef_v4i32 (v128, v128) -> (v128)
1262 ; SIMD128-NEXT: # %bb.0:
1263 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3
1264 ; SIMD128-NEXT: return $pop0
1266 ; NO-SIMD128-LABEL: shuffle_undef_v4i32:
1267 ; NO-SIMD128: .functype shuffle_undef_v4i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32) -> ()
1268 ; NO-SIMD128-NEXT: # %bb.0:
1269 ; NO-SIMD128-NEXT: i32.store 0($0), $2
1270 ; NO-SIMD128-NEXT: return
1271 %res = shufflevector <4 x i32> %x, <4 x i32> %y,
1272 <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
1276 define <4 x i32> @build_v4i32(i32 %x0, i32 %x1, i32 %x2, i32 %x3) {
1277 ; SIMD128-LABEL: build_v4i32:
1278 ; SIMD128: .functype build_v4i32 (i32, i32, i32, i32) -> (v128)
1279 ; SIMD128-NEXT: # %bb.0:
1280 ; SIMD128-NEXT: i32x4.splat $push0=, $0
1281 ; SIMD128-NEXT: i32x4.replace_lane $push1=, $pop0, 1, $1
1282 ; SIMD128-NEXT: i32x4.replace_lane $push2=, $pop1, 2, $2
1283 ; SIMD128-NEXT: i32x4.replace_lane $push3=, $pop2, 3, $3
1284 ; SIMD128-NEXT: return $pop3
1286 ; NO-SIMD128-LABEL: build_v4i32:
1287 ; NO-SIMD128: .functype build_v4i32 (i32, i32, i32, i32, i32) -> ()
1288 ; NO-SIMD128-NEXT: # %bb.0:
1289 ; NO-SIMD128-NEXT: i32.store 12($0), $4
1290 ; NO-SIMD128-NEXT: i32.store 8($0), $3
1291 ; NO-SIMD128-NEXT: i32.store 4($0), $2
1292 ; NO-SIMD128-NEXT: i32.store 0($0), $1
1293 ; NO-SIMD128-NEXT: return
1294 %t0 = insertelement <4 x i32> undef, i32 %x0, i32 0
1295 %t1 = insertelement <4 x i32> %t0, i32 %x1, i32 1
1296 %t2 = insertelement <4 x i32> %t1, i32 %x2, i32 2
1297 %res = insertelement <4 x i32> %t2, i32 %x3, i32 3
1301 ; ==============================================================================
1303 ; ==============================================================================
1304 define <2 x i64> @const_v2i64() {
1305 ; SIMD128-LABEL: const_v2i64:
1306 ; SIMD128: .functype const_v2i64 () -> (v128)
1307 ; SIMD128-NEXT: # %bb.0:
1308 ; SIMD128-NEXT: v128.const $push0=, 506097522914230528, 1084818905618843912
1309 ; SIMD128-NEXT: return $pop0
1311 ; NO-SIMD128-LABEL: const_v2i64:
1312 ; NO-SIMD128: .functype const_v2i64 (i32) -> ()
1313 ; NO-SIMD128-NEXT: # %bb.0:
1314 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
1315 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1316 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
1317 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1318 ; NO-SIMD128-NEXT: return
1319 ret <2 x i64> <i64 506097522914230528, i64 1084818905618843912>
1322 define <2 x i64> @splat_v2i64(i64 %x) {
1323 ; SIMD128-LABEL: splat_v2i64:
1324 ; SIMD128: .functype splat_v2i64 (i64) -> (v128)
1325 ; SIMD128-NEXT: # %bb.0:
1326 ; SIMD128-NEXT: i64x2.splat $push0=, $0
1327 ; SIMD128-NEXT: return $pop0
1329 ; NO-SIMD128-LABEL: splat_v2i64:
1330 ; NO-SIMD128: .functype splat_v2i64 (i32, i64) -> ()
1331 ; NO-SIMD128-NEXT: # %bb.0:
1332 ; NO-SIMD128-NEXT: i64.store 8($0), $1
1333 ; NO-SIMD128-NEXT: i64.store 0($0), $1
1334 ; NO-SIMD128-NEXT: return
1335 %t1 = insertelement <2 x i64> zeroinitializer, i64 %x, i32 0
1336 %res = insertelement <2 x i64> %t1, i64 %x, i32 1
1340 define <2 x i64> @const_splat_v2i64() {
1341 ; SIMD128-LABEL: const_splat_v2i64:
1342 ; SIMD128: .functype const_splat_v2i64 () -> (v128)
1343 ; SIMD128-NEXT: # %bb.0:
1344 ; SIMD128-NEXT: v128.const $push0=, 42, 42
1345 ; SIMD128-NEXT: return $pop0
1347 ; NO-SIMD128-LABEL: const_splat_v2i64:
1348 ; NO-SIMD128: .functype const_splat_v2i64 (i32) -> ()
1349 ; NO-SIMD128-NEXT: # %bb.0:
1350 ; NO-SIMD128-NEXT: i64.const $push0=, 42
1351 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1352 ; NO-SIMD128-NEXT: i64.const $push1=, 42
1353 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1354 ; NO-SIMD128-NEXT: return
1355 ret <2 x i64> <i64 42, i64 42>
1358 define i64 @extract_v2i64(<2 x i64> %v) {
1359 ; SIMD128-LABEL: extract_v2i64:
1360 ; SIMD128: .functype extract_v2i64 (v128) -> (i64)
1361 ; SIMD128-NEXT: # %bb.0:
1362 ; SIMD128-NEXT: i64x2.extract_lane $push0=, $0, 1
1363 ; SIMD128-NEXT: return $pop0
1365 ; NO-SIMD128-LABEL: extract_v2i64:
1366 ; NO-SIMD128: .functype extract_v2i64 (i64, i64) -> (i64)
1367 ; NO-SIMD128-NEXT: # %bb.0:
1368 ; NO-SIMD128-NEXT: return $1
1369 %elem = extractelement <2 x i64> %v, i64 1
1373 define i64 @extract_var_v2i64(<2 x i64> %v, i32 %i) {
1374 ; SIMD128-LABEL: extract_var_v2i64:
1375 ; SIMD128: .functype extract_var_v2i64 (v128, i32) -> (i64)
1376 ; SIMD128-NEXT: # %bb.0:
1377 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1378 ; SIMD128-NEXT: i32.const $push7=, 16
1379 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1380 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
1381 ; SIMD128-NEXT: v128.store 0($pop8), $0
1382 ; SIMD128-NEXT: i32.const $push0=, 1
1383 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1384 ; SIMD128-NEXT: i32.const $push2=, 3
1385 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1386 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
1387 ; SIMD128-NEXT: i64.load $push5=, 0($pop4)
1388 ; SIMD128-NEXT: return $pop5
1390 ; NO-SIMD128-LABEL: extract_var_v2i64:
1391 ; NO-SIMD128: .functype extract_var_v2i64 (i64, i64, i32) -> (i64)
1392 ; NO-SIMD128-NEXT: # %bb.0:
1393 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
1394 ; NO-SIMD128-NEXT: i32.const $push7=, 16
1395 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1396 ; NO-SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1397 ; NO-SIMD128-NEXT: i64.store 8($pop8), $1
1398 ; NO-SIMD128-NEXT: i64.store 0($3), $0
1399 ; NO-SIMD128-NEXT: i32.const $push0=, 1
1400 ; NO-SIMD128-NEXT: i32.and $push1=, $2, $pop0
1401 ; NO-SIMD128-NEXT: i32.const $push2=, 3
1402 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1403 ; NO-SIMD128-NEXT: i32.or $push4=, $3, $pop3
1404 ; NO-SIMD128-NEXT: i64.load $push5=, 0($pop4)
1405 ; NO-SIMD128-NEXT: return $pop5
1406 %elem = extractelement <2 x i64> %v, i32 %i
1410 define i64 @extract_zero_v2i64(<2 x i64> %v) {
1411 ; SIMD128-LABEL: extract_zero_v2i64:
1412 ; SIMD128: .functype extract_zero_v2i64 (v128) -> (i64)
1413 ; SIMD128-NEXT: # %bb.0:
1414 ; SIMD128-NEXT: i64x2.extract_lane $push0=, $0, 0
1415 ; SIMD128-NEXT: return $pop0
1417 ; NO-SIMD128-LABEL: extract_zero_v2i64:
1418 ; NO-SIMD128: .functype extract_zero_v2i64 (i64, i64) -> (i64)
1419 ; NO-SIMD128-NEXT: # %bb.0:
1420 ; NO-SIMD128-NEXT: return $0
1421 %elem = extractelement <2 x i64> %v, i64 0
1425 define <2 x i64> @replace_v2i64(<2 x i64> %v, i64 %x) {
1426 ; SIMD128-LABEL: replace_v2i64:
1427 ; SIMD128: .functype replace_v2i64 (v128, i64) -> (v128)
1428 ; SIMD128-NEXT: # %bb.0:
1429 ; SIMD128-NEXT: i64x2.replace_lane $push0=, $0, 0, $1
1430 ; SIMD128-NEXT: return $pop0
1432 ; NO-SIMD128-LABEL: replace_v2i64:
1433 ; NO-SIMD128: .functype replace_v2i64 (i32, i64, i64, i64) -> ()
1434 ; NO-SIMD128-NEXT: # %bb.0:
1435 ; NO-SIMD128-NEXT: i64.store 8($0), $2
1436 ; NO-SIMD128-NEXT: i64.store 0($0), $3
1437 ; NO-SIMD128-NEXT: return
1438 %res = insertelement <2 x i64> %v, i64 %x, i32 0
1442 define <2 x i64> @replace_var_v2i64(<2 x i64> %v, i32 %i, i64 %x) {
1443 ; SIMD128-LABEL: replace_var_v2i64:
1444 ; SIMD128: .functype replace_var_v2i64 (v128, i32, i64) -> (v128)
1445 ; SIMD128-NEXT: # %bb.0:
1446 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1447 ; SIMD128-NEXT: i32.const $push7=, 16
1448 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1449 ; SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1450 ; SIMD128-NEXT: v128.store 0($pop8), $0
1451 ; SIMD128-NEXT: i32.const $push0=, 1
1452 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1453 ; SIMD128-NEXT: i32.const $push2=, 3
1454 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1455 ; SIMD128-NEXT: i32.or $push4=, $3, $pop3
1456 ; SIMD128-NEXT: i64.store 0($pop4), $2
1457 ; SIMD128-NEXT: v128.load $push5=, 0($3)
1458 ; SIMD128-NEXT: return $pop5
1460 ; NO-SIMD128-LABEL: replace_var_v2i64:
1461 ; NO-SIMD128: .functype replace_var_v2i64 (i32, i64, i64, i32, i64) -> ()
1462 ; NO-SIMD128-NEXT: # %bb.0:
1463 ; NO-SIMD128-NEXT: global.get $push7=, __stack_pointer
1464 ; NO-SIMD128-NEXT: i32.const $push8=, 16
1465 ; NO-SIMD128-NEXT: i32.sub $push10=, $pop7, $pop8
1466 ; NO-SIMD128-NEXT: local.tee $push9=, $5=, $pop10
1467 ; NO-SIMD128-NEXT: i64.store 8($pop9), $2
1468 ; NO-SIMD128-NEXT: i64.store 0($5), $1
1469 ; NO-SIMD128-NEXT: i32.const $push0=, 1
1470 ; NO-SIMD128-NEXT: i32.and $push1=, $3, $pop0
1471 ; NO-SIMD128-NEXT: i32.const $push2=, 3
1472 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1473 ; NO-SIMD128-NEXT: i32.or $push4=, $5, $pop3
1474 ; NO-SIMD128-NEXT: i64.store 0($pop4), $4
1475 ; NO-SIMD128-NEXT: i64.load $push5=, 8($5)
1476 ; NO-SIMD128-NEXT: i64.store 8($0), $pop5
1477 ; NO-SIMD128-NEXT: i64.load $push6=, 0($5)
1478 ; NO-SIMD128-NEXT: i64.store 0($0), $pop6
1479 ; NO-SIMD128-NEXT: return
1480 %res = insertelement <2 x i64> %v, i64 %x, i32 %i
1484 define <2 x i64> @replace_zero_v2i64(<2 x i64> %v, i64 %x) {
1485 ; SIMD128-LABEL: replace_zero_v2i64:
1486 ; SIMD128: .functype replace_zero_v2i64 (v128, i64) -> (v128)
1487 ; SIMD128-NEXT: # %bb.0:
1488 ; SIMD128-NEXT: i64x2.replace_lane $push0=, $0, 0, $1
1489 ; SIMD128-NEXT: return $pop0
1491 ; NO-SIMD128-LABEL: replace_zero_v2i64:
1492 ; NO-SIMD128: .functype replace_zero_v2i64 (i32, i64, i64, i64) -> ()
1493 ; NO-SIMD128-NEXT: # %bb.0:
1494 ; NO-SIMD128-NEXT: i64.store 8($0), $2
1495 ; NO-SIMD128-NEXT: i64.store 0($0), $3
1496 ; NO-SIMD128-NEXT: return
1497 %res = insertelement <2 x i64> %v, i64 %x, i32 0
1501 define <2 x i64> @shuffle_v2i64(<2 x i64> %x, <2 x i64> %y) {
1502 ; SIMD128-LABEL: shuffle_v2i64:
1503 ; SIMD128: .functype shuffle_v2i64 (v128, v128) -> (v128)
1504 ; SIMD128-NEXT: # %bb.0:
1505 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31
1506 ; SIMD128-NEXT: return $pop0
1508 ; NO-SIMD128-LABEL: shuffle_v2i64:
1509 ; NO-SIMD128: .functype shuffle_v2i64 (i32, i64, i64, i64, i64) -> ()
1510 ; NO-SIMD128-NEXT: # %bb.0:
1511 ; NO-SIMD128-NEXT: i64.store 8($0), $4
1512 ; NO-SIMD128-NEXT: i64.store 0($0), $1
1513 ; NO-SIMD128-NEXT: return
1514 %res = shufflevector <2 x i64> %x, <2 x i64> %y, <2 x i32> <i32 0, i32 3>
1518 define <2 x i64> @shuffle_undef_v2i64(<2 x i64> %x, <2 x i64> %y) {
1519 ; SIMD128-LABEL: shuffle_undef_v2i64:
1520 ; SIMD128: .functype shuffle_undef_v2i64 (v128, v128) -> (v128)
1521 ; SIMD128-NEXT: # %bb.0:
1522 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7
1523 ; SIMD128-NEXT: return $pop0
1525 ; NO-SIMD128-LABEL: shuffle_undef_v2i64:
1526 ; NO-SIMD128: .functype shuffle_undef_v2i64 (i32, i64, i64, i64, i64) -> ()
1527 ; NO-SIMD128-NEXT: # %bb.0:
1528 ; NO-SIMD128-NEXT: i64.store 0($0), $2
1529 ; NO-SIMD128-NEXT: return
1530 %res = shufflevector <2 x i64> %x, <2 x i64> %y,
1531 <2 x i32> <i32 1, i32 undef>
1535 define <2 x i64> @build_v2i64(i64 %x0, i64 %x1) {
1536 ; SIMD128-LABEL: build_v2i64:
1537 ; SIMD128: .functype build_v2i64 (i64, i64) -> (v128)
1538 ; SIMD128-NEXT: # %bb.0:
1539 ; SIMD128-NEXT: i64x2.splat $push0=, $0
1540 ; SIMD128-NEXT: i64x2.replace_lane $push1=, $pop0, 1, $1
1541 ; SIMD128-NEXT: return $pop1
1543 ; NO-SIMD128-LABEL: build_v2i64:
1544 ; NO-SIMD128: .functype build_v2i64 (i32, i64, i64) -> ()
1545 ; NO-SIMD128-NEXT: # %bb.0:
1546 ; NO-SIMD128-NEXT: i64.store 8($0), $2
1547 ; NO-SIMD128-NEXT: i64.store 0($0), $1
1548 ; NO-SIMD128-NEXT: return
1549 %t0 = insertelement <2 x i64> undef, i64 %x0, i32 0
1550 %res = insertelement <2 x i64> %t0, i64 %x1, i32 1
1554 ; ==============================================================================
1556 ; ==============================================================================
1557 define <4 x float> @const_v4f32() {
1558 ; SIMD128-LABEL: const_v4f32:
1559 ; SIMD128: .functype const_v4f32 () -> (v128)
1560 ; SIMD128-NEXT: # %bb.0:
1561 ; SIMD128-NEXT: v128.const $push0=, 0x1.0402p-121, 0x1.0c0a08p-113, 0x1.14121p-105, 0x1.1c1a18p-97
1562 ; SIMD128-NEXT: return $pop0
1564 ; NO-SIMD128-LABEL: const_v4f32:
1565 ; NO-SIMD128: .functype const_v4f32 (i32) -> ()
1566 ; NO-SIMD128-NEXT: # %bb.0:
1567 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
1568 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1569 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
1570 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1571 ; NO-SIMD128-NEXT: return
1572 ret <4 x float> <float 0x3860402000000000, float 0x38e0c0a080000000,
1573 float 0x3961412100000000, float 0x39e1c1a180000000>
1576 define <4 x float> @splat_v4f32(float %x) {
1577 ; SIMD128-LABEL: splat_v4f32:
1578 ; SIMD128: .functype splat_v4f32 (f32) -> (v128)
1579 ; SIMD128-NEXT: # %bb.0:
1580 ; SIMD128-NEXT: f32x4.splat $push0=, $0
1581 ; SIMD128-NEXT: return $pop0
1583 ; NO-SIMD128-LABEL: splat_v4f32:
1584 ; NO-SIMD128: .functype splat_v4f32 (i32, f32) -> ()
1585 ; NO-SIMD128-NEXT: # %bb.0:
1586 ; NO-SIMD128-NEXT: f32.store 12($0), $1
1587 ; NO-SIMD128-NEXT: f32.store 8($0), $1
1588 ; NO-SIMD128-NEXT: f32.store 4($0), $1
1589 ; NO-SIMD128-NEXT: f32.store 0($0), $1
1590 ; NO-SIMD128-NEXT: return
1591 %v = insertelement <4 x float> undef, float %x, i32 0
1592 %res = shufflevector <4 x float> %v, <4 x float> undef,
1593 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1594 ret <4 x float> %res
1597 define <4 x float> @const_splat_v4f32() {
1598 ; SIMD128-LABEL: const_splat_v4f32:
1599 ; SIMD128: .functype const_splat_v4f32 () -> (v128)
1600 ; SIMD128-NEXT: # %bb.0:
1601 ; SIMD128-NEXT: v128.const $push0=, 0x1.5p5, 0x1.5p5, 0x1.5p5, 0x1.5p5
1602 ; SIMD128-NEXT: return $pop0
1604 ; NO-SIMD128-LABEL: const_splat_v4f32:
1605 ; NO-SIMD128: .functype const_splat_v4f32 (i32) -> ()
1606 ; NO-SIMD128-NEXT: # %bb.0:
1607 ; NO-SIMD128-NEXT: i64.const $push0=, 4767060206681587712
1608 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1609 ; NO-SIMD128-NEXT: i64.const $push1=, 4767060206681587712
1610 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1611 ; NO-SIMD128-NEXT: return
1612 ret <4 x float> <float 42., float 42., float 42., float 42.>
1615 define float @extract_v4f32(<4 x float> %v) {
1616 ; SIMD128-LABEL: extract_v4f32:
1617 ; SIMD128: .functype extract_v4f32 (v128) -> (f32)
1618 ; SIMD128-NEXT: # %bb.0:
1619 ; SIMD128-NEXT: f32x4.extract_lane $push0=, $0, 3
1620 ; SIMD128-NEXT: return $pop0
1622 ; NO-SIMD128-LABEL: extract_v4f32:
1623 ; NO-SIMD128: .functype extract_v4f32 (f32, f32, f32, f32) -> (f32)
1624 ; NO-SIMD128-NEXT: # %bb.0:
1625 ; NO-SIMD128-NEXT: return $3
1626 %elem = extractelement <4 x float> %v, i32 3
1630 define float @extract_var_v4f32(<4 x float> %v, i32 %i) {
1631 ; SIMD128-LABEL: extract_var_v4f32:
1632 ; SIMD128: .functype extract_var_v4f32 (v128, i32) -> (f32)
1633 ; SIMD128-NEXT: # %bb.0:
1634 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1635 ; SIMD128-NEXT: i32.const $push7=, 16
1636 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1637 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
1638 ; SIMD128-NEXT: v128.store 0($pop8), $0
1639 ; SIMD128-NEXT: i32.const $push0=, 3
1640 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1641 ; SIMD128-NEXT: i32.const $push2=, 2
1642 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1643 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
1644 ; SIMD128-NEXT: f32.load $push5=, 0($pop4)
1645 ; SIMD128-NEXT: return $pop5
1647 ; NO-SIMD128-LABEL: extract_var_v4f32:
1648 ; NO-SIMD128: .functype extract_var_v4f32 (f32, f32, f32, f32, i32) -> (f32)
1649 ; NO-SIMD128-NEXT: # %bb.0:
1650 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
1651 ; NO-SIMD128-NEXT: i32.const $push7=, 16
1652 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1653 ; NO-SIMD128-NEXT: local.tee $push8=, $5=, $pop9
1654 ; NO-SIMD128-NEXT: f32.store 12($pop8), $3
1655 ; NO-SIMD128-NEXT: f32.store 8($5), $2
1656 ; NO-SIMD128-NEXT: f32.store 4($5), $1
1657 ; NO-SIMD128-NEXT: f32.store 0($5), $0
1658 ; NO-SIMD128-NEXT: i32.const $push0=, 3
1659 ; NO-SIMD128-NEXT: i32.and $push1=, $4, $pop0
1660 ; NO-SIMD128-NEXT: i32.const $push2=, 2
1661 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1662 ; NO-SIMD128-NEXT: i32.or $push4=, $5, $pop3
1663 ; NO-SIMD128-NEXT: f32.load $push5=, 0($pop4)
1664 ; NO-SIMD128-NEXT: return $pop5
1665 %elem = extractelement <4 x float> %v, i32 %i
1669 define float @extract_zero_v4f32(<4 x float> %v) {
1670 ; SIMD128-LABEL: extract_zero_v4f32:
1671 ; SIMD128: .functype extract_zero_v4f32 (v128) -> (f32)
1672 ; SIMD128-NEXT: # %bb.0:
1673 ; SIMD128-NEXT: f32x4.extract_lane $push0=, $0, 0
1674 ; SIMD128-NEXT: return $pop0
1676 ; NO-SIMD128-LABEL: extract_zero_v4f32:
1677 ; NO-SIMD128: .functype extract_zero_v4f32 (f32, f32, f32, f32) -> (f32)
1678 ; NO-SIMD128-NEXT: # %bb.0:
1679 ; NO-SIMD128-NEXT: return $0
1680 %elem = extractelement <4 x float> %v, i32 0
1684 define <4 x float> @replace_v4f32(<4 x float> %v, float %x) {
1685 ; SIMD128-LABEL: replace_v4f32:
1686 ; SIMD128: .functype replace_v4f32 (v128, f32) -> (v128)
1687 ; SIMD128-NEXT: # %bb.0:
1688 ; SIMD128-NEXT: f32x4.replace_lane $push0=, $0, 2, $1
1689 ; SIMD128-NEXT: return $pop0
1691 ; NO-SIMD128-LABEL: replace_v4f32:
1692 ; NO-SIMD128: .functype replace_v4f32 (i32, f32, f32, f32, f32, f32) -> ()
1693 ; NO-SIMD128-NEXT: # %bb.0:
1694 ; NO-SIMD128-NEXT: f32.store 12($0), $4
1695 ; NO-SIMD128-NEXT: f32.store 8($0), $5
1696 ; NO-SIMD128-NEXT: f32.store 4($0), $2
1697 ; NO-SIMD128-NEXT: f32.store 0($0), $1
1698 ; NO-SIMD128-NEXT: return
1699 %res = insertelement <4 x float> %v, float %x, i32 2
1700 ret <4 x float> %res
1703 define <4 x float> @replace_var_v4f32(<4 x float> %v, i32 %i, float %x) {
1704 ; SIMD128-LABEL: replace_var_v4f32:
1705 ; SIMD128: .functype replace_var_v4f32 (v128, i32, f32) -> (v128)
1706 ; SIMD128-NEXT: # %bb.0:
1707 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1708 ; SIMD128-NEXT: i32.const $push7=, 16
1709 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1710 ; SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1711 ; SIMD128-NEXT: v128.store 0($pop8), $0
1712 ; SIMD128-NEXT: i32.const $push0=, 3
1713 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1714 ; SIMD128-NEXT: i32.const $push2=, 2
1715 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1716 ; SIMD128-NEXT: i32.or $push4=, $3, $pop3
1717 ; SIMD128-NEXT: f32.store 0($pop4), $2
1718 ; SIMD128-NEXT: v128.load $push5=, 0($3)
1719 ; SIMD128-NEXT: return $pop5
1721 ; NO-SIMD128-LABEL: replace_var_v4f32:
1722 ; NO-SIMD128: .functype replace_var_v4f32 (i32, f32, f32, f32, f32, i32, f32) -> ()
1723 ; NO-SIMD128-NEXT: # %bb.0:
1724 ; NO-SIMD128-NEXT: global.get $push7=, __stack_pointer
1725 ; NO-SIMD128-NEXT: i32.const $push8=, 16
1726 ; NO-SIMD128-NEXT: i32.sub $push10=, $pop7, $pop8
1727 ; NO-SIMD128-NEXT: local.tee $push9=, $7=, $pop10
1728 ; NO-SIMD128-NEXT: f32.store 12($pop9), $4
1729 ; NO-SIMD128-NEXT: f32.store 8($7), $3
1730 ; NO-SIMD128-NEXT: f32.store 4($7), $2
1731 ; NO-SIMD128-NEXT: f32.store 0($7), $1
1732 ; NO-SIMD128-NEXT: i32.const $push0=, 3
1733 ; NO-SIMD128-NEXT: i32.and $push1=, $5, $pop0
1734 ; NO-SIMD128-NEXT: i32.const $push2=, 2
1735 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1736 ; NO-SIMD128-NEXT: i32.or $push4=, $7, $pop3
1737 ; NO-SIMD128-NEXT: f32.store 0($pop4), $6
1738 ; NO-SIMD128-NEXT: i64.load $push5=, 8($7)
1739 ; NO-SIMD128-NEXT: i64.store 8($0), $pop5
1740 ; NO-SIMD128-NEXT: i64.load $push6=, 0($7)
1741 ; NO-SIMD128-NEXT: i64.store 0($0), $pop6
1742 ; NO-SIMD128-NEXT: return
1743 %res = insertelement <4 x float> %v, float %x, i32 %i
1744 ret <4 x float> %res
1747 define <4 x float> @replace_zero_v4f32(<4 x float> %v, float %x) {
1748 ; SIMD128-LABEL: replace_zero_v4f32:
1749 ; SIMD128: .functype replace_zero_v4f32 (v128, f32) -> (v128)
1750 ; SIMD128-NEXT: # %bb.0:
1751 ; SIMD128-NEXT: f32x4.replace_lane $push0=, $0, 0, $1
1752 ; SIMD128-NEXT: return $pop0
1754 ; NO-SIMD128-LABEL: replace_zero_v4f32:
1755 ; NO-SIMD128: .functype replace_zero_v4f32 (i32, f32, f32, f32, f32, f32) -> ()
1756 ; NO-SIMD128-NEXT: # %bb.0:
1757 ; NO-SIMD128-NEXT: f32.store 12($0), $4
1758 ; NO-SIMD128-NEXT: f32.store 8($0), $3
1759 ; NO-SIMD128-NEXT: f32.store 4($0), $2
1760 ; NO-SIMD128-NEXT: f32.store 0($0), $5
1761 ; NO-SIMD128-NEXT: return
1762 %res = insertelement <4 x float> %v, float %x, i32 0
1763 ret <4 x float> %res
1766 define <4 x float> @shuffle_v4f32(<4 x float> %x, <4 x float> %y) {
1767 ; SIMD128-LABEL: shuffle_v4f32:
1768 ; SIMD128: .functype shuffle_v4f32 (v128, v128) -> (v128)
1769 ; SIMD128-NEXT: # %bb.0:
1770 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31
1771 ; SIMD128-NEXT: return $pop0
1773 ; NO-SIMD128-LABEL: shuffle_v4f32:
1774 ; NO-SIMD128: .functype shuffle_v4f32 (i32, f32, f32, f32, f32, f32, f32, f32, f32) -> ()
1775 ; NO-SIMD128-NEXT: # %bb.0:
1776 ; NO-SIMD128-NEXT: f32.store 12($0), $8
1777 ; NO-SIMD128-NEXT: f32.store 8($0), $3
1778 ; NO-SIMD128-NEXT: f32.store 4($0), $6
1779 ; NO-SIMD128-NEXT: f32.store 0($0), $1
1780 ; NO-SIMD128-NEXT: return
1781 %res = shufflevector <4 x float> %x, <4 x float> %y,
1782 <4 x i32> <i32 0, i32 5, i32 2, i32 7>
1783 ret <4 x float> %res
1786 define <4 x float> @shuffle_undef_v4f32(<4 x float> %x, <4 x float> %y) {
1787 ; SIMD128-LABEL: shuffle_undef_v4f32:
1788 ; SIMD128: .functype shuffle_undef_v4f32 (v128, v128) -> (v128)
1789 ; SIMD128-NEXT: # %bb.0:
1790 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3
1791 ; SIMD128-NEXT: return $pop0
1793 ; NO-SIMD128-LABEL: shuffle_undef_v4f32:
1794 ; NO-SIMD128: .functype shuffle_undef_v4f32 (i32, f32, f32, f32, f32, f32, f32, f32, f32) -> ()
1795 ; NO-SIMD128-NEXT: # %bb.0:
1796 ; NO-SIMD128-NEXT: f32.store 0($0), $2
1797 ; NO-SIMD128-NEXT: return
1798 %res = shufflevector <4 x float> %x, <4 x float> %y,
1799 <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
1800 ret <4 x float> %res
1803 define <4 x float> @build_v4f32(float %x0, float %x1, float %x2, float %x3) {
1804 ; SIMD128-LABEL: build_v4f32:
1805 ; SIMD128: .functype build_v4f32 (f32, f32, f32, f32) -> (v128)
1806 ; SIMD128-NEXT: # %bb.0:
1807 ; SIMD128-NEXT: f32x4.splat $push0=, $0
1808 ; SIMD128-NEXT: f32x4.replace_lane $push1=, $pop0, 1, $1
1809 ; SIMD128-NEXT: f32x4.replace_lane $push2=, $pop1, 2, $2
1810 ; SIMD128-NEXT: f32x4.replace_lane $push3=, $pop2, 3, $3
1811 ; SIMD128-NEXT: return $pop3
1813 ; NO-SIMD128-LABEL: build_v4f32:
1814 ; NO-SIMD128: .functype build_v4f32 (i32, f32, f32, f32, f32) -> ()
1815 ; NO-SIMD128-NEXT: # %bb.0:
1816 ; NO-SIMD128-NEXT: f32.store 12($0), $4
1817 ; NO-SIMD128-NEXT: f32.store 8($0), $3
1818 ; NO-SIMD128-NEXT: f32.store 4($0), $2
1819 ; NO-SIMD128-NEXT: f32.store 0($0), $1
1820 ; NO-SIMD128-NEXT: return
1821 %t0 = insertelement <4 x float> undef, float %x0, i32 0
1822 %t1 = insertelement <4 x float> %t0, float %x1, i32 1
1823 %t2 = insertelement <4 x float> %t1, float %x2, i32 2
1824 %res = insertelement <4 x float> %t2, float %x3, i32 3
1825 ret <4 x float> %res
1828 ; ==============================================================================
1830 ; ==============================================================================
1831 define <2 x double> @const_v2f64() {
1832 ; SIMD128-LABEL: const_v2f64:
1833 ; SIMD128: .functype const_v2f64 () -> (v128)
1834 ; SIMD128-NEXT: # %bb.0:
1835 ; SIMD128-NEXT: v128.const $push0=, 0x1.60504030201p-911, 0x1.e0d0c0b0a0908p-783
1836 ; SIMD128-NEXT: return $pop0
1838 ; NO-SIMD128-LABEL: const_v2f64:
1839 ; NO-SIMD128: .functype const_v2f64 (i32) -> ()
1840 ; NO-SIMD128-NEXT: # %bb.0:
1841 ; NO-SIMD128-NEXT: i64.const $push0=, 1084818905618843912
1842 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1843 ; NO-SIMD128-NEXT: i64.const $push1=, 506097522914230528
1844 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1845 ; NO-SIMD128-NEXT: return
1846 ret <2 x double> <double 0x0706050403020100, double 0x0F0E0D0C0B0A0908>
1849 define <2 x double> @splat_v2f64(double %x) {
1850 ; SIMD128-LABEL: splat_v2f64:
1851 ; SIMD128: .functype splat_v2f64 (f64) -> (v128)
1852 ; SIMD128-NEXT: # %bb.0:
1853 ; SIMD128-NEXT: f64x2.splat $push0=, $0
1854 ; SIMD128-NEXT: return $pop0
1856 ; NO-SIMD128-LABEL: splat_v2f64:
1857 ; NO-SIMD128: .functype splat_v2f64 (i32, f64) -> ()
1858 ; NO-SIMD128-NEXT: # %bb.0:
1859 ; NO-SIMD128-NEXT: f64.store 8($0), $1
1860 ; NO-SIMD128-NEXT: f64.store 0($0), $1
1861 ; NO-SIMD128-NEXT: return
1862 %t1 = insertelement <2 x double> zeroinitializer, double %x, i3 0
1863 %res = insertelement <2 x double> %t1, double %x, i32 1
1864 ret <2 x double> %res
1867 define <2 x double> @const_splat_v2f64() {
1868 ; SIMD128-LABEL: const_splat_v2f64:
1869 ; SIMD128: .functype const_splat_v2f64 () -> (v128)
1870 ; SIMD128-NEXT: # %bb.0:
1871 ; SIMD128-NEXT: v128.const $push0=, 0x1.5p5, 0x1.5p5
1872 ; SIMD128-NEXT: return $pop0
1874 ; NO-SIMD128-LABEL: const_splat_v2f64:
1875 ; NO-SIMD128: .functype const_splat_v2f64 (i32) -> ()
1876 ; NO-SIMD128-NEXT: # %bb.0:
1877 ; NO-SIMD128-NEXT: i64.const $push0=, 4631107791820423168
1878 ; NO-SIMD128-NEXT: i64.store 8($0), $pop0
1879 ; NO-SIMD128-NEXT: i64.const $push1=, 4631107791820423168
1880 ; NO-SIMD128-NEXT: i64.store 0($0), $pop1
1881 ; NO-SIMD128-NEXT: return
1882 ret <2 x double> <double 42., double 42.>
1885 define double @extract_v2f64(<2 x double> %v) {
1886 ; SIMD128-LABEL: extract_v2f64:
1887 ; SIMD128: .functype extract_v2f64 (v128) -> (f64)
1888 ; SIMD128-NEXT: # %bb.0:
1889 ; SIMD128-NEXT: f64x2.extract_lane $push0=, $0, 1
1890 ; SIMD128-NEXT: return $pop0
1892 ; NO-SIMD128-LABEL: extract_v2f64:
1893 ; NO-SIMD128: .functype extract_v2f64 (f64, f64) -> (f64)
1894 ; NO-SIMD128-NEXT: # %bb.0:
1895 ; NO-SIMD128-NEXT: return $1
1896 %elem = extractelement <2 x double> %v, i32 1
1900 define double @extract_var_v2f64(<2 x double> %v, i32 %i) {
1901 ; SIMD128-LABEL: extract_var_v2f64:
1902 ; SIMD128: .functype extract_var_v2f64 (v128, i32) -> (f64)
1903 ; SIMD128-NEXT: # %bb.0:
1904 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1905 ; SIMD128-NEXT: i32.const $push7=, 16
1906 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1907 ; SIMD128-NEXT: local.tee $push8=, $2=, $pop9
1908 ; SIMD128-NEXT: v128.store 0($pop8), $0
1909 ; SIMD128-NEXT: i32.const $push0=, 1
1910 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1911 ; SIMD128-NEXT: i32.const $push2=, 3
1912 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1913 ; SIMD128-NEXT: i32.or $push4=, $2, $pop3
1914 ; SIMD128-NEXT: f64.load $push5=, 0($pop4)
1915 ; SIMD128-NEXT: return $pop5
1917 ; NO-SIMD128-LABEL: extract_var_v2f64:
1918 ; NO-SIMD128: .functype extract_var_v2f64 (f64, f64, i32) -> (f64)
1919 ; NO-SIMD128-NEXT: # %bb.0:
1920 ; NO-SIMD128-NEXT: global.get $push6=, __stack_pointer
1921 ; NO-SIMD128-NEXT: i32.const $push7=, 16
1922 ; NO-SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1923 ; NO-SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1924 ; NO-SIMD128-NEXT: f64.store 8($pop8), $1
1925 ; NO-SIMD128-NEXT: f64.store 0($3), $0
1926 ; NO-SIMD128-NEXT: i32.const $push0=, 1
1927 ; NO-SIMD128-NEXT: i32.and $push1=, $2, $pop0
1928 ; NO-SIMD128-NEXT: i32.const $push2=, 3
1929 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1930 ; NO-SIMD128-NEXT: i32.or $push4=, $3, $pop3
1931 ; NO-SIMD128-NEXT: f64.load $push5=, 0($pop4)
1932 ; NO-SIMD128-NEXT: return $pop5
1933 %elem = extractelement <2 x double> %v, i32 %i
1937 define double @extract_zero_v2f64(<2 x double> %v) {
1938 ; SIMD128-LABEL: extract_zero_v2f64:
1939 ; SIMD128: .functype extract_zero_v2f64 (v128) -> (f64)
1940 ; SIMD128-NEXT: # %bb.0:
1941 ; SIMD128-NEXT: f64x2.extract_lane $push0=, $0, 0
1942 ; SIMD128-NEXT: return $pop0
1944 ; NO-SIMD128-LABEL: extract_zero_v2f64:
1945 ; NO-SIMD128: .functype extract_zero_v2f64 (f64, f64) -> (f64)
1946 ; NO-SIMD128-NEXT: # %bb.0:
1947 ; NO-SIMD128-NEXT: return $0
1948 %elem = extractelement <2 x double> %v, i32 0
1952 define <2 x double> @replace_v2f64(<2 x double> %v, double %x) {
1953 ; SIMD128-LABEL: replace_v2f64:
1954 ; SIMD128: .functype replace_v2f64 (v128, f64) -> (v128)
1955 ; SIMD128-NEXT: # %bb.0:
1956 ; SIMD128-NEXT: f64x2.replace_lane $push0=, $0, 0, $1
1957 ; SIMD128-NEXT: return $pop0
1959 ; NO-SIMD128-LABEL: replace_v2f64:
1960 ; NO-SIMD128: .functype replace_v2f64 (i32, f64, f64, f64) -> ()
1961 ; NO-SIMD128-NEXT: # %bb.0:
1962 ; NO-SIMD128-NEXT: f64.store 8($0), $2
1963 ; NO-SIMD128-NEXT: f64.store 0($0), $3
1964 ; NO-SIMD128-NEXT: return
1965 %res = insertelement <2 x double> %v, double %x, i32 0
1966 ret <2 x double> %res
1969 define <2 x double> @replace_var_v2f64(<2 x double> %v, i32 %i, double %x) {
1970 ; SIMD128-LABEL: replace_var_v2f64:
1971 ; SIMD128: .functype replace_var_v2f64 (v128, i32, f64) -> (v128)
1972 ; SIMD128-NEXT: # %bb.0:
1973 ; SIMD128-NEXT: global.get $push6=, __stack_pointer
1974 ; SIMD128-NEXT: i32.const $push7=, 16
1975 ; SIMD128-NEXT: i32.sub $push9=, $pop6, $pop7
1976 ; SIMD128-NEXT: local.tee $push8=, $3=, $pop9
1977 ; SIMD128-NEXT: v128.store 0($pop8), $0
1978 ; SIMD128-NEXT: i32.const $push0=, 1
1979 ; SIMD128-NEXT: i32.and $push1=, $1, $pop0
1980 ; SIMD128-NEXT: i32.const $push2=, 3
1981 ; SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
1982 ; SIMD128-NEXT: i32.or $push4=, $3, $pop3
1983 ; SIMD128-NEXT: f64.store 0($pop4), $2
1984 ; SIMD128-NEXT: v128.load $push5=, 0($3)
1985 ; SIMD128-NEXT: return $pop5
1987 ; NO-SIMD128-LABEL: replace_var_v2f64:
1988 ; NO-SIMD128: .functype replace_var_v2f64 (i32, f64, f64, i32, f64) -> ()
1989 ; NO-SIMD128-NEXT: # %bb.0:
1990 ; NO-SIMD128-NEXT: global.get $push7=, __stack_pointer
1991 ; NO-SIMD128-NEXT: i32.const $push8=, 16
1992 ; NO-SIMD128-NEXT: i32.sub $push10=, $pop7, $pop8
1993 ; NO-SIMD128-NEXT: local.tee $push9=, $5=, $pop10
1994 ; NO-SIMD128-NEXT: f64.store 8($pop9), $2
1995 ; NO-SIMD128-NEXT: f64.store 0($5), $1
1996 ; NO-SIMD128-NEXT: i32.const $push0=, 1
1997 ; NO-SIMD128-NEXT: i32.and $push1=, $3, $pop0
1998 ; NO-SIMD128-NEXT: i32.const $push2=, 3
1999 ; NO-SIMD128-NEXT: i32.shl $push3=, $pop1, $pop2
2000 ; NO-SIMD128-NEXT: i32.or $push4=, $5, $pop3
2001 ; NO-SIMD128-NEXT: f64.store 0($pop4), $4
2002 ; NO-SIMD128-NEXT: f64.load $push5=, 8($5)
2003 ; NO-SIMD128-NEXT: f64.store 8($0), $pop5
2004 ; NO-SIMD128-NEXT: f64.load $push6=, 0($5)
2005 ; NO-SIMD128-NEXT: f64.store 0($0), $pop6
2006 ; NO-SIMD128-NEXT: return
2007 %res = insertelement <2 x double> %v, double %x, i32 %i
2008 ret <2 x double> %res
2011 define <2 x double> @replace_zero_v2f64(<2 x double> %v, double %x) {
2012 ; SIMD128-LABEL: replace_zero_v2f64:
2013 ; SIMD128: .functype replace_zero_v2f64 (v128, f64) -> (v128)
2014 ; SIMD128-NEXT: # %bb.0:
2015 ; SIMD128-NEXT: f64x2.replace_lane $push0=, $0, 0, $1
2016 ; SIMD128-NEXT: return $pop0
2018 ; NO-SIMD128-LABEL: replace_zero_v2f64:
2019 ; NO-SIMD128: .functype replace_zero_v2f64 (i32, f64, f64, f64) -> ()
2020 ; NO-SIMD128-NEXT: # %bb.0:
2021 ; NO-SIMD128-NEXT: f64.store 8($0), $2
2022 ; NO-SIMD128-NEXT: f64.store 0($0), $3
2023 ; NO-SIMD128-NEXT: return
2024 %res = insertelement <2 x double> %v, double %x, i32 0
2025 ret <2 x double> %res
2028 define <2 x double> @shuffle_v2f64(<2 x double> %x, <2 x double> %y) {
2029 ; SIMD128-LABEL: shuffle_v2f64:
2030 ; SIMD128: .functype shuffle_v2f64 (v128, v128) -> (v128)
2031 ; SIMD128-NEXT: # %bb.0:
2032 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $1, 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31
2033 ; SIMD128-NEXT: return $pop0
2035 ; NO-SIMD128-LABEL: shuffle_v2f64:
2036 ; NO-SIMD128: .functype shuffle_v2f64 (i32, f64, f64, f64, f64) -> ()
2037 ; NO-SIMD128-NEXT: # %bb.0:
2038 ; NO-SIMD128-NEXT: f64.store 8($0), $4
2039 ; NO-SIMD128-NEXT: f64.store 0($0), $1
2040 ; NO-SIMD128-NEXT: return
2041 %res = shufflevector <2 x double> %x, <2 x double> %y,
2042 <2 x i32> <i32 0, i32 3>
2043 ret <2 x double> %res
2046 define <2 x double> @shuffle_undef_v2f64(<2 x double> %x, <2 x double> %y) {
2047 ; SIMD128-LABEL: shuffle_undef_v2f64:
2048 ; SIMD128: .functype shuffle_undef_v2f64 (v128, v128) -> (v128)
2049 ; SIMD128-NEXT: # %bb.0:
2050 ; SIMD128-NEXT: i8x16.shuffle $push0=, $0, $0, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7
2051 ; SIMD128-NEXT: return $pop0
2053 ; NO-SIMD128-LABEL: shuffle_undef_v2f64:
2054 ; NO-SIMD128: .functype shuffle_undef_v2f64 (i32, f64, f64, f64, f64) -> ()
2055 ; NO-SIMD128-NEXT: # %bb.0:
2056 ; NO-SIMD128-NEXT: f64.store 0($0), $2
2057 ; NO-SIMD128-NEXT: return
2058 %res = shufflevector <2 x double> %x, <2 x double> %y,
2059 <2 x i32> <i32 1, i32 undef>
2060 ret <2 x double> %res
2063 define <2 x double> @build_v2f64(double %x0, double %x1) {
2064 ; SIMD128-LABEL: build_v2f64:
2065 ; SIMD128: .functype build_v2f64 (f64, f64) -> (v128)
2066 ; SIMD128-NEXT: # %bb.0:
2067 ; SIMD128-NEXT: f64x2.splat $push0=, $0
2068 ; SIMD128-NEXT: f64x2.replace_lane $push1=, $pop0, 1, $1
2069 ; SIMD128-NEXT: return $pop1
2071 ; NO-SIMD128-LABEL: build_v2f64:
2072 ; NO-SIMD128: .functype build_v2f64 (i32, f64, f64) -> ()
2073 ; NO-SIMD128-NEXT: # %bb.0:
2074 ; NO-SIMD128-NEXT: f64.store 8($0), $2
2075 ; NO-SIMD128-NEXT: f64.store 0($0), $1
2076 ; NO-SIMD128-NEXT: return
2077 %t0 = insertelement <2 x double> undef, double %x0, i32 0
2078 %res = insertelement <2 x double> %t0, double %x1, i32 1
2079 ret <2 x double> %res