2019-09-13 14:02:15 +08:00
|
|
|
// RUN: %clang_cc1 -triple wasm32-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY32
|
|
|
|
// RUN: %clang_cc1 -triple wasm64-unknown-unknown -target-feature +unimplemented-simd128 -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s | FileCheck %s -check-prefixes WEBASSEMBLY,WEBASSEMBLY64
|
|
|
|
// RUN: not %clang_cc1 -triple wasm64-unknown-unknown -target-feature +nontrapping-fptoint -target-feature +exception-handling -target-feature +bulk-memory -flax-vector-conversions=none -O3 -emit-llvm -o - %s 2>&1 | FileCheck %s -check-prefixes MISSING-SIMD
|
2018-10-05 08:54:44 +08:00
|
|
|
|
|
|
|
// SIMD convenience types
|
|
|
|
typedef char i8x16 __attribute((vector_size(16)));
|
|
|
|
typedef short i16x8 __attribute((vector_size(16)));
|
|
|
|
typedef int i32x4 __attribute((vector_size(16)));
|
|
|
|
typedef long long i64x2 __attribute((vector_size(16)));
|
|
|
|
typedef unsigned char u8x16 __attribute((vector_size(16)));
|
|
|
|
typedef unsigned short u16x8 __attribute((vector_size(16)));
|
|
|
|
typedef unsigned int u32x4 __attribute((vector_size(16)));
|
|
|
|
typedef unsigned long long u64x2 __attribute((vector_size(16)));
|
|
|
|
typedef float f32x4 __attribute((vector_size(16)));
|
|
|
|
typedef double f64x2 __attribute((vector_size(16)));
|
2015-09-04 06:51:53 +08:00
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
__SIZE_TYPE__ memory_size(void) {
|
2018-06-01 08:05:51 +08:00
|
|
|
return __builtin_wasm_memory_size(0);
|
2018-09-01 04:57:00 +08:00
|
|
|
// WEBASSEMBLY32: call {{i.*}} @llvm.wasm.memory.size.i32(i32 0)
|
|
|
|
// WEBASSEMBLY64: call {{i.*}} @llvm.wasm.memory.size.i64(i32 0)
|
2018-06-01 08:05:51 +08:00
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
__SIZE_TYPE__ memory_grow(__SIZE_TYPE__ delta) {
|
2018-06-01 08:05:51 +08:00
|
|
|
return __builtin_wasm_memory_grow(0, delta);
|
2018-09-01 04:57:00 +08:00
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.memory.grow.i32(i32 0, i32 %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call i64 @llvm.wasm.memory.grow.i64(i32 0, i64 %{{.*}})
|
2018-06-01 08:05:51 +08:00
|
|
|
}
|
|
|
|
|
2019-02-14 06:11:16 +08:00
|
|
|
void memory_init(void *dest, int offset, int size) {
|
|
|
|
__builtin_wasm_memory_init(3, 0, dest, offset, size);
|
|
|
|
// WEBASSEMBLY32: call void @llvm.wasm.memory.init(i32 3, i32 0, i8* %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call void @llvm.wasm.memory.init(i32 3, i32 0, i8* %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
|
|
|
|
}
|
|
|
|
|
|
|
|
void data_drop() {
|
|
|
|
__builtin_wasm_data_drop(3);
|
|
|
|
// WEBASSEMBLY32: call void @llvm.wasm.data.drop(i32 3)
|
|
|
|
// WEBASSEMBLY64: call void @llvm.wasm.data.drop(i32 3)
|
|
|
|
}
|
|
|
|
|
[WebAssembly] Implement thread-local storage (local-exec model)
Summary:
Thread local variables are placed inside a `.tdata` segment. Their symbols are
offsets from the start of the segment. The address of a thread local variable
is computed as `__tls_base` + the offset from the start of the segment.
`.tdata` segment is a passive segment and `memory.init` is used once per thread
to initialize the thread local storage.
`__tls_base` is a wasm global. Since each thread has its own wasm instance,
it is effectively thread local. Currently, `__tls_base` must be initialized
at thread startup, and so cannot be used with dynamic libraries.
`__tls_base` is to be initialized with a new linker-synthesized function,
`__wasm_init_tls`, which takes as an argument a block of memory to use as the
storage for thread locals. It then initializes the block of memory and sets
`__tls_base`. As `__wasm_init_tls` will handle the memory initialization,
the memory does not have to be zeroed.
To help allocating memory for thread-local storage, a new compiler intrinsic
is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns
the size of the thread-local storage for the current function.
The expected usage is to run something like the following upon thread startup:
__wasm_init_tls(malloc(__builtin_wasm_tls_size()));
Reviewers: tlively, aheejin, kripken, sbc100
Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, jfb, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D64537
llvm-svn: 366272
2019-07-17 06:00:45 +08:00
|
|
|
__SIZE_TYPE__ tls_size() {
|
|
|
|
return __builtin_wasm_tls_size();
|
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.tls.size.i32()
|
|
|
|
// WEBASSEMBLY64: call i64 @llvm.wasm.tls.size.i64()
|
|
|
|
}
|
|
|
|
|
[WebAssembly] Compute and export TLS block alignment
Summary:
Add immutable WASM global `__tls_align` which stores the alignment
requirements of the TLS segment.
Add `__builtin_wasm_tls_align()` intrinsic to get this alignment in Clang.
The expected usage has now changed to:
__wasm_init_tls(memalign(__builtin_wasm_tls_align(),
__builtin_wasm_tls_size()));
Reviewers: tlively, aheejin, sbc100, sunfish, alexcrichton
Reviewed By: tlively
Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65028
llvm-svn: 366624
2019-07-20 07:34:16 +08:00
|
|
|
__SIZE_TYPE__ tls_align() {
|
|
|
|
return __builtin_wasm_tls_align();
|
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.tls.align.i32()
|
|
|
|
// WEBASSEMBLY64: call i64 @llvm.wasm.tls.align.i64()
|
|
|
|
}
|
|
|
|
|
2019-07-19 01:53:22 +08:00
|
|
|
void *tls_base() {
|
|
|
|
return __builtin_wasm_tls_base();
|
|
|
|
// WEBASSEMBLY: call i8* @llvm.wasm.tls.base()
|
|
|
|
}
|
|
|
|
|
2019-03-19 12:58:59 +08:00
|
|
|
void throw(void *obj) {
|
|
|
|
return __builtin_wasm_throw(0, obj);
|
|
|
|
// WEBASSEMBLY32: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call void @llvm.wasm.throw(i32 0, i8* %{{.*}})
|
2017-06-30 08:44:01 +08:00
|
|
|
}
|
2017-09-16 09:07:43 +08:00
|
|
|
|
2019-03-16 13:39:12 +08:00
|
|
|
void rethrow_in_catch(void) {
|
|
|
|
return __builtin_wasm_rethrow_in_catch();
|
|
|
|
// WEBASSEMBLY32: call void @llvm.wasm.rethrow.in.catch()
|
|
|
|
// WEBASSEMBLY64: call void @llvm.wasm.rethrow.in.catch()
|
2017-09-16 09:07:43 +08:00
|
|
|
}
|
2018-08-03 05:44:40 +08:00
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int atomic_wait_i32(int *addr, int expected, long long timeout) {
|
2018-08-03 05:44:40 +08:00
|
|
|
return __builtin_wasm_atomic_wait_i32(addr, expected, timeout);
|
2018-09-01 04:57:00 +08:00
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i32(i32* %{{.*}}, i32 %{{.*}}, i64 %{{.*}})
|
2018-08-03 05:44:40 +08:00
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int atomic_wait_i64(long long *addr, long long expected, long long timeout) {
|
2018-08-03 05:44:40 +08:00
|
|
|
return __builtin_wasm_atomic_wait_i64(addr, expected, timeout);
|
2018-09-01 04:57:00 +08:00
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.wait.i64(i64* %{{.*}}, i64 %{{.*}}, i64 %{{.*}})
|
2018-08-03 05:44:40 +08:00
|
|
|
}
|
|
|
|
|
2018-11-16 08:48:58 +08:00
|
|
|
unsigned int atomic_notify(int *addr, unsigned int count) {
|
2018-08-03 05:44:40 +08:00
|
|
|
return __builtin_wasm_atomic_notify(addr, count);
|
2018-09-01 04:57:00 +08:00
|
|
|
// WEBASSEMBLY32: call i32 @llvm.wasm.atomic.notify(i32* %{{.*}}, i32 %{{.*}})
|
|
|
|
// WEBASSEMBLY64: call i32 @llvm.wasm.atomic.notify(i32* %{{.*}}, i32 %{{.*}})
|
2018-08-03 05:44:40 +08:00
|
|
|
}
|
2018-10-05 08:54:44 +08:00
|
|
|
|
2018-10-11 08:07:55 +08:00
|
|
|
int trunc_saturate_s_i32_f32(float f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i32_f32(f);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
int trunc_saturate_u_i32_f32(float f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i32_f32(f);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.unsigned.i32.f32(float %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
int trunc_saturate_s_i32_f64(double f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i32_f64(f);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.signed.i32.f64(double %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
int trunc_saturate_u_i32_f64(double f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i32_f64(f);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.unsigned.i32.f64(double %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
long long trunc_saturate_s_i64_f32(float f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i64_f32(f);
|
|
|
|
// WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.signed.i64.f32(float %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
long long trunc_saturate_u_i64_f32(float f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i64_f32(f);
|
|
|
|
// WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.unsigned.i64.f32(float %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
long long trunc_saturate_s_i64_f64(double f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i64_f64(f);
|
|
|
|
// WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.signed.i64.f64(double %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
long long trunc_saturate_u_i64_f64(double f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i64_f64(f);
|
|
|
|
// WEBASSEMBLY: call i64 @llvm.wasm.trunc.saturate.unsigned.i64.f64(double %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-26 03:11:41 +08:00
|
|
|
float min_f32(float x, float y) {
|
|
|
|
return __builtin_wasm_min_f32(x, y);
|
|
|
|
// WEBASSEMBLY: call float @llvm.minimum.f32(float %x, float %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
float max_f32(float x, float y) {
|
|
|
|
return __builtin_wasm_max_f32(x, y);
|
|
|
|
// WEBASSEMBLY: call float @llvm.maximum.f32(float %x, float %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
double min_f64(double x, double y) {
|
|
|
|
return __builtin_wasm_min_f64(x, y);
|
|
|
|
// WEBASSEMBLY: call double @llvm.minimum.f64(double %x, double %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
double max_f64(double x, double y) {
|
|
|
|
return __builtin_wasm_max_f64(x, y);
|
|
|
|
// WEBASSEMBLY: call double @llvm.maximum.f64(double %x, double %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int extract_lane_s_i8x16(i8x16 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_s_i8x16(v, 13);
|
2019-01-11 07:49:00 +08:00
|
|
|
// MISSING-SIMD: error: '__builtin_wasm_extract_lane_s_i8x16' needs target feature simd128
|
2018-10-05 08:54:44 +08:00
|
|
|
// WEBASSEMBLY: extractelement <16 x i8> %v, i32 13
|
|
|
|
// WEBASSEMBLY-NEXT: sext
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int extract_lane_u_i8x16(i8x16 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_u_i8x16(v, 13);
|
|
|
|
// WEBASSEMBLY: extractelement <16 x i8> %v, i32 13
|
|
|
|
// WEBASSEMBLY-NEXT: zext
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int extract_lane_s_i16x8(i16x8 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_s_i16x8(v, 7);
|
|
|
|
// WEBASSEMBLY: extractelement <8 x i16> %v, i32 7
|
|
|
|
// WEBASSEMBLY-NEXT: sext
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int extract_lane_u_i16x8(i16x8 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_u_i16x8(v, 7);
|
|
|
|
// WEBASSEMBLY: extractelement <8 x i16> %v, i32 7
|
|
|
|
// WEBASSEMBLY-NEXT: zext
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int extract_lane_i32x4(i32x4 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_i32x4(v, 3);
|
|
|
|
// WEBASSEMBLY: extractelement <4 x i32> %v, i32 3
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
long long extract_lane_i64x2(i64x2 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_i64x2(v, 1);
|
|
|
|
// WEBASSEMBLY: extractelement <2 x i64> %v, i32 1
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
float extract_lane_f32x4(f32x4 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_f32x4(v, 3);
|
|
|
|
// WEBASSEMBLY: extractelement <4 x float> %v, i32 3
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
double extract_lane_f64x2(f64x2 v) {
|
2018-10-05 08:54:44 +08:00
|
|
|
return __builtin_wasm_extract_lane_f64x2(v, 1);
|
|
|
|
// WEBASSEMBLY: extractelement <2 x double> %v, i32 1
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
2018-10-05 08:58:07 +08:00
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i8x16 replace_lane_i8x16(i8x16 v, int x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_i8x16(v, 13, x);
|
|
|
|
// WEBASSEMBLY: trunc i32 %x to i8
|
|
|
|
// WEBASSEMBLY-NEXT: insertelement <16 x i8> %v, i8 %{{.*}}, i32 13
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i16x8 replace_lane_i16x8(i16x8 v, int x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_i16x8(v, 7, x);
|
|
|
|
// WEBASSEMBLY: trunc i32 %x to i16
|
|
|
|
// WEBASSEMBLY-NEXT: insertelement <8 x i16> %v, i16 %{{.*}}, i32 7
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i32x4 replace_lane_i32x4(i32x4 v, int x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_i32x4(v, 3, x);
|
|
|
|
// WEBASSEMBLY: insertelement <4 x i32> %v, i32 %x, i32 3
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i64x2 replace_lane_i64x2(i64x2 v, long long x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_i64x2(v, 1, x);
|
|
|
|
// WEBASSEMBLY: insertelement <2 x i64> %v, i64 %x, i32 1
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f32x4 replace_lane_f32x4(f32x4 v, float x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_f32x4(v, 3, x);
|
|
|
|
// WEBASSEMBLY: insertelement <4 x float> %v, float %x, i32 3
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f64x2 replace_lane_f64x2(f64x2 v, double x) {
|
2018-10-05 08:58:07 +08:00
|
|
|
return __builtin_wasm_replace_lane_f64x2(v, 1, x);
|
|
|
|
// WEBASSEMBLY: insertelement <2 x double> %v, double %x, i32 1
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
2018-10-05 08:58:56 +08:00
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i8x16 add_saturate_s_i8x16(i8x16 x, i8x16 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_add_saturate_s_i8x16(x, y);
|
2018-10-26 03:06:15 +08:00
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.sadd.sat.v16i8(
|
2018-10-05 08:58:56 +08:00
|
|
|
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i8x16 add_saturate_u_i8x16(i8x16 x, i8x16 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_add_saturate_u_i8x16(x, y);
|
2018-10-26 03:06:15 +08:00
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.uadd.sat.v16i8(
|
2018-10-05 08:58:56 +08:00
|
|
|
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i16x8 add_saturate_s_i16x8(i16x8 x, i16x8 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_add_saturate_s_i16x8(x, y);
|
2018-10-26 03:06:15 +08:00
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.sadd.sat.v8i16(
|
2018-10-05 08:58:56 +08:00
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i16x8 add_saturate_u_i16x8(i16x8 x, i16x8 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_add_saturate_u_i16x8(x, y);
|
2018-10-26 03:06:15 +08:00
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.uadd.sat.v8i16(
|
2018-10-05 08:58:56 +08:00
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i8x16 sub_saturate_s_i8x16(i8x16 x, i8x16 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_sub_saturate_s_i8x16(x, y);
|
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.signed.v16i8(
|
|
|
|
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i8x16 sub_saturate_u_i8x16(i8x16 x, i8x16 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_sub_saturate_u_i8x16(x, y);
|
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.wasm.sub.saturate.unsigned.v16i8(
|
|
|
|
// WEBASSEMBLY-SAME: <16 x i8> %x, <16 x i8> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i16x8 sub_saturate_s_i16x8(i16x8 x, i16x8 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_sub_saturate_s_i16x8(x, y);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.signed.v8i16(
|
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
i16x8 sub_saturate_u_i16x8(i16x8 x, i16x8 y) {
|
2018-10-05 08:58:56 +08:00
|
|
|
return __builtin_wasm_sub_saturate_u_i16x8(x, y);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.sub.saturate.unsigned.v8i16(
|
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %x, <8 x i16> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
2018-10-05 08:59:37 +08:00
|
|
|
|
2018-10-26 03:11:41 +08:00
|
|
|
i32x4 bitselect(i32x4 x, i32x4 y, i32x4 c) {
|
|
|
|
return __builtin_wasm_bitselect(x, y, c);
|
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.bitselect.v4i32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x i32> %x, <4 x i32> %y, <4 x i32> %c)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int any_true_i8x16(i8x16 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_any_true_i8x16(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v16i8(<16 x i8> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int any_true_i16x8(i16x8 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_any_true_i16x8(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v8i16(<8 x i16> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int any_true_i32x4(i32x4 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_any_true_i32x4(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v4i32(<4 x i32> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int any_true_i64x2(i64x2 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_any_true_i64x2(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.anytrue.v2i64(<2 x i64> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int all_true_i8x16(i8x16 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_all_true_i8x16(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v16i8(<16 x i8> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int all_true_i16x8(i16x8 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_all_true_i16x8(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v8i16(<8 x i16> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int all_true_i32x4(i32x4 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_all_true_i32x4(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v4i32(<4 x i32> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
int all_true_i64x2(i64x2 x) {
|
2018-10-05 08:59:37 +08:00
|
|
|
return __builtin_wasm_all_true_i64x2(x);
|
|
|
|
// WEBASSEMBLY: call i32 @llvm.wasm.alltrue.v2i64(<2 x i64> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
2018-10-05 09:02:54 +08:00
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f32x4 abs_f32x4(f32x4 x) {
|
2018-10-05 09:02:54 +08:00
|
|
|
return __builtin_wasm_abs_f32x4(x);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f64x2 abs_f64x2(f64x2 x) {
|
2018-10-05 09:02:54 +08:00
|
|
|
return __builtin_wasm_abs_f64x2(x);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-26 03:11:41 +08:00
|
|
|
f32x4 min_f32x4(f32x4 x, f32x4 y) {
|
|
|
|
return __builtin_wasm_min_f32x4(x, y);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.minimum.v4f32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f32x4 max_f32x4(f32x4 x, f32x4 y) {
|
|
|
|
return __builtin_wasm_max_f32x4(x, y);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.maximum.v4f32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x float> %x, <4 x float> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f64x2 min_f64x2(f64x2 x, f64x2 y) {
|
|
|
|
return __builtin_wasm_min_f64x2(x, y);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.minimum.v2f64(
|
|
|
|
// WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f64x2 max_f64x2(f64x2 x, f64x2 y) {
|
|
|
|
return __builtin_wasm_max_f64x2(x, y);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.maximum.v2f64(
|
|
|
|
// WEBASSEMBLY-SAME: <2 x double> %x, <2 x double> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f32x4 sqrt_f32x4(f32x4 x) {
|
2018-10-05 09:02:54 +08:00
|
|
|
return __builtin_wasm_sqrt_f32x4(x);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
2018-10-09 08:42:13 +08:00
|
|
|
f64x2 sqrt_f64x2(f64x2 x) {
|
2018-10-05 09:02:54 +08:00
|
|
|
return __builtin_wasm_sqrt_f64x2(x);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
2018-10-11 08:07:55 +08:00
|
|
|
|
2019-08-31 08:12:29 +08:00
|
|
|
f32x4 qfma_f32x4(f32x4 a, f32x4 b, f32x4 c) {
|
|
|
|
return __builtin_wasm_qfma_f32x4(a, b, c);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.wasm.qfma.v4f32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x float> %a, <4 x float> %b, <4 x float> %c)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f32x4 qfms_f32x4(f32x4 a, f32x4 b, f32x4 c) {
|
|
|
|
return __builtin_wasm_qfms_f32x4(a, b, c);
|
|
|
|
// WEBASSEMBLY: call <4 x float> @llvm.wasm.qfms.v4f32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x float> %a, <4 x float> %b, <4 x float> %c)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f64x2 qfma_f64x2(f64x2 a, f64x2 b, f64x2 c) {
|
|
|
|
return __builtin_wasm_qfma_f64x2(a, b, c);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.wasm.qfma.v2f64(
|
|
|
|
// WEBASSEMBLY-SAME: <2 x double> %a, <2 x double> %b, <2 x double> %c)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
f64x2 qfms_f64x2(f64x2 a, f64x2 b, f64x2 c) {
|
|
|
|
return __builtin_wasm_qfms_f64x2(a, b, c);
|
|
|
|
// WEBASSEMBLY: call <2 x double> @llvm.wasm.qfms.v2f64(
|
|
|
|
// WEBASSEMBLY-SAME: <2 x double> %a, <2 x double> %b, <2 x double> %c)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-11-01 09:03:17 +08:00
|
|
|
i32x4 trunc_saturate_s_i32x4_f32x4(f32x4 f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i32x4_f32x4(f);
|
2018-10-11 08:07:55 +08:00
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.trunc.saturate.signed.v4i32.v4f32(<4 x float> %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-11-01 09:03:17 +08:00
|
|
|
i32x4 trunc_saturate_u_i32x4_f32x4(f32x4 f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i32x4_f32x4(f);
|
2018-10-11 08:07:55 +08:00
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.trunc.saturate.unsigned.v4i32.v4f32(<4 x float> %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-11-01 09:03:17 +08:00
|
|
|
i64x2 trunc_saturate_s_i64x2_f64x2(f64x2 f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_s_i64x2_f64x2(f);
|
2018-10-11 08:07:55 +08:00
|
|
|
// WEBASSEMBLY: call <2 x i64> @llvm.wasm.trunc.saturate.signed.v2i64.v2f64(<2 x double> %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
|
|
|
|
2018-11-01 09:03:17 +08:00
|
|
|
i64x2 trunc_saturate_u_i64x2_f64x2(f64x2 f) {
|
|
|
|
return __builtin_wasm_trunc_saturate_u_i64x2_f64x2(f);
|
2018-10-11 08:07:55 +08:00
|
|
|
// WEBASSEMBLY: call <2 x i64> @llvm.wasm.trunc.saturate.unsigned.v2i64.v2f64(<2 x double> %f)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|
2019-09-14 06:54:41 +08:00
|
|
|
|
|
|
|
i8x16 narrow_s_i8x16_i16x8(i16x8 low, i16x8 high) {
|
|
|
|
return __builtin_wasm_narrow_s_i8x16_i16x8(low, high);
|
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.signed.v16i8.v8i16(
|
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i8x16 narrow_u_i8x16_i16x8(i16x8 low, i16x8 high) {
|
|
|
|
return __builtin_wasm_narrow_u_i8x16_i16x8(low, high);
|
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.wasm.narrow.unsigned.v16i8.v8i16(
|
|
|
|
// WEBASSEMBLY-SAME: <8 x i16> %low, <8 x i16> %high)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 narrow_s_i16x8_i32x4(i32x4 low, i32x4 high) {
|
|
|
|
return __builtin_wasm_narrow_s_i16x8_i32x4(low, high);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.signed.v8i16.v4i32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 narrow_u_i16x8_i32x4(i32x4 low, i32x4 high) {
|
|
|
|
return __builtin_wasm_narrow_u_i16x8_i32x4(low, high);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.narrow.unsigned.v8i16.v4i32(
|
|
|
|
// WEBASSEMBLY-SAME: <4 x i32> %low, <4 x i32> %high)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 widen_low_s_i16x8_i8x16(i8x16 v) {
|
|
|
|
return __builtin_wasm_widen_low_s_i16x8_i8x16(v);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.widen.low.signed.v8i16.v16i8(<16 x i8> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 widen_high_s_i16x8_i8x16(i8x16 v) {
|
|
|
|
return __builtin_wasm_widen_high_s_i16x8_i8x16(v);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.widen.high.signed.v8i16.v16i8(<16 x i8> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 widen_low_u_i16x8_i8x16(i8x16 v) {
|
|
|
|
return __builtin_wasm_widen_low_u_i16x8_i8x16(v);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.widen.low.unsigned.v8i16.v16i8(<16 x i8> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i16x8 widen_high_u_i16x8_i8x16(i8x16 v) {
|
|
|
|
return __builtin_wasm_widen_high_u_i16x8_i8x16(v);
|
|
|
|
// WEBASSEMBLY: call <8 x i16> @llvm.wasm.widen.high.unsigned.v8i16.v16i8(<16 x i8> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i32x4 widen_low_s_i32x4_i16x8(i16x8 v) {
|
|
|
|
return __builtin_wasm_widen_low_s_i32x4_i16x8(v);
|
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.widen.low.signed.v4i32.v8i16(<8 x i16> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i32x4 widen_high_s_i32x4_i16x8(i16x8 v) {
|
|
|
|
return __builtin_wasm_widen_high_s_i32x4_i16x8(v);
|
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.widen.high.signed.v4i32.v8i16(<8 x i16> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i32x4 widen_low_u_i32x4_i16x8(i16x8 v) {
|
|
|
|
return __builtin_wasm_widen_low_u_i32x4_i16x8(v);
|
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.widen.low.unsigned.v4i32.v8i16(<8 x i16> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
i32x4 widen_high_u_i32x4_i16x8(i16x8 v) {
|
|
|
|
return __builtin_wasm_widen_high_u_i32x4_i16x8(v);
|
|
|
|
// WEBASSEMBLY: call <4 x i32> @llvm.wasm.widen.high.unsigned.v4i32.v8i16(<8 x i16> %v)
|
|
|
|
// WEBASSEMBLY: ret
|
|
|
|
}
|
2019-10-10 01:45:47 +08:00
|
|
|
|
|
|
|
i8x16 swizzle_v8x16(i8x16 x, i8x16 y) {
|
|
|
|
return __builtin_wasm_swizzle_v8x16(x, y);
|
|
|
|
// WEBASSEMBLY: call <16 x i8> @llvm.wasm.swizzle(<16 x i8> %x, <16 x i8> %y)
|
|
|
|
// WEBASSEMBLY-NEXT: ret
|
|
|
|
}
|