diff options
author | Thomas Lively <tlively@google.com> | 2023-05-18 08:24:58 -0700 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2023-05-18 08:24:58 -0700 |
commit | c672c3fe05adbb590abc99da39143b55ad510538 (patch) | |
tree | e492c24adc67ad1b99906b6a95ad3311617cb30c /cross-project-tests | |
parent | 35f9fd64350e5fffba727a9cb1df336ccb39d3be (diff) | |
download | llvm-c672c3fe05adbb590abc99da39143b55ad510538.zip llvm-c672c3fe05adbb590abc99da39143b55ad510538.tar.gz llvm-c672c3fe05adbb590abc99da39143b55ad510538.tar.bz2 |
[WebAssembly] Add wasm_simd128.h intrinsics for relaxed SIMD
Add user-friendly intrinsic functions for all relaxed SIMD instructions
alongside the existing SIMD128 intrinsic functions in wasm_simd128.h. Test that
the new instrinsics lower to the expected instructions in the existing
cross-project-tests test file.
Reviewed By: aheejin, sbc100
Differential Revision: https://reviews.llvm.org/D150833
Diffstat (limited to 'cross-project-tests')
-rw-r--r-- | cross-project-tests/intrinsic-header-tests/wasm_simd128.c | 123 |
1 files changed, 122 insertions, 1 deletions
diff --git a/cross-project-tests/intrinsic-header-tests/wasm_simd128.c b/cross-project-tests/intrinsic-header-tests/wasm_simd128.c index 27426ad..fb15e01 100644 --- a/cross-project-tests/intrinsic-header-tests/wasm_simd128.c +++ b/cross-project-tests/intrinsic-header-tests/wasm_simd128.c @@ -1,7 +1,8 @@ // REQUIRES: webassembly-registered-target // expected-no-diagnostics -// RUN: %clang %s -O2 -S -o - -target wasm32-unknown-unknown -msimd128 -Wcast-qual -Werror | FileCheck %s +// RUN: %clang %s -O2 -S -o - -target wasm32-unknown-unknown \ +// RUN: -msimd128 -mrelaxed-simd -Wcast-qual -Werror | FileCheck %s #include <wasm_simd128.h> @@ -1264,3 +1265,123 @@ v128_t test_u64x2_extmul_high_u32x4(v128_t a, v128_t b) { v128_t test_i16x8_q15mulr_sat(v128_t a, v128_t b) { return wasm_i16x8_q15mulr_sat(a, b); } + +// CHECK-LABEL: test_f32x4_relaxed_madd: +// CHECK: f32x4.relaxed_madd{{$}} +v128_t test_f32x4_relaxed_madd(v128_t a, v128_t b, v128_t c) { + return wasm_f32x4_relaxed_madd(a, b, c); +} + +// CHECK-LABEL: test_f32x4_relaxed_nmadd: +// CHECK: f32x4.relaxed_nmadd{{$}} +v128_t test_f32x4_relaxed_nmadd(v128_t a, v128_t b, v128_t c) { + return wasm_f32x4_relaxed_nmadd(a, b, c); +} + +// CHECK-LABEL: test_f64x2_relaxed_madd: +// CHECK: f64x2.relaxed_madd{{$}} +v128_t test_f64x2_relaxed_madd(v128_t a, v128_t b, v128_t c) { + return wasm_f64x2_relaxed_madd(a, b, c); +} + +// CHECK-LABEL: test_f64x2_relaxed_nmadd: +// CHECK: f64x2.relaxed_nmadd{{$}} +v128_t test_f64x2_relaxed_nmadd(v128_t a, v128_t b, v128_t c) { + return wasm_f64x2_relaxed_nmadd(a, b, c); +} + +// CHECK-LABEL: test_i8x16_relaxed_laneselect: +// CHECK: i8x16.relaxed_laneselect{{$}} +v128_t test_i8x16_relaxed_laneselect(v128_t a, v128_t b, v128_t m) { + return wasm_i8x16_relaxed_laneselect(a, b, m); +} + +// CHECK-LABEL: test_i16x8_relaxed_laneselect: +// CHECK: i16x8.relaxed_laneselect{{$}} +v128_t test_i16x8_relaxed_laneselect(v128_t a, v128_t b, v128_t m) { + return wasm_i16x8_relaxed_laneselect(a, b, m); +} + +// CHECK-LABEL: test_i32x4_relaxed_laneselect: +// CHECK: i32x4.relaxed_laneselect{{$}} +v128_t test_i32x4_relaxed_laneselect(v128_t a, v128_t b, v128_t m) { + return wasm_i32x4_relaxed_laneselect(a, b, m); +} + +// CHECK-LABEL: test_i64x2_relaxed_laneselect: +// CHECK: i64x2.relaxed_laneselect{{$}} +v128_t test_i64x2_relaxed_laneselect(v128_t a, v128_t b, v128_t m) { + return wasm_i64x2_relaxed_laneselect(a, b, m); +} + +// CHECK-LABEL: test_i8x16_relaxed_swizzle: +// CHECK: i8x16.relaxed_swizzle{{$}} +v128_t test_i8x16_relaxed_swizzle(v128_t a, v128_t s) { + return wasm_i8x16_relaxed_swizzle(a, s); +} + +// CHECK-LABEL: test_f32x4_relaxed_min: +// CHECK: f32x4.relaxed_min{{$}} +v128_t test_f32x4_relaxed_min(v128_t a, v128_t b) { + return wasm_f32x4_relaxed_min(a, b); +} + +// CHECK-LABEL: test_f32x4_relaxed_max: +// CHECK: f32x4.relaxed_max{{$}} +v128_t test_f32x4_relaxed_max(v128_t a, v128_t b) { + return wasm_f32x4_relaxed_max(a, b); +} + +// CHECK-LABEL: test_f64x2_relaxed_min: +// CHECK: f64x2.relaxed_min{{$}} +v128_t test_f64x2_relaxed_min(v128_t a, v128_t b) { + return wasm_f64x2_relaxed_min(a, b); +} + +// CHECK-LABEL: test_f64x2_relaxed_max: +// CHECK: f64x2.relaxed_max +v128_t test_f64x2_relaxed_max(v128_t a, v128_t b) { + return wasm_f64x2_relaxed_max(a, b); +} + +// CHECK-LABEL: test_i32x4_relaxed_trunc_f32x4: +// CHECK: i32x4.relaxed_trunc_f32x4_s{{$}} +v128_t test_i32x4_relaxed_trunc_f32x4(v128_t a) { + return wasm_i32x4_relaxed_trunc_f32x4(a); +} + +// CHECK-LABEL: test_u32x4_relaxed_trunc_f32x4: +// CHECK: i32x4.relaxed_trunc_f32x4_u{{$}} +v128_t test_u32x4_relaxed_trunc_f32x4(v128_t a) { + return wasm_u32x4_relaxed_trunc_f32x4(a); +} + +// CHECK-LABEL: test_i32x4_relaxed_trunc_f64x2_zero: +// CHECK: i32x4.relaxed_trunc_f64x2_s_zero{{$}} +v128_t test_i32x4_relaxed_trunc_f64x2_zero(v128_t a) { + return wasm_i32x4_relaxed_trunc_f64x2_zero(a); +} + +// CHECK-LABEL: test_u32x4_relaxed_trunc_f64x2_zero: +// CHECK: i32x4.relaxed_trunc_f64x2_u_zero{{$}} +v128_t test_u32x4_relaxed_trunc_f64x2_zero(v128_t a) { + return wasm_u32x4_relaxed_trunc_f64x2_zero(a); +} + +// CHECK-LABEL: test_i16x8_relaxed_q15mulr: +// CHECK: i16x8.relaxed_q15mulr_s{{$}} +v128_t test_i16x8_relaxed_q15mulr(v128_t a, v128_t b) { + return wasm_i16x8_relaxed_q15mulr(a, b); +} + +// CHECK-LABEL: test_i16x8_relaxed_dot_i8x16_i7x16: +// CHECK: i16x8.relaxed_dot_i8x16_i7x16_s{{$}} +v128_t test_i16x8_relaxed_dot_i8x16_i7x16(v128_t a, v128_t b) { + return wasm_i16x8_relaxed_dot_i8x16_i7x16(a, b); +} + +// CHECK-LABEL: test_i32x4_relaxed_dot_i8x16_i7x16_add: +// CHECK: i32x4.relaxed_dot_i8x16_i7x16_add_s{{$}} +v128_t test_i32x4_relaxed_dot_i8x16_i7x16_add(v128_t a, v128_t b, v128_t c) { + return wasm_i32x4_relaxed_dot_i8x16_i7x16_add(a, b, c); +} |