1 // RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
2 // RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
3 // RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -target-feature +atomics -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
4 
5 // SIMD convenience types
6 typedef signed char i8x16 __attribute((vector_size(16)));
7 typedef short i16x8 __attribute((vector_size(16)));
8 typedef int i32x4 __attribute((vector_size(16)));
9 typedef long long i64x2 __attribute((vector_size(16)));
10 typedef unsigned char u8x16 __attribute((vector_size(16)));
11 typedef unsigned short u16x8 __attribute((vector_size(16)));
12 typedef unsigned int u32x4 __attribute((vector_size(16)));
13 typedef unsigned long long u64x2 __attribute((vector_size(16)));
14 typedef float f32x4 __attribute((vector_size(16)));
15 typedef double f64x2 __attribute((vector_size(16)));
16 
memory_size(void)17 __SIZE_TYPE__ memory_size(void) {
18   return __builtin_wasm_memory_size(0);
19   // WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32(i32 0)
20   // WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64(i32 0)
21 }
22 
memory_grow(__SIZE_TYPE__ delta)23 __SIZE_TYPE__ memory_grow(__SIZE_TYPE__ delta) {
24   return __builtin_wasm_memory_grow(0, delta);
25   // WEBASSEMBLY32: call i32 @llvm.wasm.memory.grow.i32(i32 0, i32 %{{.*}})
26   // WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}})
27 }
28 
tls_size()29 __SIZE_TYPE__ tls_size() {
30   return __builtin_wasm_tls_size();
31   // WEBASSEMBLY32: call i32 @llvm.wasm.tls.size.i32()
32   // WEBASSEMBLY64: call i64 @llvm.wasm.tls.size.i64()
33 }
34 
tls_align()35 __SIZE_TYPE__ tls_align() {
36   return __builtin_wasm_tls_align();
37   // WEBASSEMBLY32: call i32 @llvm.wasm.tls.align.i32()
38   // WEBASSEMBLY64: call i64 @llvm.wasm.tls.align.i64()
39 }
40 
tls_base()41 void *tls_base() {
42   return __builtin_wasm_tls_base();
43   // WEBASSEMBLY: call i8* @llvm.wasm.tls.base()
44 }
45 
throw(void * obj)46 void throw(void *obj) {
47   return __builtin_wasm_throw(0, obj);
48   // WEBASSEMBLY32: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
49   // WEBASSEMBLY64: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
50 }
51 
rethrow_in_catch(void)52 void rethrow_in_catch(void) {
53   return __builtin_wasm_rethrow_in_catch();
54   // WEBASSEMBLY32: call void @llvm.wasm.rethrow.in.catch()
55   // WEBASSEMBLY64: call void @llvm.wasm.rethrow.in.catch()
56 }
57 
memory_atomic_wait32(int * addr,int expected,long long timeout)58 int memory_atomic_wait32(int *addr, int expected, long long timeout) {
59   return __builtin_wasm_memory_atomic_wait32(addr, expected, timeout);
60   // WEBASSEMBLY32: call i32 @llvm.wasm.memory.atomic.wait32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
61   // WEBASSEMBLY64: call i32 @llvm.wasm.memory.atomic.wait32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
62 }
63 
memory_atomic_wait64(long long * addr,long long expected,long long timeout)64 int memory_atomic_wait64(long long *addr, long long expected, long long timeout) {
65   return __builtin_wasm_memory_atomic_wait64(addr, expected, timeout);
66   // WEBASSEMBLY32: call i32 @llvm.wasm.memory.atomic.wait64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
67   // WEBASSEMBLY64: call i32 @llvm.wasm.memory.atomic.wait64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
68 }
69 
memory_atomic_notify(int * addr,unsigned int count)70 unsigned int memory_atomic_notify(int *addr, unsigned int count) {
71   return __builtin_wasm_memory_atomic_notify(addr, count);
72   // WEBASSEMBLY32: call i32 @llvm.wasm.memory.atomic.notify(i32* %{{.*}}, i32 %{{.*}})
73   // WEBASSEMBLY64: call i32 @llvm.wasm.memory.atomic.notify(i32* %{{.*}}, i32 %{{.*}})
74 }
75 
trunc_s_i32_f32(float f)76 int trunc_s_i32_f32(float f) {
77   return __builtin_wasm_trunc_s_i32_f32(f);
78   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.signed.i32.f32(float %f)
79   // WEBASSEMBLY-NEXT: ret
80 }
81 
trunc_u_i32_f32(float f)82 int trunc_u_i32_f32(float f) {
83   return __builtin_wasm_trunc_u_i32_f32(f);
84   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.unsigned.i32.f32(float %f)
85   // WEBASSEMBLY-NEXT: ret
86 }
87 
trunc_s_i32_f64(double f)88 int trunc_s_i32_f64(double f) {
89   return __builtin_wasm_trunc_s_i32_f64(f);
90   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.signed.i32.f64(double %f)
91   // WEBASSEMBLY-NEXT: ret
92 }
93 
trunc_u_i32_f64(double f)94 int trunc_u_i32_f64(double f) {
95   return __builtin_wasm_trunc_u_i32_f64(f);
96   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.unsigned.i32.f64(double %f)
97   // WEBASSEMBLY-NEXT: ret
98 }
99 
trunc_s_i64_f32(float f)100 long long trunc_s_i64_f32(float f) {
101   return __builtin_wasm_trunc_s_i64_f32(f);
102   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.signed.i64.f32(float %f)
103   // WEBASSEMBLY-NEXT: ret
104 }
105 
trunc_u_i64_f32(float f)106 long long trunc_u_i64_f32(float f) {
107   return __builtin_wasm_trunc_u_i64_f32(f);
108   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.unsigned.i64.f32(float %f)
109   // WEBASSEMBLY-NEXT: ret
110 }
111 
trunc_s_i64_f64(double f)112 long long trunc_s_i64_f64(double f) {
113   return __builtin_wasm_trunc_s_i64_f64(f);
114   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.signed.i64.f64(double %f)
115   // WEBASSEMBLY-NEXT: ret
116 }
117 
trunc_u_i64_f64(double f)118 long long trunc_u_i64_f64(double f) {
119   return __builtin_wasm_trunc_u_i64_f64(f);
120   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.unsigned.i64.f64(double %f)
121   // WEBASSEMBLY-NEXT: ret
122 }
123 
trunc_saturate_s_i32_f32(float f)124 int trunc_saturate_s_i32_f32(float f) {
125   return __builtin_wasm_trunc_saturate_s_i32_f32(f);
126   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float %f)
127   // WEBASSEMBLY-NEXT: ret
128 }
129 
trunc_saturate_u_i32_f32(float f)130 int trunc_saturate_u_i32_f32(float f) {
131   return __builtin_wasm_trunc_saturate_u_i32_f32(f);
132   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.unsigned.i32.f32(float %f)
133   // WEBASSEMBLY-NEXT: ret
134 }
135 
trunc_saturate_s_i32_f64(double f)136 int trunc_saturate_s_i32_f64(double f) {
137   return __builtin_wasm_trunc_saturate_s_i32_f64(f);
138   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.signed.i32.f64(double %f)
139   // WEBASSEMBLY-NEXT: ret
140 }
141 
trunc_saturate_u_i32_f64(double f)142 int trunc_saturate_u_i32_f64(double f) {
143   return __builtin_wasm_trunc_saturate_u_i32_f64(f);
144   // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.unsigned.i32.f64(double %f)
145   // WEBASSEMBLY-NEXT: ret
146 }
147 
trunc_saturate_s_i64_f32(float f)148 long long trunc_saturate_s_i64_f32(float f) {
149   return __builtin_wasm_trunc_saturate_s_i64_f32(f);
150   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.signed.i64.f32(float %f)
151   // WEBASSEMBLY-NEXT: ret
152 }
153 
trunc_saturate_u_i64_f32(float f)154 long long trunc_saturate_u_i64_f32(float f) {
155   return __builtin_wasm_trunc_saturate_u_i64_f32(f);
156   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.unsigned.i64.f32(float %f)
157   // WEBASSEMBLY-NEXT: ret
158 }
159 
trunc_saturate_s_i64_f64(double f)160 long long trunc_saturate_s_i64_f64(double f) {
161   return __builtin_wasm_trunc_saturate_s_i64_f64(f);
162   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.signed.i64.f64(double %f)
163   // WEBASSEMBLY-NEXT: ret
164 }
165 
trunc_saturate_u_i64_f64(double f)166 long long trunc_saturate_u_i64_f64(double f) {
167   return __builtin_wasm_trunc_saturate_u_i64_f64(f);
168   // WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.unsigned.i64.f64(double %f)
169   // WEBASSEMBLY-NEXT: ret
170 }
171 
min_f32(float x,float y)172 float min_f32(float x, float y) {
173   return __builtin_wasm_min_f32(x, y);
174   // WEBASSEMBLY: call float @llvm.minimum.f32(float %x, float %y)
175   // WEBASSEMBLY-NEXT: ret
176 }
177 
max_f32(float x,float y)178 float max_f32(float x, float y) {
179   return __builtin_wasm_max_f32(x, y);
180   // WEBASSEMBLY: call float @llvm.maximum.f32(float %x, float %y)
181   // WEBASSEMBLY-NEXT: ret
182 }
183 
min_f64(double x,double y)184 double min_f64(double x, double y) {
185   return __builtin_wasm_min_f64(x, y);
186   // WEBASSEMBLY: call double @llvm.minimum.f64(double %x, double %y)
187   // WEBASSEMBLY-NEXT: ret
188 }
189 
max_f64(double x,double y)190 double max_f64(double x, double y) {
191   return __builtin_wasm_max_f64(x, y);
192   // WEBASSEMBLY: call double @llvm.maximum.f64(double %x, double %y)
193   // WEBASSEMBLY-NEXT: ret
194 }
195 
extract_lane_s_i8x16(i8x16 v)196 int extract_lane_s_i8x16(i8x16 v) {
197   return __builtin_wasm_extract_lane_s_i8x16(v, 13);
198   // MISSING-SIMD: error: '__builtin_wasm_extract_lane_s_i8x16' needs target feature simd128
199   // WEBASSEMBLY: extractelement <16 x i8> %v, i32 13
200   // WEBASSEMBLY-NEXT: sext
201   // WEBASSEMBLY-NEXT: ret
202 }
203 
extract_lane_u_i8x16(u8x16 v)204 int extract_lane_u_i8x16(u8x16 v) {
205   return __builtin_wasm_extract_lane_u_i8x16(v, 13);
206   // WEBASSEMBLY: extractelement <16 x i8> %v, i32 13
207   // WEBASSEMBLY-NEXT: zext
208   // WEBASSEMBLY-NEXT: ret
209 }
210 
extract_lane_s_i16x8(i16x8 v)211 int extract_lane_s_i16x8(i16x8 v) {
212   return __builtin_wasm_extract_lane_s_i16x8(v, 7);
213   // WEBASSEMBLY: extractelement <8 x i16> %v, i32 7
214   // WEBASSEMBLY-NEXT: sext
215   // WEBASSEMBLY-NEXT: ret
216 }
217 
extract_lane_u_i16x8(u16x8 v)218 int extract_lane_u_i16x8(u16x8 v) {
219   return __builtin_wasm_extract_lane_u_i16x8(v, 7);
220   // WEBASSEMBLY: extractelement <8 x i16> %v, i32 7
221   // WEBASSEMBLY-NEXT: zext
222   // WEBASSEMBLY-NEXT: ret
223 }
224 
extract_lane_i32x4(i32x4 v)225 int extract_lane_i32x4(i32x4 v) {
226   return __builtin_wasm_extract_lane_i32x4(v, 3);
227   // WEBASSEMBLY: extractelement <4 x i32> %v, i32 3
228   // WEBASSEMBLY-NEXT: ret
229 }
230 
extract_lane_i64x2(i64x2 v)231 long long extract_lane_i64x2(i64x2 v) {
232   return __builtin_wasm_extract_lane_i64x2(v, 1);
233   // WEBASSEMBLY: extractelement <2 x i64> %v, i32 1
234   // WEBASSEMBLY-NEXT: ret
235 }
236 
extract_lane_f32x4(f32x4 v)237 float extract_lane_f32x4(f32x4 v) {
238   return __builtin_wasm_extract_lane_f32x4(v, 3);
239   // WEBASSEMBLY: extractelement <4 x float> %v, i32 3
240   // WEBASSEMBLY-NEXT: ret
241 }
242 
extract_lane_f64x2(f64x2 v)243 double extract_lane_f64x2(f64x2 v) {
244   return __builtin_wasm_extract_lane_f64x2(v, 1);
245   // WEBASSEMBLY: extractelement <2 x double> %v, i32 1
246   // WEBASSEMBLY-NEXT: ret
247 }
248 
replace_lane_i8x16(i8x16 v,int x)249 i8x16 replace_lane_i8x16(i8x16 v, int x) {
250   return __builtin_wasm_replace_lane_i8x16(v, 13, x);
251   // WEBASSEMBLY: trunc i32 %x to i8
252   // WEBASSEMBLY-NEXT: insertelement <16 x i8> %v, i8 %{{.*}}, i32 13
253   // WEBASSEMBLY-NEXT: ret
254 }
255 
replace_lane_i16x8(i16x8 v,int x)256 i16x8 replace_lane_i16x8(i16x8 v, int x) {
257   return __builtin_wasm_replace_lane_i16x8(v, 7, x);
258   // WEBASSEMBLY: trunc i32 %x to i16
259   // WEBASSEMBLY-NEXT: insertelement <8 x i16> %v, i16 %{{.*}}, i32 7
260   // WEBASSEMBLY-NEXT: ret
261 }
262 
replace_lane_i32x4(i32x4 v,int x)263 i32x4 replace_lane_i32x4(i32x4 v, int x) {
264   return __builtin_wasm_replace_lane_i32x4(v, 3, x);
265   // WEBASSEMBLY: insertelement <4 x i32> %v, i32 %x, i32 3
266   // WEBASSEMBLY-NEXT: ret
267 }
268 
replace_lane_i64x2(i64x2 v,long long x)269 i64x2 replace_lane_i64x2(i64x2 v, long long x) {
270   return __builtin_wasm_replace_lane_i64x2(v, 1, x);
271   // WEBASSEMBLY: insertelement <2 x i64> %v, i64 %x, i32 1
272   // WEBASSEMBLY-NEXT: ret
273 }
274 
replace_lane_f32x4(f32x4 v,float x)275 f32x4 replace_lane_f32x4(f32x4 v, float x) {
276   return __builtin_wasm_replace_lane_f32x4(v, 3, x);
277   // WEBASSEMBLY: insertelement <4 x float> %v, float %x, i32 3
278   // WEBASSEMBLY-NEXT: ret
279 }
280 
replace_lane_f64x2(f64x2 v,double x)281 f64x2 replace_lane_f64x2(f64x2 v, double x) {
282   return __builtin_wasm_replace_lane_f64x2(v, 1, x);
283   // WEBASSEMBLY: insertelement <2 x double> %v, double %x, i32 1
284   // WEBASSEMBLY-NEXT: ret
285 }
286 
load8_lane(signed char * p,i8x16 v)287 i8x16 load8_lane(signed char *p, i8x16 v) {
288   return __builtin_wasm_load8_lane(p, v, 0);
289   // WEBASSEMBLY: tail call <16 x i8> @llvm.wasm.load8.lane(
290   // WEBASSEMBLY-SAME: i8* %p, <16 x i8> %v, i32 0)
291   // WEBASSEMBLY-NEXT: ret
292 }
293 
load16_lane(short * p,i16x8 v)294 i16x8 load16_lane(short *p, i16x8 v) {
295   return __builtin_wasm_load16_lane(p, v, 0);
296   // WEBASSEMBLY: tail call <8 x i16> @llvm.wasm.load16.lane(
297   // WEBASSEMBLY-SAME: i16* %p, <8 x i16> %v, i32 0)
298   // WEBASSEMBLY-NEXT: ret
299 }
300 
load32_lane(int * p,i32x4 v)301 i32x4 load32_lane(int *p, i32x4 v) {
302   return __builtin_wasm_load32_lane(p, v, 0);
303   // WEBASSEMBLY: tail call <4 x i32> @llvm.wasm.load32.lane(
304   // WEBASSEMBLY-SAME: i32* %p, <4 x i32> %v, i32 0)
305   // WEBASSEMBLY-NEXT: ret
306 }
307 
load64_lane(long long * p,i64x2 v)308 i64x2 load64_lane(long long *p, i64x2 v) {
309   return __builtin_wasm_load64_lane(p, v, 0);
310   // WEBASSEMBLY: tail call <2 x i64> @llvm.wasm.load64.lane(
311   // WEBASSEMBLY-SAME: i64* %p, <2 x i64> %v, i32 0)
312   // WEBASSEMBLY-NEXT: ret
313 }
314 
store8_lane(signed char * p,i8x16 v)315 void store8_lane(signed char *p, i8x16 v) {
316   __builtin_wasm_store8_lane(p, v, 0);
317   // WEBASSEMBLY: call void @llvm.wasm.store8.lane(
318   // WEBASSEMBLY-SAME: i8* %p, <16 x i8> %v, i32 0)
319   // WEBASSEMBLY-NEXT: ret
320 }
321 
store16_lane(short * p,i16x8 v)322 void store16_lane(short *p, i16x8 v) {
323   __builtin_wasm_store16_lane(p, v, 0);
324   // WEBASSEMBLY: call void @llvm.wasm.store16.lane(
325   // WEBASSEMBLY-SAME: i16* %p, <8 x i16> %v, i32 0)
326   // WEBASSEMBLY-NEXT: ret
327 }
328 
store32_lane(int * p,i32x4 v)329 void store32_lane(int *p, i32x4 v) {
330   __builtin_wasm_store32_lane(p, v, 0);
331   // WEBASSEMBLY: call void @llvm.wasm.store32.lane(
332   // WEBASSEMBLY-SAME: i32* %p, <4 x i32> %v, i32 0)
333   // WEBASSEMBLY-NEXT: ret
334 }
335 
store64_lane(long long * p,i64x2 v)336 void store64_lane(long long *p, i64x2 v) {
337   __builtin_wasm_store64_lane(p, v, 0);
338   // WEBASSEMBLY: call void @llvm.wasm.store64.lane(
339   // WEBASSEMBLY-SAME: i64* %p, <2 x i64> %v, i32 0)
340   // WEBASSEMBLY-NEXT: ret
341 }
342 
add_saturate_s_i8x16(i8x16 x,i8x16 y)343 i8x16 add_saturate_s_i8x16(i8x16 x, i8x16 y) {
344   return __builtin_wasm_add_saturate_s_i8x16(x, y);
345   // WEBASSEMBLY: call <16 x i8> @llvm.sadd.sat.v16i8(
346   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
347   // WEBASSEMBLY-NEXT: ret
348 }
349 
add_saturate_u_i8x16(u8x16 x,u8x16 y)350 u8x16 add_saturate_u_i8x16(u8x16 x, u8x16 y) {
351   return __builtin_wasm_add_saturate_u_i8x16(x, y);
352   // WEBASSEMBLY: call <16 x i8> @llvm.uadd.sat.v16i8(
353   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
354   // WEBASSEMBLY-NEXT: ret
355 }
356 
add_saturate_s_i16x8(i16x8 x,i16x8 y)357 i16x8 add_saturate_s_i16x8(i16x8 x, i16x8 y) {
358   return __builtin_wasm_add_saturate_s_i16x8(x, y);
359   // WEBASSEMBLY: call <8 x i16> @llvm.sadd.sat.v8i16(
360   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
361   // WEBASSEMBLY-NEXT: ret
362 }
363 
add_saturate_u_i16x8(u16x8 x,u16x8 y)364 u16x8 add_saturate_u_i16x8(u16x8 x, u16x8 y) {
365   return __builtin_wasm_add_saturate_u_i16x8(x, y);
366   // WEBASSEMBLY: call <8 x i16> @llvm.uadd.sat.v8i16(
367   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
368   // WEBASSEMBLY-NEXT: ret
369 }
370 
sub_saturate_s_i8x16(i8x16 x,i8x16 y)371 i8x16 sub_saturate_s_i8x16(i8x16 x, i8x16 y) {
372   return __builtin_wasm_sub_saturate_s_i8x16(x, y);
373   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.signed.v16i8(
374   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
375   // WEBASSEMBLY-NEXT: ret
376 }
377 
sub_saturate_u_i8x16(u8x16 x,u8x16 y)378 u8x16 sub_saturate_u_i8x16(u8x16 x, u8x16 y) {
379   return __builtin_wasm_sub_saturate_u_i8x16(x, y);
380   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.unsigned.v16i8(
381   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
382   // WEBASSEMBLY-NEXT: ret
383 }
384 
abs_i8x16(i8x16 v)385 i8x16 abs_i8x16(i8x16 v) {
386   return __builtin_wasm_abs_i8x16(v);
387   // WEBASSEMBLY: %neg = sub <16 x i8> zeroinitializer, %v
388   // WEBASSEMBLY: %abscond = icmp slt <16 x i8> %v, zeroinitializer
389   // WEBASSEMBLY: %abs = select <16 x i1> %abscond, <16 x i8> %neg, <16 x i8> %v
390   // WEBASSEMBLY: ret <16 x i8> %abs
391 }
392 
abs_i16x8(i16x8 v)393 i16x8 abs_i16x8(i16x8 v) {
394   return __builtin_wasm_abs_i16x8(v);
395   // WEBASSEMBLY: %neg = sub <8 x i16> zeroinitializer, %v
396   // WEBASSEMBLY: %abscond = icmp slt <8 x i16> %v, zeroinitializer
397   // WEBASSEMBLY: %abs = select <8 x i1> %abscond, <8 x i16> %neg, <8 x i16> %v
398   // WEBASSEMBLY: ret <8 x i16> %abs
399 }
400 
abs_i32x4(i32x4 v)401 i32x4 abs_i32x4(i32x4 v) {
402   return __builtin_wasm_abs_i32x4(v);
403   // WEBASSEMBLY: %neg = sub <4 x i32> zeroinitializer, %v
404   // WEBASSEMBLY: %abscond = icmp slt <4 x i32> %v, zeroinitializer
405   // WEBASSEMBLY: %abs = select <4 x i1> %abscond, <4 x i32> %neg, <4 x i32> %v
406   // WEBASSEMBLY: ret <4 x i32> %abs
407 }
408 
min_s_i8x16(i8x16 x,i8x16 y)409 i8x16 min_s_i8x16(i8x16 x, i8x16 y) {
410   return __builtin_wasm_min_s_i8x16(x, y);
411   // WEBASSEMBLY: %0 = icmp slt <16 x i8> %x, %y
412   // WEBASSEMBLY-NEXT: %1 = select <16 x i1> %0, <16 x i8> %x, <16 x i8> %y
413   // WEBASSEMBLY-NEXT: ret <16 x i8> %1
414 }
415 
min_u_i8x16(u8x16 x,u8x16 y)416 u8x16 min_u_i8x16(u8x16 x, u8x16 y) {
417   return __builtin_wasm_min_u_i8x16(x, y);
418   // WEBASSEMBLY: %0 = icmp ult <16 x i8> %x, %y
419   // WEBASSEMBLY-NEXT: %1 = select <16 x i1> %0, <16 x i8> %x, <16 x i8> %y
420   // WEBASSEMBLY-NEXT: ret <16 x i8> %1
421 }
422 
max_s_i8x16(i8x16 x,i8x16 y)423 i8x16 max_s_i8x16(i8x16 x, i8x16 y) {
424   return __builtin_wasm_max_s_i8x16(x, y);
425   // WEBASSEMBLY: %0 = icmp sgt <16 x i8> %x, %y
426   // WEBASSEMBLY-NEXT: %1 = select <16 x i1> %0, <16 x i8> %x, <16 x i8> %y
427   // WEBASSEMBLY-NEXT: ret <16 x i8> %1
428 }
429 
max_u_i8x16(u8x16 x,u8x16 y)430 u8x16 max_u_i8x16(u8x16 x, u8x16 y) {
431   return __builtin_wasm_max_u_i8x16(x, y);
432   // WEBASSEMBLY: %0 = icmp ugt <16 x i8> %x, %y
433   // WEBASSEMBLY-NEXT: %1 = select <16 x i1> %0, <16 x i8> %x, <16 x i8> %y
434   // WEBASSEMBLY-NEXT: ret <16 x i8> %1
435 }
436 
min_s_i16x8(i16x8 x,i16x8 y)437 i16x8 min_s_i16x8(i16x8 x, i16x8 y) {
438   return __builtin_wasm_min_s_i16x8(x, y);
439   // WEBASSEMBLY: %0 = icmp slt <8 x i16> %x, %y
440   // WEBASSEMBLY-NEXT: %1 = select <8 x i1> %0, <8 x i16> %x, <8 x i16> %y
441   // WEBASSEMBLY-NEXT: ret <8 x i16> %1
442 }
443 
min_u_i16x8(u16x8 x,u16x8 y)444 u16x8 min_u_i16x8(u16x8 x, u16x8 y) {
445   return __builtin_wasm_min_u_i16x8(x, y);
446   // WEBASSEMBLY: %0 = icmp ult <8 x i16> %x, %y
447   // WEBASSEMBLY-NEXT: %1 = select <8 x i1> %0, <8 x i16> %x, <8 x i16> %y
448   // WEBASSEMBLY-NEXT: ret <8 x i16> %1
449 }
450 
max_s_i16x8(i16x8 x,i16x8 y)451 i16x8 max_s_i16x8(i16x8 x, i16x8 y) {
452   return __builtin_wasm_max_s_i16x8(x, y);
453   // WEBASSEMBLY: %0 = icmp sgt <8 x i16> %x, %y
454   // WEBASSEMBLY-NEXT: %1 = select <8 x i1> %0, <8 x i16> %x, <8 x i16> %y
455   // WEBASSEMBLY-NEXT: ret <8 x i16> %1
456 }
457 
max_u_i16x8(u16x8 x,u16x8 y)458 u16x8 max_u_i16x8(u16x8 x, u16x8 y) {
459   return __builtin_wasm_max_u_i16x8(x, y);
460   // WEBASSEMBLY: %0 = icmp ugt <8 x i16> %x, %y
461   // WEBASSEMBLY-NEXT: %1 = select <8 x i1> %0, <8 x i16> %x, <8 x i16> %y
462   // WEBASSEMBLY-NEXT: ret <8 x i16> %1
463 }
464 
min_s_i32x4(i32x4 x,i32x4 y)465 i32x4 min_s_i32x4(i32x4 x, i32x4 y) {
466   return __builtin_wasm_min_s_i32x4(x, y);
467   // WEBASSEMBLY: %0 = icmp slt <4 x i32> %x, %y
468   // WEBASSEMBLY-NEXT: %1 = select <4 x i1> %0, <4 x i32> %x, <4 x i32> %y
469   // WEBASSEMBLY-NEXT: ret <4 x i32> %1
470 }
471 
min_u_i32x4(u32x4 x,u32x4 y)472 u32x4 min_u_i32x4(u32x4 x, u32x4 y) {
473   return __builtin_wasm_min_u_i32x4(x, y);
474   // WEBASSEMBLY: %0 = icmp ult <4 x i32> %x, %y
475   // WEBASSEMBLY-NEXT: %1 = select <4 x i1> %0, <4 x i32> %x, <4 x i32> %y
476   // WEBASSEMBLY-NEXT: ret <4 x i32> %1
477 }
478 
max_s_i32x4(i32x4 x,i32x4 y)479 i32x4 max_s_i32x4(i32x4 x, i32x4 y) {
480   return __builtin_wasm_max_s_i32x4(x, y);
481   // WEBASSEMBLY: %0 = icmp sgt <4 x i32> %x, %y
482   // WEBASSEMBLY-NEXT: %1 = select <4 x i1> %0, <4 x i32> %x, <4 x i32> %y
483   // WEBASSEMBLY-NEXT: ret <4 x i32> %1
484 }
485 
max_u_i32x4(u32x4 x,u32x4 y)486 u32x4 max_u_i32x4(u32x4 x, u32x4 y) {
487   return __builtin_wasm_max_u_i32x4(x, y);
488   // WEBASSEMBLY: %0 = icmp ugt <4 x i32> %x, %y
489   // WEBASSEMBLY-NEXT: %1 = select <4 x i1> %0, <4 x i32> %x, <4 x i32> %y
490   // WEBASSEMBLY-NEXT: ret <4 x i32> %1
491 }
492 
sub_saturate_s_i16x8(i16x8 x,i16x8 y)493 i16x8 sub_saturate_s_i16x8(i16x8 x, i16x8 y) {
494   return __builtin_wasm_sub_saturate_s_i16x8(x, y);
495   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.signed.v8i16(
496   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
497   // WEBASSEMBLY-NEXT: ret
498 }
499 
sub_saturate_u_i16x8(u16x8 x,u16x8 y)500 u16x8 sub_saturate_u_i16x8(u16x8 x, u16x8 y) {
501   return __builtin_wasm_sub_saturate_u_i16x8(x, y);
502   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.unsigned.v8i16(
503   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
504   // WEBASSEMBLY-NEXT: ret
505 }
506 
avgr_u_i8x16(u8x16 x,u8x16 y)507 u8x16 avgr_u_i8x16(u8x16 x, u8x16 y) {
508   return __builtin_wasm_avgr_u_i8x16(x, y);
509   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.avgr.unsigned.v16i8(
510   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
511   // WEBASSEMBLY-NEXT: ret
512 }
513 
avgr_u_i16x8(u16x8 x,u16x8 y)514 u16x8 avgr_u_i16x8(u16x8 x, u16x8 y) {
515   return __builtin_wasm_avgr_u_i16x8(x, y);
516   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.avgr.unsigned.v8i16(
517   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
518   // WEBASSEMBLY-NEXT: ret
519 }
520 
q15mulr_saturate_s_i16x8(i16x8 x,i16x8 y)521 i16x8 q15mulr_saturate_s_i16x8(i16x8 x, i16x8 y) {
522   return __builtin_wasm_q15mulr_saturate_s_i16x8(x, y);
523   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.q15mulr.saturate.signed(
524   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
525   // WEBASSEMBLY-NEXT: ret
526 }
527 
extmul_low_i8x16_s_i16x8(i8x16 x,i8x16 y)528 i16x8 extmul_low_i8x16_s_i16x8(i8x16 x, i8x16 y) {
529   return __builtin_wasm_extmul_low_i8x16_s_i16x8(x, y);
530   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.extmul.low.signed.v8i16(
531   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
532   // WEBASSEMBLY-NEXT: ret
533 }
534 
extmul_high_i8x16_s_i16x8(i8x16 x,i8x16 y)535 i16x8 extmul_high_i8x16_s_i16x8(i8x16 x, i8x16 y) {
536   return __builtin_wasm_extmul_high_i8x16_s_i16x8(x, y);
537   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.extmul.high.signed.v8i16(
538   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
539   // WEBASSEMBLY-NEXT: ret
540 }
541 
extmul_low_i8x16_u_i16x8(u8x16 x,u8x16 y)542 u16x8 extmul_low_i8x16_u_i16x8(u8x16 x, u8x16 y) {
543   return __builtin_wasm_extmul_low_i8x16_u_i16x8(x, y);
544   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.extmul.low.unsigned.v8i16(
545   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
546   // WEBASSEMBLY-NEXT: ret
547 }
548 
extmul_high_i8x16_u_i16x8(u8x16 x,u8x16 y)549 u16x8 extmul_high_i8x16_u_i16x8(u8x16 x, u8x16 y) {
550   return __builtin_wasm_extmul_high_i8x16_u_i16x8(x, y);
551   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.extmul.high.unsigned.v8i16(
552   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
553   // WEBASSEMBLY-NEXT: ret
554 }
555 
extmul_low_i16x8_s_i32x4(i16x8 x,i16x8 y)556 i32x4 extmul_low_i16x8_s_i32x4(i16x8 x, i16x8 y) {
557   return __builtin_wasm_extmul_low_i16x8_s_i32x4(x, y);
558   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.extmul.low.signed.v4i32(
559   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
560   // WEBASSEMBLY-NEXT: ret
561 }
562 
extmul_high_i16x8_s_i32x4(i16x8 x,i16x8 y)563 i32x4 extmul_high_i16x8_s_i32x4(i16x8 x, i16x8 y) {
564   return __builtin_wasm_extmul_high_i16x8_s_i32x4(x, y);
565   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.extmul.high.signed.v4i32(
566   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
567   // WEBASSEMBLY-NEXT: ret
568 }
569 
extmul_low_i16x8_u_i32x4(u16x8 x,u16x8 y)570 u32x4 extmul_low_i16x8_u_i32x4(u16x8 x, u16x8 y) {
571   return __builtin_wasm_extmul_low_i16x8_u_i32x4(x, y);
572   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.extmul.low.unsigned.v4i32(
573   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
574   // WEBASSEMBLY-NEXT: ret
575 }
576 
extmul_high_i16x8_u_i32x4(u16x8 x,u16x8 y)577 u32x4 extmul_high_i16x8_u_i32x4(u16x8 x, u16x8 y) {
578   return __builtin_wasm_extmul_high_i16x8_u_i32x4(x, y);
579   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.extmul.high.unsigned.v4i32(
580   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
581   // WEBASSEMBLY-NEXT: ret
582 }
583 
extmul_low_i32x4_s_i64x2(i32x4 x,i32x4 y)584 i64x2 extmul_low_i32x4_s_i64x2(i32x4 x, i32x4 y) {
585   return __builtin_wasm_extmul_low_i32x4_s_i64x2(x, y);
586   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.extmul.low.signed.v2i64(
587   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y)
588   // WEBASSEMBLY-NEXT: ret
589 }
590 
extmul_high_i32x4_s_i64x2(i32x4 x,i32x4 y)591 i64x2 extmul_high_i32x4_s_i64x2(i32x4 x, i32x4 y) {
592   return __builtin_wasm_extmul_high_i32x4_s_i64x2(x, y);
593   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.extmul.high.signed.v2i64(
594   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y)
595   // WEBASSEMBLY-NEXT: ret
596 }
597 
extmul_low_i32x4_u_i64x2(u32x4 x,u32x4 y)598 u64x2 extmul_low_i32x4_u_i64x2(u32x4 x, u32x4 y) {
599   return __builtin_wasm_extmul_low_i32x4_u_i64x2(x, y);
600   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.extmul.low.unsigned.v2i64(
601   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y)
602   // WEBASSEMBLY-NEXT: ret
603 }
604 
extmul_high_i32x4_u_i64x2(u32x4 x,u32x4 y)605 u64x2 extmul_high_i32x4_u_i64x2(u32x4 x, u32x4 y) {
606   return __builtin_wasm_extmul_high_i32x4_u_i64x2(x, y);
607   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.extmul.high.unsigned.v2i64(
608   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y)
609   // WEBASSEMBLY-NEXT: ret
610 }
611 
dot_i16x8_s(i16x8 x,i16x8 y)612 i32x4 dot_i16x8_s(i16x8 x, i16x8 y) {
613   return __builtin_wasm_dot_s_i32x4_i16x8(x, y);
614   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.dot(<8 x i16> %x, <8 x i16> %y)
615   // WEBASSEMBLY-NEXT: ret
616 }
617 
bitselect(i32x4 x,i32x4 y,i32x4 c)618 i32x4 bitselect(i32x4 x, i32x4 y, i32x4 c) {
619   return __builtin_wasm_bitselect(x, y, c);
620   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.bitselect.v4i32(
621   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y, <4 x i32> %c)
622   // WEBASSEMBLY-NEXT: ret
623 }
624 
signselect_i8x16(i8x16 x,i8x16 y,i8x16 c)625 i8x16 signselect_i8x16(i8x16 x, i8x16 y, i8x16 c) {
626   return __builtin_wasm_signselect_i8x16(x, y, c);
627   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.signselect.v16i8(
628   // WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y, <16 x i8> %c)
629   // WEBASSEMBLY-NEXT: ret
630 }
631 
signselect_i16x8(i16x8 x,i16x8 y,i16x8 c)632 i16x8 signselect_i16x8(i16x8 x, i16x8 y, i16x8 c) {
633   return __builtin_wasm_signselect_i16x8(x, y, c);
634   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.signselect.v8i16(
635   // WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y, <8 x i16> %c)
636   // WEBASSEMBLY-NEXT: ret
637 }
638 
signselect_i32x4(i32x4 x,i32x4 y,i32x4 c)639 i32x4 signselect_i32x4(i32x4 x, i32x4 y, i32x4 c) {
640   return __builtin_wasm_signselect_i32x4(x, y, c);
641   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.signselect.v4i32(
642   // WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y, <4 x i32> %c)
643   // WEBASSEMBLY-NEXT: ret
644 }
645 
signselect_i64x2(i64x2 x,i64x2 y,i64x2 c)646 i64x2 signselect_i64x2(i64x2 x, i64x2 y, i64x2 c) {
647   return __builtin_wasm_signselect_i64x2(x, y, c);
648   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.signselect.v2i64(
649   // WEBASSEMBLY-SAME: <2 x i64> %x, <2 x i64> %y, <2 x i64> %c)
650   // WEBASSEMBLY-NEXT: ret
651 }
652 
popcnt(i8x16 x)653 i8x16 popcnt(i8x16 x) {
654   return __builtin_wasm_popcnt_i8x16(x);
655   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.popcnt(<16 x i8> %x)
656   // WEBASSEMBLY-NEXT: ret
657 }
658 
eq_i64x2(i64x2 x,i64x2 y)659 i64x2 eq_i64x2(i64x2 x, i64x2 y) {
660   return __builtin_wasm_eq_i64x2(x, y);
661   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.eq(<2 x i64> %x, <2 x i64> %y)
662   // WEBASSEMBLY-NEXT: ret
663 }
664 
any_true_i8x16(i8x16 x)665 int any_true_i8x16(i8x16 x) {
666   return __builtin_wasm_any_true_i8x16(x);
667   // WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v16i8(<16 x i8> %x)
668   // WEBASSEMBLY: ret
669 }
670 
any_true_i16x8(i16x8 x)671 int any_true_i16x8(i16x8 x) {
672   return __builtin_wasm_any_true_i16x8(x);
673   // WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v8i16(<8 x i16> %x)
674   // WEBASSEMBLY: ret
675 }
676 
any_true_i32x4(i32x4 x)677 int any_true_i32x4(i32x4 x) {
678   return __builtin_wasm_any_true_i32x4(x);
679   // WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v4i32(<4 x i32> %x)
680   // WEBASSEMBLY: ret
681 }
682 
any_true_i64x2(i64x2 x)683 int any_true_i64x2(i64x2 x) {
684   return __builtin_wasm_any_true_i64x2(x);
685   // WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v2i64(<2 x i64> %x)
686   // WEBASSEMBLY: ret
687 }
688 
all_true_i8x16(i8x16 x)689 int all_true_i8x16(i8x16 x) {
690   return __builtin_wasm_all_true_i8x16(x);
691   // WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v16i8(<16 x i8> %x)
692   // WEBASSEMBLY: ret
693 }
694 
all_true_i16x8(i16x8 x)695 int all_true_i16x8(i16x8 x) {
696   return __builtin_wasm_all_true_i16x8(x);
697   // WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v8i16(<8 x i16> %x)
698   // WEBASSEMBLY: ret
699 }
700 
all_true_i32x4(i32x4 x)701 int all_true_i32x4(i32x4 x) {
702   return __builtin_wasm_all_true_i32x4(x);
703   // WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v4i32(<4 x i32> %x)
704   // WEBASSEMBLY: ret
705 }
706 
all_true_i64x2(i64x2 x)707 int all_true_i64x2(i64x2 x) {
708   return __builtin_wasm_all_true_i64x2(x);
709   // WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v2i64(<2 x i64> %x)
710   // WEBASSEMBLY: ret
711 }
712 
bitmask_i8x16(i8x16 x)713 int bitmask_i8x16(i8x16 x) {
714   return __builtin_wasm_bitmask_i8x16(x);
715   // WEBASSEMBLY: call i32 @llvm.wasm.bitmask.v16i8(<16 x i8> %x)
716   // WEBASSEMBLY: ret
717 }
718 
bitmask_i16x8(i16x8 x)719 int bitmask_i16x8(i16x8 x) {
720   return __builtin_wasm_bitmask_i16x8(x);
721   // WEBASSEMBLY: call i32 @llvm.wasm.bitmask.v8i16(<8 x i16> %x)
722   // WEBASSEMBLY: ret
723 }
724 
bitmask_i32x4(i32x4 x)725 int bitmask_i32x4(i32x4 x) {
726   return __builtin_wasm_bitmask_i32x4(x);
727   // WEBASSEMBLY: call i32 @llvm.wasm.bitmask.v4i32(<4 x i32> %x)
728   // WEBASSEMBLY: ret
729 }
730 
bitmask_i64x2(i64x2 x)731 int bitmask_i64x2(i64x2 x) {
732   return __builtin_wasm_bitmask_i64x2(x);
733   // WEBASSEMBLY: call i32 @llvm.wasm.bitmask.v2i64(<2 x i64> %x)
734   // WEBASSEMBLY: ret
735 }
736 
abs_f32x4(f32x4 x)737 f32x4 abs_f32x4(f32x4 x) {
738   return __builtin_wasm_abs_f32x4(x);
739   // WEBASSEMBLY: call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
740   // WEBASSEMBLY: ret
741 }
742 
abs_f64x2(f64x2 x)743 f64x2 abs_f64x2(f64x2 x) {
744   return __builtin_wasm_abs_f64x2(x);
745   // WEBASSEMBLY: call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
746   // WEBASSEMBLY: ret
747 }
748 
min_f32x4(f32x4 x,f32x4 y)749 f32x4 min_f32x4(f32x4 x, f32x4 y) {
750   return __builtin_wasm_min_f32x4(x, y);
751   // WEBASSEMBLY: call <4 x float> @llvm.minimum.v4f32(
752   // WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
753   // WEBASSEMBLY-NEXT: ret
754 }
755 
max_f32x4(f32x4 x,f32x4 y)756 f32x4 max_f32x4(f32x4 x, f32x4 y) {
757   return __builtin_wasm_max_f32x4(x, y);
758   // WEBASSEMBLY: call <4 x float> @llvm.maximum.v4f32(
759   // WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
760   // WEBASSEMBLY-NEXT: ret
761 }
762 
pmin_f32x4(f32x4 x,f32x4 y)763 f32x4 pmin_f32x4(f32x4 x, f32x4 y) {
764   return __builtin_wasm_pmin_f32x4(x, y);
765   // WEBASSEMBLY: call <4 x float> @llvm.wasm.pmin.v4f32(
766   // WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
767   // WEBASSEMBLY-NEXT: ret
768 }
769 
pmax_f32x4(f32x4 x,f32x4 y)770 f32x4 pmax_f32x4(f32x4 x, f32x4 y) {
771   return __builtin_wasm_pmax_f32x4(x, y);
772   // WEBASSEMBLY: call <4 x float> @llvm.wasm.pmax.v4f32(
773   // WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
774   // WEBASSEMBLY-NEXT: ret
775 }
776 
min_f64x2(f64x2 x,f64x2 y)777 f64x2 min_f64x2(f64x2 x, f64x2 y) {
778   return __builtin_wasm_min_f64x2(x, y);
779   // WEBASSEMBLY: call <2 x double> @llvm.minimum.v2f64(
780   // WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
781   // WEBASSEMBLY-NEXT: ret
782 }
783 
max_f64x2(f64x2 x,f64x2 y)784 f64x2 max_f64x2(f64x2 x, f64x2 y) {
785   return __builtin_wasm_max_f64x2(x, y);
786   // WEBASSEMBLY: call <2 x double> @llvm.maximum.v2f64(
787   // WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
788   // WEBASSEMBLY-NEXT: ret
789 }
790 
pmin_f64x2(f64x2 x,f64x2 y)791 f64x2 pmin_f64x2(f64x2 x, f64x2 y) {
792   return __builtin_wasm_pmin_f64x2(x, y);
793   // WEBASSEMBLY: call <2 x double> @llvm.wasm.pmin.v2f64(
794   // WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
795   // WEBASSEMBLY-NEXT: ret
796 }
797 
pmax_f64x2(f64x2 x,f64x2 y)798 f64x2 pmax_f64x2(f64x2 x, f64x2 y) {
799   return __builtin_wasm_pmax_f64x2(x, y);
800   // WEBASSEMBLY: call <2 x double> @llvm.wasm.pmax.v2f64(
801   // WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
802   // WEBASSEMBLY-NEXT: ret
803 }
804 
ceil_f32x4(f32x4 x)805 f32x4 ceil_f32x4(f32x4 x) {
806   return __builtin_wasm_ceil_f32x4(x);
807   // WEBASSEMBLY: call <4 x float> @llvm.wasm.ceil.v4f32(<4 x float> %x)
808   // WEBASSEMBLY: ret
809 }
810 
floor_f32x4(f32x4 x)811 f32x4 floor_f32x4(f32x4 x) {
812   return __builtin_wasm_floor_f32x4(x);
813   // WEBASSEMBLY: call <4 x float> @llvm.wasm.floor.v4f32(<4 x float> %x)
814   // WEBASSEMBLY: ret
815 }
816 
trunc_f32x4(f32x4 x)817 f32x4 trunc_f32x4(f32x4 x) {
818   return __builtin_wasm_trunc_f32x4(x);
819   // WEBASSEMBLY: call <4 x float> @llvm.wasm.trunc.v4f32(<4 x float> %x)
820   // WEBASSEMBLY: ret
821 }
822 
nearest_f32x4(f32x4 x)823 f32x4 nearest_f32x4(f32x4 x) {
824   return __builtin_wasm_nearest_f32x4(x);
825   // WEBASSEMBLY: call <4 x float> @llvm.wasm.nearest.v4f32(<4 x float> %x)
826   // WEBASSEMBLY: ret
827 }
828 
ceil_f64x2(f64x2 x)829 f64x2 ceil_f64x2(f64x2 x) {
830   return __builtin_wasm_ceil_f64x2(x);
831   // WEBASSEMBLY: call <2 x double> @llvm.wasm.ceil.v2f64(<2 x double> %x)
832   // WEBASSEMBLY: ret
833 }
834 
floor_f64x2(f64x2 x)835 f64x2 floor_f64x2(f64x2 x) {
836   return __builtin_wasm_floor_f64x2(x);
837   // WEBASSEMBLY: call <2 x double> @llvm.wasm.floor.v2f64(<2 x double> %x)
838   // WEBASSEMBLY: ret
839 }
840 
trunc_f64x2(f64x2 x)841 f64x2 trunc_f64x2(f64x2 x) {
842   return __builtin_wasm_trunc_f64x2(x);
843   // WEBASSEMBLY: call <2 x double> @llvm.wasm.trunc.v2f64(<2 x double> %x)
844   // WEBASSEMBLY: ret
845 }
846 
nearest_f64x2(f64x2 x)847 f64x2 nearest_f64x2(f64x2 x) {
848   return __builtin_wasm_nearest_f64x2(x);
849   // WEBASSEMBLY: call <2 x double> @llvm.wasm.nearest.v2f64(<2 x double> %x)
850   // WEBASSEMBLY: ret
851 }
852 
sqrt_f32x4(f32x4 x)853 f32x4 sqrt_f32x4(f32x4 x) {
854   return __builtin_wasm_sqrt_f32x4(x);
855   // WEBASSEMBLY: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %x)
856   // WEBASSEMBLY: ret
857 }
858 
sqrt_f64x2(f64x2 x)859 f64x2 sqrt_f64x2(f64x2 x) {
860   return __builtin_wasm_sqrt_f64x2(x);
861   // WEBASSEMBLY: call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)
862   // WEBASSEMBLY: ret
863 }
864 
qfma_f32x4(f32x4 a,f32x4 b,f32x4 c)865 f32x4 qfma_f32x4(f32x4 a, f32x4 b, f32x4 c) {
866   return __builtin_wasm_qfma_f32x4(a, b, c);
867   // WEBASSEMBLY: call <4 x float> @llvm.wasm.qfma.v4f32(
868   // WEBASSEMBLY-SAME: <4 x float> %a, <4 x float> %b, <4 x float> %c)
869   // WEBASSEMBLY-NEXT: ret
870 }
871 
qfms_f32x4(f32x4 a,f32x4 b,f32x4 c)872 f32x4 qfms_f32x4(f32x4 a, f32x4 b, f32x4 c) {
873   return __builtin_wasm_qfms_f32x4(a, b, c);
874   // WEBASSEMBLY: call <4 x float> @llvm.wasm.qfms.v4f32(
875   // WEBASSEMBLY-SAME: <4 x float> %a, <4 x float> %b, <4 x float> %c)
876   // WEBASSEMBLY-NEXT: ret
877 }
878 
qfma_f64x2(f64x2 a,f64x2 b,f64x2 c)879 f64x2 qfma_f64x2(f64x2 a, f64x2 b, f64x2 c) {
880   return __builtin_wasm_qfma_f64x2(a, b, c);
881   // WEBASSEMBLY: call <2 x double> @llvm.wasm.qfma.v2f64(
882   // WEBASSEMBLY-SAME: <2 x double> %a, <2 x double> %b, <2 x double> %c)
883   // WEBASSEMBLY-NEXT: ret
884 }
885 
qfms_f64x2(f64x2 a,f64x2 b,f64x2 c)886 f64x2 qfms_f64x2(f64x2 a, f64x2 b, f64x2 c) {
887   return __builtin_wasm_qfms_f64x2(a, b, c);
888   // WEBASSEMBLY: call <2 x double> @llvm.wasm.qfms.v2f64(
889   // WEBASSEMBLY-SAME: <2 x double> %a, <2 x double> %b, <2 x double> %c)
890   // WEBASSEMBLY-NEXT: ret
891 }
892 
trunc_saturate_s_i32x4_f32x4(f32x4 f)893 i32x4 trunc_saturate_s_i32x4_f32x4(f32x4 f) {
894   return __builtin_wasm_trunc_saturate_s_i32x4_f32x4(f);
895   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.trunc.saturate.signed.v4i32.v4f32(<4 x float> %f)
896   // WEBASSEMBLY-NEXT: ret
897 }
898 
trunc_saturate_u_i32x4_f32x4(f32x4 f)899 i32x4 trunc_saturate_u_i32x4_f32x4(f32x4 f) {
900   return __builtin_wasm_trunc_saturate_u_i32x4_f32x4(f);
901   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.trunc.saturate.unsigned.v4i32.v4f32(<4 x float> %f)
902   // WEBASSEMBLY-NEXT: ret
903 }
904 
narrow_s_i8x16_i16x8(i16x8 low,i16x8 high)905 i8x16 narrow_s_i8x16_i16x8(i16x8 low, i16x8 high) {
906   return __builtin_wasm_narrow_s_i8x16_i16x8(low, high);
907   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.signed.v16i8.v8i16(
908   // WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
909   // WEBASSEMBLY: ret
910 }
911 
narrow_u_i8x16_i16x8(u16x8 low,u16x8 high)912 u8x16 narrow_u_i8x16_i16x8(u16x8 low, u16x8 high) {
913   return __builtin_wasm_narrow_u_i8x16_i16x8(low, high);
914   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.unsigned.v16i8.v8i16(
915   // WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
916   // WEBASSEMBLY: ret
917 }
918 
narrow_s_i16x8_i32x4(i32x4 low,i32x4 high)919 i16x8 narrow_s_i16x8_i32x4(i32x4 low, i32x4 high) {
920   return __builtin_wasm_narrow_s_i16x8_i32x4(low, high);
921   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.signed.v8i16.v4i32(
922   // WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
923   // WEBASSEMBLY: ret
924 }
925 
narrow_u_i16x8_i32x4(u32x4 low,u32x4 high)926 u16x8 narrow_u_i16x8_i32x4(u32x4 low, u32x4 high) {
927   return __builtin_wasm_narrow_u_i16x8_i32x4(low, high);
928   // WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.unsigned.v8i16.v4i32(
929   // WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
930   // WEBASSEMBLY: ret
931 }
932 
widen_low_s_i32x4_i64x2(i32x4 x)933 i64x2 widen_low_s_i32x4_i64x2(i32x4 x) {
934   return __builtin_wasm_widen_low_s_i32x4_i64x2(x);
935   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.widen.low.signed(<4 x i32> %x)
936   // WEBASSEMBLY: ret
937 }
938 
widen_high_s_i32x4_i64x2(i32x4 x)939 i64x2 widen_high_s_i32x4_i64x2(i32x4 x) {
940   return __builtin_wasm_widen_high_s_i32x4_i64x2(x);
941   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.widen.high.signed(<4 x i32> %x)
942   // WEBASSEMBLY: ret
943 }
944 
widen_low_u_i32x4_i64x2(u32x4 x)945 u64x2 widen_low_u_i32x4_i64x2(u32x4 x) {
946   return __builtin_wasm_widen_low_u_i32x4_i64x2(x);
947   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.widen.low.unsigned(<4 x i32> %x)
948   // WEBASSEMBLY: ret
949 }
950 
widen_high_u_i32x4_i64x2(u32x4 x)951 u64x2 widen_high_u_i32x4_i64x2(u32x4 x) {
952   return __builtin_wasm_widen_high_u_i32x4_i64x2(x);
953   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.widen.high.unsigned(<4 x i32> %x)
954   // WEBASSEMBLY: ret
955 }
956 
load32_zero(int * p)957 i32x4 load32_zero(int *p) {
958   return __builtin_wasm_load32_zero(p);
959   // WEBASSEMBLY: call <4 x i32> @llvm.wasm.load32.zero(i32* %p)
960   // WEBASSEMBLY: ret
961 }
962 
load64_zero(long long * p)963 i64x2 load64_zero(long long *p) {
964   return __builtin_wasm_load64_zero(p);
965   // WEBASSEMBLY: call <2 x i64> @llvm.wasm.load64.zero(i64* %p)
966   // WEBASSEMBLY: ret
967 }
968 
swizzle_v8x16(i8x16 x,i8x16 y)969 i8x16 swizzle_v8x16(i8x16 x, i8x16 y) {
970   return __builtin_wasm_swizzle_v8x16(x, y);
971   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.swizzle(<16 x i8> %x, <16 x i8> %y)
972 }
973 
shuffle(i8x16 x,i8x16 y)974 i8x16 shuffle(i8x16 x, i8x16 y) {
975   return __builtin_wasm_shuffle_v8x16(x, y, 0, 1, 2, 3, 4, 5, 6, 7,
976                                       8, 9, 10, 11, 12, 13, 14, 15);
977   // WEBASSEMBLY: call <16 x i8> @llvm.wasm.shuffle(<16 x i8> %x, <16 x i8> %y,
978   // WEBASSEMBLY-SAME: i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7,
979   // WEBASSEMBLY-SAME: i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14,
980   // WEBASSEMBLY-SAME: i32 15
981   // WEBASSEMBLY-NEXT: ret
982 }
983