diff --git a/system/include/wasm_simd128.h b/system/include/wasm_simd128.h index f1e07cee0cb18..4ed3106f9f4a6 100644 --- a/system/include/wasm_simd128.h +++ b/system/include/wasm_simd128.h @@ -172,8 +172,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_make(float c0, float c1, return (v128_t)(__f32x4){c0, c1, c2, c3}; } -#ifdef __wasm_unimplemented_simd128__ - // wasm_i64x2_make(...) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_make(int64_t c0, int64_t c1) { return (v128_t)(__i64x2){c0, c1}; @@ -184,8 +182,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double c0, double c1 return (v128_t)(__f64x2){c0, c1}; } -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_i8x16_constant(...) #define wasm_i8x16_const(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15) \ __extension__({ \ @@ -222,7 +218,7 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double c0, double c1 (v128_t)(__i16x8){c0, c1, c2, c3, c4, c5, c6, c7}; \ }) -// v128_t wasm_i32x4_constant(...) +// v128_t wasm_i32x4_const(...) #define wasm_i32x4_const(c0, c1, c2, c3) \ __extension__({ \ __REQUIRE_CONSTANT(c0); \ @@ -242,8 +238,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double c0, double c1 (v128_t)(__f32x4){c0, c1, c2, c3}; \ }) -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_i64x2_constant(...) #define wasm_i64x2_const(c0, c1) \ __extension__({ \ @@ -260,8 +254,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double c0, double c1 (v128_t)(__f64x2){c0, c1}; \ }) -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_i8x16_splat(int8_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_splat(int8_t a) { return (v128_t)(__i8x16){a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a}; @@ -285,13 +277,9 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_splat(int16_t a) { // int16_t wasm_i16x8_extract_lane(v128_t a, imm i) #define wasm_i16x8_extract_lane(a, i) (__builtin_wasm_extract_lane_s_i16x8((__i16x8)(a), i)) -#ifdef __wasm_unimplemented_simd128__ - // int16_t wasm_u16x8_extract_lane(v128_t a, imm i) #define wasm_u16x8_extract_lane(a, i) (__builtin_wasm_extract_lane_u_i16x8((__i16x8)(a), i)) -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_i16x8_replace_lane(v128_t a, imm i, int16_t b) #define wasm_i16x8_replace_lane(a, i, b) \ ((v128_t)__builtin_wasm_replace_lane_i16x8((__i16x8)(a), i, b)) @@ -308,15 +296,11 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_splat(int32_t a) { #define wasm_i32x4_replace_lane(a, i, b) \ ((v128_t)__builtin_wasm_replace_lane_i32x4((__i32x4)(a), i, b)) -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_i64x2_splat(int64_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_splat(int64_t a) { return (v128_t)(__i64x2){a, a}; } -#endif // __wasm_unimplemented_simd128__ - // int64_t wasm_i64x2_extract_lane(v128_t a, imm i) #define wasm_i64x2_extract_lane(a, i) (__builtin_wasm_extract_lane_i64x2((__i64x2)(a), i)) @@ -336,8 +320,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_splat(float a) { #define wasm_f32x4_replace_lane(a, i, b) \ ((v128_t)__builtin_wasm_replace_lane_f32x4((__f32x4)(a), i, b)) -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_f64x2_splat(double a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_splat(double a) { return (v128_t)(__f64x2){a, a}; @@ -350,8 +332,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_splat(double a) { #define wasm_f64x2_replace_lane(a, i, b) \ ((v128_t)__builtin_wasm_replace_lane_f64x2((__f64x2)(a), i, b)) -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_i8x16_eq(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_eq(v128_t a, v128_t b) { return (v128_t)((__i8x16)a == (__i8x16)b); @@ -532,8 +512,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_ge(v128_t a, v128_t b) { return (v128_t)((__f32x4)a >= (__f32x4)b); } -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_f64x2_eq(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_eq(v128_t a, v128_t b) { return (v128_t)((__f64x2)a == (__f64x2)b); @@ -564,8 +542,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_ge(v128_t a, v128_t b) { return (v128_t)((__f64x2)a >= (__f64x2)b); } -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_v128_not(v128 a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_not(v128_t a) { return ~a; } @@ -752,15 +728,11 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_max_u(v128_t a, v128_t b) }; } -#ifdef __wasm_unimplemented_simd__ - // v128_t wasm_i8x16_avgr_u(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_avgr_u(v128_t a, v128_t b) { return (v128_t)__builtin_wasm_avgr_u_i8x16((__i8x16)a, (__i8x16)b); } -#endif // __wasm_unimplemented_simd__ - // v128_t wasm_i16x8_neg(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_neg(v128_t a) { return (v128_t)(-(__u16x8)a); @@ -890,15 +862,11 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_max_u(v128_t a, v128_t b) }; } -#ifdef __wasm_unimplemented_simd__ - // v128_t wasm_i16x8_avgr_u(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i16x8_avgr_u(v128_t a, v128_t b) { return (v128_t)__builtin_wasm_avgr_u_i16x8((__i16x8)a, (__i16x8)b); } -#endif // __wasm_unimplemented_simd__ - // v128_t wasm_i32x4_neg(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_neg(v128_t a) { return (v128_t)(-(__u32x4)a); @@ -992,13 +960,13 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_max_u(v128_t a, v128_t b) }; } -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_i64x2_neg(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_neg(v128_t a) { return (v128_t)(-(__u64x2)a); } +#ifdef __wasm_unimplemented_simd128__ + // bool wasm_i64x2_any_true(v128_t a) static __inline__ bool __DEFAULT_FN_ATTRS wasm_i64x2_any_true(v128_t a) { return __builtin_wasm_any_true_i64x2((__i64x2)a); @@ -1009,6 +977,8 @@ static __inline__ bool __DEFAULT_FN_ATTRS wasm_i64x2_all_true(v128_t a) { return __builtin_wasm_all_true_i64x2((__i64x2)a); } +#endif // __wasm_unimplemented_simd128__ + // v128_t wasm_i64x2_shl(v128_t a, int32_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_shl(v128_t a, int32_t b) { return (v128_t)((__i64x2)a << (int64_t)b); @@ -1034,8 +1004,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i64x2_sub(v128_t a, v128_t b) { return (v128_t)((__u64x2)a - (__u64x2)b); } -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_f32x4_abs(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_abs(v128_t a) { return (v128_t)__builtin_wasm_abs_f32x4((__f32x4)a); @@ -1051,6 +1019,8 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_sqrt(v128_t a) { return (v128_t)__builtin_wasm_sqrt_f32x4((__f32x4)a); } +#ifdef __wasm_unimplemented_simd128__ + // v128_t wasm_f32x4_qfma(v128_t a, v128_t b, v128_t c) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_qfma(v128_t a, v128_t b, v128_t c) { return (v128_t) __builtin_wasm_qfma_f32x4((__f32x4)a, (__f32x4)b, (__f32x4)c); @@ -1061,6 +1031,8 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_qfms(v128_t a, v128_t b, return (v128_t) __builtin_wasm_qfms_f32x4((__f32x4)a, (__f32x4)b, (__f32x4)c); } +#endif // __wasm_unimplemented_simd128__ + // v128_t wasm_f32x4_add(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_add(v128_t a, v128_t b) { return (v128_t)((__f32x4)a + (__f32x4)b); @@ -1091,8 +1063,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f32x4_max(v128_t a, v128_t b) { return (v128_t)__builtin_wasm_max_f32x4((__f32x4)a, (__f32x4)b); } -#ifdef __wasm_unimplemented_simd128__ - // v128_t wasm_f64x2_abs(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_abs(v128_t a) { return (v128_t)__builtin_wasm_abs_f64x2((__f64x2)a); @@ -1108,6 +1078,8 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_sqrt(v128_t a) { return (v128_t)__builtin_wasm_sqrt_f64x2((__f64x2)a); } +#ifdef __wasm_unimplemented_simd128__ + // v128_t wasm_f64x2_qfma(v128_t a, v128_t b, v128_t c) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_qfma(v128_t a, v128_t b, v128_t c) { return (v128_t) __builtin_wasm_qfma_f64x2((__f64x2)a, (__f64x2)b, (__f64x2)c); @@ -1118,6 +1090,8 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_qfms(v128_t a, v128_t b, return (v128_t) __builtin_wasm_qfms_f64x2((__f64x2)a, (__f64x2)b, (__f64x2)c); } +#endif // __wasm_unimplemented_simd128__ + // v128_t wasm_f64x2_add(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_add(v128_t a, v128_t b) { return (v128_t)((__f64x2)a + (__f64x2)b); @@ -1148,8 +1122,6 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_max(v128_t a, v128_t b) { return (v128_t)__builtin_wasm_max_f64x2((__f64x2)a, (__f64x2)b); } -#endif // __wasm_unimplemented_simd128__ - // v128_t wasm_i32x4_trunc_saturate_f32x4(v128_t a) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i32x4_trunc_saturate_f32x4(v128_t a) { return (v128_t)__builtin_wasm_trunc_saturate_s_i32x4_f32x4((__f32x4)a); @@ -1204,11 +1176,15 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_convert_u64x2(v128_t a) { ((v128_t)(__builtin_shufflevector((__u8x16)(a), (__u8x16)(b), c0, c1, c2, c3, c4, c5, c6, c7, \ c8, c9, c10, c11, c12, c13, c14, c15))) +#ifdef __wasm_unimplemented_simd128__ + // v128_t wasm_v8x16_swizzle(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v8x16_swizzle(v128_t a, v128_t b) { return (v128_t)__builtin_wasm_swizzle_v8x16((__i8x16)a, (__i8x16)b); } +#endif // __wasm_unimplemented_simd128__ + // v128_t wasm_i8x16_narrow_i16x8(v128_t a, v128_t b) static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_narrow_i16x8(v128_t a, v128_t b) { return (v128_t) __builtin_wasm_narrow_s_i8x16_i16x8((__i16x8)a, (__i16x8)b); diff --git a/tests/test_core.py b/tests/test_core.py index 1bb1f0b739fcf..2e8b667d449f2 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5954,7 +5954,6 @@ def test_relocatable_void_function(self): self.do_run_in_out_file_test('tests', 'core', 'test_relocatable_void_function') @wasm_simd - @unittest.skip("Temporarily disabled to update LLVM") def test_wasm_builtin_simd(self, js_engines): self.do_run(open(path_from_root('tests', 'test_wasm_builtin_simd.c')).read(), 'Success!', js_engines=js_engines) @@ -5963,7 +5962,6 @@ def test_wasm_builtin_simd(self, js_engines): self.get_dir(), os.path.join(self.get_dir(), 'src.cpp')) @wasm_simd - @unittest.skip("Temporarily disabled to update LLVM") def test_wasm_intrinsics_simd(self, js_engines): self.emcc_args.extend(['-Wpedantic', '-Werror', '-Wall']) self.do_run(open(path_from_root('tests', 'test_wasm_intrinsics_simd.c')).read(), 'Success!', diff --git a/tests/test_wasm_builtin_simd.c b/tests/test_wasm_builtin_simd.c index f058da0f7c88f..8a8740d67b639 100644 --- a/tests/test_wasm_builtin_simd.c +++ b/tests/test_wasm_builtin_simd.c @@ -83,14 +83,12 @@ int32_t TESTFN i8x16_extract_lane_s_first(i8x16 vec) { int32_t TESTFN i8x16_extract_lane_s_last(i8x16 vec) { return __builtin_wasm_extract_lane_s_i8x16(vec, 15); } -#ifdef __wasm_unimplemented_simd128__ uint32_t TESTFN i8x16_extract_lane_u_first(i8x16 vec) { return __builtin_wasm_extract_lane_u_i8x16(vec, 0); } uint32_t TESTFN i8x16_extract_lane_u_last(i8x16 vec) { return __builtin_wasm_extract_lane_u_i8x16(vec, 15); } -#endif // __wasm_unimplemented_simd128__ i8x16 TESTFN i8x16_replace_lane_first(i8x16 vec, int32_t val) { return (i8x16){__builtin_wasm_replace_lane_i8x16(vec, 0, val)}; } @@ -106,14 +104,12 @@ int32_t TESTFN i16x8_extract_lane_s_first(i16x8 vec) { int32_t TESTFN i16x8_extract_lane_s_last(i16x8 vec) { return __builtin_wasm_extract_lane_s_i16x8(vec, 7); } -#ifdef __wasm_unimplemented_simd128__ int32_t TESTFN i16x8_extract_lane_u_first(i16x8 vec) { return __builtin_wasm_extract_lane_u_i16x8(vec, 0); } int32_t TESTFN i16x8_extract_lane_u_last(i16x8 vec) { return __builtin_wasm_extract_lane_u_i16x8(vec, 7); } -#endif // __wasm_unimplemented_simd128__ i16x8 TESTFN i16x8_replace_lane_first(i16x8 vec, int32_t val) { return __builtin_wasm_replace_lane_i16x8(vec, 0, val); } @@ -138,7 +134,6 @@ i32x4 TESTFN i32x4_replace_lane_last(i32x4 vec, int32_t val) { i64x2 TESTFN i64x2_splat(int64_t x) { return (i64x2) {x, x}; } -#ifdef __wasm_unimplemented_simd128__ int64_t TESTFN i64x2_extract_lane_first(i64x2 vec) { return __builtin_wasm_extract_lane_i64x2(vec, 0); } @@ -151,7 +146,6 @@ i64x2 TESTFN i64x2_replace_lane_first(i64x2 vec, int64_t val) { i64x2 TESTFN i64x2_replace_lane_last(i64x2 vec, int64_t val) { return __builtin_wasm_replace_lane_i64x2(vec, 1, val); } -#endif // __wasm_unimplemented_simd128__ f32x4 TESTFN f32x4_splat(float x) { return (f32x4) {x, x, x, x}; } @@ -170,7 +164,6 @@ f32x4 TESTFN f32x4_replace_lane_last(f32x4 vec, float val) { f64x2 TESTFN f64x2_splat(int64_t x) { return (f64x2) {x, x}; } -#ifdef __wasm_unimplemented_simd128__ double TESTFN f64x2_extract_lane_first(f64x2 vec) { return __builtin_wasm_extract_lane_f64x2(vec, 0); } @@ -183,7 +176,6 @@ f64x2 TESTFN f64x2_replace_lane_first(f64x2 vec, double val) { f64x2 TESTFN f64x2_replace_lane_last(f64x2 vec, double val) { return __builtin_wasm_replace_lane_f64x2(vec, 1, val); } -#endif // __wasm_unimplemented_simd128__ i8x16 TESTFN i8x16_eq(i8x16 x, i8x16 y) { return x == y; } @@ -368,11 +360,9 @@ i8x16 TESTFN i8x16_mul(i8x16 x, i8x16 y) { return x * y; } // Skip {min,max}_{s,u} because they do not have short builtin equivalents -#ifdef __wasm_unimplemented_simd128__ i8x16 TESTFN i8x16_avgr_u(i8x16 x, i8x16 y) { return __builtin_wasm_avgr_u_i8x16(x, y); } -#endif // __wasm_unimplemented_simd128__ i16x8 TESTFN i16x8_neg(i16x8 vec) { return -vec; } @@ -413,11 +403,9 @@ i16x8 TESTFN i16x8_mul(i16x8 x, i16x8 y) { return x * y; } // Skip {min,max}_{s,u} because they do not have short builtin equivalents -#ifdef __wasm_unimplemented_simd128__ i16x8 TESTFN i16x8_avgr_u(i16x8 x, i16x8 y) { return __builtin_wasm_avgr_u_i16x8(x, y); } -#endif // __wasm_unimplemented_simd128__ i32x4 TESTFN i32x4_neg(i32x4 vec) { return -vec; } @@ -478,10 +466,10 @@ f32x4 TESTFN f32x4_abs(f32x4 vec) { f32x4 TESTFN f32x4_neg(f32x4 vec) { return -vec; } -#ifdef __wasm_unimplemented_simd128__ f32x4 TESTFN f32x4_sqrt(f32x4 vec) { return __builtin_wasm_sqrt_f32x4(vec); } +#ifdef __wasm_unimplemented_simd128__ f32x4 TESTFN f32x4_qfma(f32x4 a, f32x4 b, f32x4 c) { return __builtin_wasm_qfma_f32x4(a, b, c); } @@ -507,18 +495,16 @@ f32x4 TESTFN f32x4_min(f32x4 x, f32x4 y) { f32x4 TESTFN f32x4_max(f32x4 x, f32x4 y) { return __builtin_wasm_max_f32x4(x, y); } -#ifdef __wasm_unimplemented_simd128__ f64x2 TESTFN f64x2_abs(f64x2 vec) { return __builtin_wasm_abs_f64x2(vec); } -#endif // __wasm_unimplemented_simd128__ f64x2 TESTFN f64x2_neg(f64x2 vec) { return -vec; } -#ifdef __wasm_unimplemented_simd128__ f64x2 TESTFN f64x2_sqrt(f64x2 vec) { return __builtin_wasm_sqrt_f64x2(vec); } +#ifdef __wasm_unimplemented_simd128__ f64x2 TESTFN f64x2_qfma(f64x2 a, f64x2 b, f64x2 c) { return __builtin_wasm_qfma_f64x2(a, b, c); } @@ -538,14 +524,12 @@ f64x2 TESTFN f64x2_mul(f64x2 x, f64x2 y) { f64x2 TESTFN f64x2_div(f64x2 x, f64x2 y) { return x / y; } -#ifdef __wasm_unimplemented_simd128__ f64x2 TESTFN f64x2_min(f64x2 x, f64x2 y) { return __builtin_wasm_min_f64x2(x, y); } f64x2 TESTFN f64x2_max(f64x2 x, f64x2 y) { return __builtin_wasm_max_f64x2(x, y); } -#endif // __wasm_unimplemented_simd128__ i32x4 TESTFN i32x4_trunc_s_f32x4_sat(f32x4 vec) { return __builtin_wasm_trunc_saturate_s_i32x4_f32x4(vec); } @@ -756,10 +740,8 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(i8x16_splat(257), ((i8x16){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})); expect_eq(i8x16_extract_lane_s_first((i8x16){-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), -1); expect_eq(i8x16_extract_lane_s_last((i8x16){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}), -1); -#ifdef __wasm_unimplemented_simd128__ expect_eq(i8x16_extract_lane_u_first((i8x16){-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), 255); expect_eq(i8x16_extract_lane_u_last((i8x16){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}), 255); -#endif // __wasm_unimplemented_simd128__ expect_vec( i8x16_replace_lane_first((i8x16){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 7), ((i8x16){7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) @@ -774,10 +756,8 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(i16x8_splat(65537), ((i16x8){1, 1, 1, 1, 1, 1, 1, 1})); expect_eq(i16x8_extract_lane_s_first((i16x8){-1, 0, 0, 0, 0, 0, 0, 0}), -1); expect_eq(i16x8_extract_lane_s_last((i16x8){0, 0, 0, 0, 0, 0, 0, -1}), -1); -#ifdef __wasm_unimplemented_simd128__ expect_eq(i16x8_extract_lane_u_first((i16x8){-1, 0, 0, 0, 0, 0, 0, 0}), 65535); expect_eq(i16x8_extract_lane_u_last((i16x8){0, 0, 0, 0, 0, 0, 0, -1}), 65535); -#endif // __wasm_unimplemented_simd128__ expect_vec(i16x8_replace_lane_first((i16x8){0, 0, 0, 0, 0, 0, 0, 0}, 7), ((i16x8){7, 0, 0, 0, 0, 0, 0, 0})); expect_vec(i16x8_replace_lane_last((i16x8){0, 0, 0, 0, 0, 0, 0, 0}, 7), ((i16x8){0, 0, 0, 0, 0, 0, 0, 7})); @@ -790,12 +770,10 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv // i64x2 lane accesses expect_vec(i64x2_splat(-5), ((i64x2){-5, -5})); -#ifdef __wasm_unimplemented_simd128__ expect_eq(i64x2_extract_lane_first((i64x2){-5, 0}), -5); expect_eq(i64x2_extract_lane_last((i64x2){0, -5}), -5); expect_vec(i64x2_replace_lane_first((i64x2){0, 0}, 53), ((i64x2){53, 0})); expect_vec(i64x2_replace_lane_last((i64x2){0, 0}, 53), ((i64x2){0, 53})); -#endif // __wasm_unimplemented_simd128__ // f32x4 lane accesses expect_vec(f32x4_splat(-5), ((f32x4){-5, -5, -5, -5})); @@ -806,12 +784,10 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv // f64x2 lane accesses expect_vec(f64x2_splat(-5), ((f64x2){-5, -5})); -#ifdef __wasm_unimplemented_simd128__ expect_eq(f64x2_extract_lane_first((f64x2){-5, 0}), -5); expect_eq(f64x2_extract_lane_last((f64x2){0, -5}), -5); expect_vec(f64x2_replace_lane_first((f64x2){0, 0}, 53), ((f64x2){53, 0})); expect_vec(f64x2_replace_lane_last((f64x2){0, 0}, 53), ((f64x2){0, 53})); -#endif // __wasm_unimplemented_simd128__ // i8x16 comparisons expect_vec( @@ -863,14 +839,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i8x16){-1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0}) ); - // bugs.chromium.org/p/v8/issues/detail?id=8635 - // expect_vec( - // i8x16_le_u( - // (i8x16){0, 127, 13, 128, 1, 13, 129, 42, 0, 127, 255, 42, 1, 13, 129, 42}, - // (i8x16){0, 255, 13, 42, 129, 127, 0, 128, 0, 255, 13, 42, 129, 127, 0, 128} - // ), - // ((i8x16){-1, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1}) - // ); + expect_vec( + i8x16_le_u( + (i8x16){0, 127, 13, 128, 1, 13, 129, 42, 0, 127, 255, 42, 1, 13, 129, 42}, + (i8x16){0, 255, 13, 42, 129, 127, 0, 128, 0, 255, 13, 42, 129, 127, 0, 128} + ), + ((i8x16){-1, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1}) + ); expect_vec( i8x16_ge_s( (i8x16){0, 127, 13, 128, 1, 13, 129, 42, 0, 127, 255, 42, 1, 13, 129, 42}, @@ -878,13 +853,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i8x16){-1, -1, -1, 0, -1, 0, 0, -1, -1, -1, 0, -1, -1, 0, 0, -1}) ); - // expect_vec( - // i8x16_ge_u( - // (i8x16){0, 127, 13, 128, 1, 13, 129, 42, 0, 127, 255, 42, 1, 13, 129, 42}, - // (i8x16){0, 255, 13, 42, 129, 127, 0, 128, 0, 255, 13, 42, 129, 127, 0, 128} - // ), - // ((i8x16){-1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, 0, -1, 0}) - // ); + expect_vec( + i8x16_ge_u( + (i8x16){0, 127, 13, 128, 1, 13, 129, 42, 0, 127, 255, 42, 1, 13, 129, 42}, + (i8x16){0, 255, 13, 42, 129, 127, 0, 128, 0, 255, 13, 42, 129, 127, 0, 128} + ), + ((i8x16){-1, 0, -1, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, 0, -1, 0}) + ); // i16x8 comparisons expect_vec( @@ -1111,32 +1086,31 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_eq(i8x16_all_true((i8x16){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), 0); expect_eq(i8x16_all_true((i8x16){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}), 0); expect_eq(i8x16_all_true((i8x16){1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}), 0); - // https://bugs.chromium.org/p/v8/issues/detail?id=9372 - /* expect_eq(i8x16_all_true((i8x16){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}), 1); */ + expect_eq(i8x16_all_true((i8x16){1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}), 1); expect_vec( i8x16_shl((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 1), ((i8x16){0, 2, 4, 8, 16, 32, 64, -128, 0, 6, 12, 24, 48, 96, -64, -128}) ); - /* expect_vec( */ - /* i8x16_shl((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), */ - /* ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) */ - /* ); */ + expect_vec( + i8x16_shl((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), + ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) + ); expect_vec( i8x16_shr_u((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 1), ((i8x16){0, 0, 1, 2, 4, 8, 16, 32, 64, 1, 3, 6, 12, 24, 48, 96}) ); - /* expect_vec( */ - /* i8x16_shr_u((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), */ - /* ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) */ - /* ); */ + expect_vec( + i8x16_shr_u((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), + ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) + ); expect_vec( i8x16_shr_s((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 1), ((i8x16){0, 0, 1, 2, 4, 8, 16, 32, -64, 1, 3, 6, 12, 24, 48, -32}) ); - /* expect_vec( */ - /* i8x16_shr_s((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), */ - /* ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) */ - /* ); */ + expect_vec( + i8x16_shr_s((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}, 8), + ((i8x16){0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64}) + ); expect_vec( i8x16_add( (i8x16){0, 42, 255, 128, 127, 129, 6, 29, 103, 196, 231, 142, 17, 250, 1, 73}, @@ -1186,7 +1160,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i8x16){0, 230, 255, 0, 255, 6, 106, 237, 230, 52, 223, 76, 0, 6, 127, 126}) ); -#ifdef __wasm_unimplemented_simd128__ expect_vec( i8x16_avgr_u( (i8x16){0, 42, 255, 128, 127, 129, 6, 29, 103, 196, 231, 142, 17, 250, 1, 73}, @@ -1194,7 +1167,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i8x16){2, 137, 128, 128, 128, 68, 55, 23, 73, 113, 152, 92, 9, 253, 64, 108}) ); -#endif // __wasm_unimplemented_simd128__ // i16x8 arithmetic expect_vec( @@ -1213,26 +1185,26 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv i16x8_shl((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 1), ((i16x8){0, 16, 32, 256, 512, 4096, 8192, 0}) ); - /* expect_vec( */ - /* i16x8_shl((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), */ - /* ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) */ - /* ); */ + expect_vec( + i16x8_shl((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), + ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) + ); expect_vec( i16x8_shr_u((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 1), ((i16x8){0, 4, 8, 64, 128, 1024, 2048, 16384}) ); - /* expect_vec( */ - /* i16x8_shr_u((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), */ - /* ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) */ - /* ); */ + expect_vec( + i16x8_shr_u((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), + ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) + ); expect_vec( i16x8_shr_s((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 1), ((i16x8){0, 4, 8, 64, 128, 1024, 2048, -16384}) ); - /* expect_vec( */ - /* i16x8_shr_s((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), */ - /* ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) */ - /* ); */ + expect_vec( + i16x8_shr_s((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}, 16), + ((i16x8){0, 8, 16, 128, 256, 2048, 4096, -32768}) + ); expect_vec( i16x8_add( (i16x8){0, -256, -32768, 32512, -32512, -6400, -1536, 32766}, @@ -1282,7 +1254,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i16x8){0, -256, 0, 0, 0, 0, 0, -4}) ); -#ifdef __wasm_unimplemented_simd128__ expect_vec( i16x8_avgr_u( (i16x8){0, -256, -32768, 32512, -32512, -6400, -1536, 32766}, @@ -1290,7 +1261,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i16x8){384, 32641, -32768, -32768, 17280, -26624, -896, 16384}) ); -#endif // __wasm_unimplemented_simd128__ // i32x4 arithmetic expect_vec(i32x4_neg((i32x4){0, 1, 0x80000000, 0x7fffffff}), ((i32x4){0, -1, 0x80000000, 0x80000001})); @@ -1303,11 +1273,11 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_eq(i32x4_all_true((i32x4){1, 0, 1, 1}), 0); expect_eq(i32x4_all_true((i32x4){1, 1, 1, 1}), 1); expect_vec(i32x4_shl((i32x4){1, 0x40000000, 0x80000000, -1}, 1), ((i32x4){2, 0x80000000, 0, -2})); - /* expect_vec(i32x4_shl((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); */ + expect_vec(i32x4_shl((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); expect_vec(i32x4_shr_s((i32x4){1, 0x40000000, 0x80000000, -1}, 1), ((i32x4){0, 0x20000000, 0xc0000000, -1})); - /* expect_vec(i32x4_shr_s((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); */ + expect_vec(i32x4_shr_s((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); expect_vec(i32x4_shr_u((i32x4){1, 0x40000000, 0x80000000, -1}, 1), ((i32x4){0, 0x20000000, 0x40000000, 0x7fffffff})); - /* expect_vec(i32x4_shr_u((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); */ + expect_vec(i32x4_shr_u((i32x4){1, 0x40000000, 0x80000000, -1}, 32), ((i32x4){1, 0x40000000, 0x80000000, -1})); expect_vec(i32x4_add((i32x4){0, 0x80000001, 42, 5}, (i32x4){0, 0x80000001, 5, 42}), ((i32x4){0, 2, 47, 47})); expect_vec(i32x4_sub((i32x4){0, 2, 47, 47}, (i32x4){0, 0x80000001, 42, 5}), ((i32x4){0, 0x80000001, 5, 42})); expect_vec(i32x4_mul((i32x4){0, 0x80000001, 42, 5}, (i32x4){0, 0x80000001, 42, 5}), ((i32x4){0, 1, 1764, 25})); @@ -1335,28 +1305,23 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv // f32x4 arithmetic expect_vec(f32x4_abs((f32x4){-0., NAN, -INFINITY, 5}), ((f32x4){0, NAN, INFINITY, 5})); expect_vec(f32x4_neg((f32x4){-0., NAN, -INFINITY, 5}), ((f32x4){0, -NAN, INFINITY, -5})); -#ifdef __wasm_unimplemented_simd128__ expect_vec(f32x4_sqrt((f32x4){-0., NAN, INFINITY, 4}), ((f32x4){-0., NAN, INFINITY, 2})); -#endif // __wasm_unimplemented_simd128__ // TODO: Test QFMA/QFMS expect_vec(f32x4_add((f32x4){NAN, -NAN, INFINITY, 42}, (f32x4){42, INFINITY, INFINITY, 1}), ((f32x4){NAN, -NAN, INFINITY, 43})); expect_vec(f32x4_sub((f32x4){NAN, -NAN, INFINITY, 42}, (f32x4){42, INFINITY, -INFINITY, 1}), ((f32x4){NAN, -NAN, INFINITY, 41})); expect_vec(f32x4_mul((f32x4){NAN, -NAN, INFINITY, 42}, (f32x4){42, INFINITY, INFINITY, 2}), ((f32x4){NAN, -NAN, INFINITY, 84})); expect_vec(f32x4_div((f32x4){NAN, -NAN, INFINITY, 42}, (f32x4){42, INFINITY, 2, 2}), ((f32x4){NAN, -NAN, INFINITY, 21})); - // expect_vec(f32x4_min((f32x4){-0., 0, NAN, 5}, (f32x4){0, -0., 5, NAN}), ((f32x4){-0., -0., NAN, NAN})); - // expect_vec(f32x4_max((f32x4){-0., 0, NAN, 5}, (f32x4){0, -0., 5, NAN}), ((f32x4){0, 0, NAN, NAN})); + expect_vec(f32x4_min((f32x4){-0., 0, NAN, 5}, (f32x4){0, -0., 5, NAN}), ((f32x4){-0., -0., NAN, NAN})); + expect_vec(f32x4_max((f32x4){-0., 0, NAN, 5}, (f32x4){0, -0., 5, NAN}), ((f32x4){0, 0, NAN, NAN})); // f64x2 arithmetic -#ifdef __wasm_unimplemented_simd128__ expect_vec(f64x2_abs((f64x2){-0., NAN}), ((f64x2){0, NAN})); expect_vec(f64x2_abs((f64x2){-INFINITY, 5}), ((f64x2){INFINITY, 5})); -#endif // __wasm_unimplemented_simd128__ expect_vec(f64x2_neg((f64x2){-0., NAN}), ((f64x2){0, -NAN})); expect_vec(f64x2_neg((f64x2){-INFINITY, 5}), ((f64x2){INFINITY, -5})); -#ifdef __wasm_unimplemented_simd128__ - expect_vec(f64x2_sqrt((f64x2){-0., NAN}), ((f64x2){-0., NAN})); - expect_vec(f64x2_sqrt((f64x2){INFINITY, 4}), ((f64x2){INFINITY, 2})); -#endif // __wasm_unimplemented_simd128__ + // https://bugs.chromium.org/p/v8/issues/detail?id=10170 + // expect_vec(f64x2_sqrt((f64x2){-0., NAN}), ((f64x2){-0., NAN})); + // expect_vec(f64x2_sqrt((f64x2){INFINITY, 4}), ((f64x2){INFINITY, 2})); // TODO: Test QFMA/QFMS expect_vec(f64x2_add((f64x2){NAN, -NAN}, (f64x2){42, INFINITY}), ((f64x2){NAN, -NAN})); expect_vec(f64x2_add((f64x2){INFINITY, 42}, (f64x2){INFINITY, 1}), ((f64x2){INFINITY, 43})); @@ -1366,12 +1331,10 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(f64x2_mul((f64x2){INFINITY, 42}, (f64x2){INFINITY, 2}), ((f64x2){INFINITY, 84})); expect_vec(f64x2_div((f64x2){NAN, -NAN}, (f64x2){42, INFINITY}), ((f64x2){NAN, -NAN})); expect_vec(f64x2_div((f64x2){INFINITY, 42}, (f64x2){2, 2}), ((f64x2){INFINITY, 21})); -#ifdef __wasm_unimplemented_simd128__ expect_vec(f64x2_min((f64x2){-0., 0}, (f64x2){0, -0}), ((f64x2){-0., -0})); expect_vec(f64x2_min((f64x2){NAN, 5}, (f64x2){5, NAN}), ((f64x2){NAN, NAN})); expect_vec(f64x2_max((f64x2){-0., 0}, (f64x2){0, -0}), ((f64x2){0, 0})); expect_vec(f64x2_max((f64x2){NAN, 5}, (f64x2){5, NAN}), ((f64x2){NAN, NAN})); -#endif // __wasm_unimplemented_simd128__ // conversions expect_vec(i32x4_trunc_s_f32x4_sat((f32x4){42, NAN, INFINITY, -INFINITY}), ((i32x4){42, 0, 2147483647, -2147483648ll})); @@ -1384,10 +1347,12 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv #endif // __wasm_unimplemented_simd128__ expect_vec(f32x4_convert_s_i32x4((i32x4){0, -1, 2147483647, -2147483647 - 1}), ((f32x4){0, -1, 2147483648., -2147483648.})); expect_vec(f32x4_convert_u_i32x4((i32x4){0, -1, 2147483647, -2147483647 - 1}), ((f32x4){0, 4294967296., 2147483648., 2147483648.})); +#ifdef __wasm_unimplemented_simd128__ expect_vec(f64x2_convert_s_i64x2((i64x2){0, -1}), ((f64x2){0, -1})); expect_vec(f64x2_convert_s_i64x2((i64x2){9223372036854775807, -9223372036854775807 - 1}), ((f64x2){9223372036854775807., -9223372036854775808.})); expect_vec(f64x2_convert_u_i64x2((i64x2){0, -1}), ((f64x2){0, 18446744073709551616.})); expect_vec(f64x2_convert_u_i64x2((i64x2){9223372036854775807 , -9223372036854775808.}), ((f64x2){9223372036854775807., 9223372036854775808.})); +#endif // __wasm_unimplemented_simd128__ expect_vec( i8x16_narrow_i16x8_s( (i16x8){129, 127, -32767, 32767, -32768, -1, 1, 0}, @@ -1395,14 +1360,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i8x16){127, 127, -128, 127, -128, -1, 1, 0, 0, 1, -1, -128, 127, -128, 127, 127}) ); - // https://bugs.chromium.org/p/v8/issues/detail?id=9729 - /* expect_vec( */ - /* i8x16_narrow_i16x8_u( */ - /* (i16x8){129, 127, -32767, 32767, -32768, -1, 1, 0}, */ - /* (i16x8){0, 1, -1, -32768, 32767, -32767, 127, 129} */ - /* ), */ - /* ((i8x16){129, 127, 0, 255, 0, 0, 1, 0, 0, 1, 0, 0, 255, 0, 127, 129}) */ - /* ); */ + expect_vec( + i8x16_narrow_i16x8_u( + (i16x8){129, 127, -32767, 32767, -32768, -1, 1, 0}, + (i16x8){0, 1, -1, -32768, 32767, -32767, 127, 129} + ), + ((i8x16){129, 127, 0, 255, 0, 0, 1, 0, 0, 1, 0, 0, 255, 0, 127, 129}) + ); expect_vec( i16x8_narrow_i32x4_s( (i32x4){32769, 32767, -2147483647, 2147483647}, @@ -1410,14 +1374,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), ((i16x8){32767, 32767, -32768, 32767, 0, 1, -1, -32768}) ); - // https://bugs.chromium.org/p/v8/issues/detail?id=9729 - /* expect_vec( */ - /* i16x8_narrow_i32x4_u( */ - /* (i32x4){32769, 32767, -2147483647, 2147483647}, */ - /* (i32x4){0, 1, -1, -2147483647 - 1} */ - /* ), */ - /* ((i16x8){-32767, 32767, 0, -1, 0, 1, 0, 0}) */ - /* ); */ + expect_vec( + i16x8_narrow_i32x4_u( + (i32x4){32769, 32767, -2147483647, 2147483647}, + (i32x4){0, 1, -1, -2147483647 - 1} + ), + ((i16x8){-32767, 32767, 0, -1, 0, 1, 0, 0}) + ); expect_vec( i16x8_widen_low_i8x16_s( (i8x16){0, 1, -1, -128, 127, 129, 64, -64, -64, 64, 129, 127, -128, -1, 1, 0} diff --git a/tests/test_wasm_intrinsics_simd.c b/tests/test_wasm_intrinsics_simd.c index 56afac44e841d..5ace5709fa593 100644 --- a/tests/test_wasm_intrinsics_simd.c +++ b/tests/test_wasm_intrinsics_simd.c @@ -61,18 +61,12 @@ v128_t TESTFN i32x4_const(void) { v128_t TESTFN f32x4_const(void) { return wasm_f32x4_const(1, 2, 3, 4); } - -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN i64x2_const(void) { return wasm_i64x2_const(1, 2); } v128_t TESTFN f64x2_const(void) { return wasm_f64x2_const(1, 2); } - -#endif // __wasm_unimplemented_sidm128__ - v128_t TESTFN i8x16_make(int8_t first) { return wasm_i8x16_make( first, (int8_t)2, (int8_t)3, (int8_t)4, @@ -93,18 +87,12 @@ v128_t TESTFN i32x4_make(int32_t first) { v128_t TESTFN f32x4_make(float first) { return wasm_f32x4_make(first, 2.f, 3.f, 4.f); } - -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN i64x2_make(int64_t first) { return wasm_i64x2_make(first, (int64_t)2); } v128_t TESTFN f64x2_make(double first) { return wasm_f64x2_make(first, 2.); } - -#endif // __wasm_unimplemented_sidm128__ - v128_t TESTFN i8x16_shuffle_interleave_bytes(v128_t x, v128_t y) { return wasm_v8x16_shuffle(x, y, 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31); } @@ -130,8 +118,6 @@ int32_t TESTFN i8x16_extract_lane_s_last(v128_t vec) { return wasm_i8x16_extract_lane(vec, 15); } -#ifdef __wasm_unimplemented_simd128__ - uint32_t TESTFN i8x16_extract_lane_u_first(v128_t vec) { return wasm_u8x16_extract_lane(vec, 0); } @@ -139,8 +125,6 @@ uint32_t TESTFN i8x16_extract_lane_u_last(v128_t vec) { return wasm_u8x16_extract_lane(vec, 15); } -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN i8x16_replace_lane_first(v128_t vec, int32_t val) { return wasm_i8x16_replace_lane(vec, 0, val); } @@ -157,8 +141,6 @@ int32_t TESTFN i16x8_extract_lane_s_last(v128_t vec) { return wasm_i16x8_extract_lane(vec, 7); } -#ifdef __wasm_unimplemented_simd128__ - int32_t TESTFN i16x8_extract_lane_u_first(v128_t vec) { return wasm_u16x8_extract_lane(vec, 0); } @@ -166,8 +148,6 @@ int32_t TESTFN i16x8_extract_lane_u_last(v128_t vec) { return wasm_u16x8_extract_lane(vec, 7); } -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN i16x8_replace_lane_first(v128_t vec, int32_t val) { return wasm_i16x8_replace_lane(vec, 0, val); } @@ -190,8 +170,6 @@ v128_t TESTFN i32x4_replace_lane_last(v128_t vec, int32_t val) { return wasm_i32x4_replace_lane(vec, 3, val); } -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN i64x2_splat(int64_t x) { return wasm_i64x2_splat(x); } @@ -208,8 +186,6 @@ v128_t TESTFN i64x2_replace_lane_last(v128_t vec, int64_t val) { return wasm_i64x2_replace_lane(vec, 1, val); } -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN f32x4_splat(float x) { return wasm_f32x4_splat(x); } @@ -226,8 +202,6 @@ v128_t TESTFN f32x4_replace_lane_last(v128_t vec, float val) { return wasm_f32x4_replace_lane(vec, 3, val); } -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN f64x2_splat(double x) { return wasm_f64x2_splat(x); } @@ -244,8 +218,6 @@ v128_t TESTFN f64x2_replace_lane_last(v128_t vec, double val) { return wasm_f64x2_replace_lane(vec, 1, val); } -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN i8x16_eq(v128_t x, v128_t y) { return wasm_i8x16_eq(x, y); } @@ -354,9 +326,6 @@ v128_t TESTFN f32x4_le(v128_t x, v128_t y) { v128_t TESTFN f32x4_ge(v128_t x, v128_t y) { return wasm_f32x4_ge(x, y); } - -#ifdef __wasm_undefined_simd128__ - v128_t TESTFN f64x2_eq(v128_t x, v128_t y) { return wasm_f64x2_eq(x,y); } @@ -375,9 +344,6 @@ v128_t TESTFN f64x2_le(v128_t x, v128_t y) { v128_t TESTFN f64x2_ge(v128_t x, v128_t y) { return wasm_f64x2_ge(x, y); } - -#endif // __wasm_undefined_simd128__ - v128_t TESTFN v128_not(v128_t vec) { return wasm_v128_not(vec); } @@ -391,13 +357,13 @@ v128_t TESTFN v128_xor(v128_t x, v128_t y) { return wasm_v128_xor(x, y); } -#ifdef __wasm_undefined_simd128__ +#ifdef __wasm_unimplemented_simd128__ v128_t TESTFN v128_andnot(v128_t x, v128_t y) { return wasm_v128_andnot(x, y); } -#endif // __wasm_undefined_simd128__ +#endif // __wasm_unimplemented_simd128__ v128_t TESTFN v128_bitselect(v128_t x, v128_t y, v128_t cond) { return wasm_v128_bitselect(x, y, cond); @@ -453,11 +419,9 @@ v128_t TESTFN i8x16_max_s(v128_t x, v128_t y) { v128_t TESTFN i8x16_max_u(v128_t x, v128_t y) { return wasm_i8x16_max_u(x, y); } -#ifdef __wasm_unimplemented_simd__ v128_t TESTFN i8x16_avgr_u(v128_t x, v128_t y) { return wasm_i8x16_avgr_u(x, y); } -#endif // __wasm_unimplemented_simd__ v128_t TESTFN i16x8_neg(v128_t vec) { return wasm_i16x8_neg(vec); } @@ -506,11 +470,9 @@ v128_t TESTFN i16x8_max_s(v128_t x, v128_t y) { v128_t TESTFN i16x8_max_u(v128_t x, v128_t y) { return wasm_i16x8_max_u(x, y); } -#ifdef __wasm_unimplemented_simd__ v128_t TESTFN i16x8_avgr_u(v128_t x, v128_t y) { return wasm_i16x8_avgr_u(x, y); } -#endif // __wasm_unimplemented_simd__ v128_t TESTFN i16x8_mul(v128_t x, v128_t y) { return wasm_i16x8_mul(x, y); } @@ -553,10 +515,6 @@ v128_t TESTFN i32x4_max_u(v128_t x, v128_t y) { v128_t TESTFN i32x4_mul(v128_t x, v128_t y) { return wasm_i32x4_mul(x, y); } - -#ifdef __wasm_unimplemented_simd128__ - - v128_t TESTFN i64x2_neg(v128_t vec) { return wasm_i64x2_neg(vec); } @@ -575,7 +533,6 @@ bool TESTFN i64x2_all_true(v128_t vec) { v128_t TESTFN i64x2_shl(v128_t vec, int32_t shift) { return wasm_i64x2_shl(vec, shift); } - v128_t TESTFN i64x2_shr_s(v128_t vec, int32_t shift) { return wasm_i64x2_shr(vec, shift); } @@ -588,21 +545,18 @@ v128_t TESTFN i64x2_add(v128_t x, v128_t y) { v128_t TESTFN i64x2_sub(v128_t x, v128_t y) { return wasm_i64x2_sub(x, y); } - -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN f32x4_abs(v128_t vec) { return wasm_f32x4_abs(vec); } v128_t TESTFN f32x4_neg(v128_t vec) { return wasm_f32x4_neg(vec); } - -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN f32x4_sqrt(v128_t vec) { return wasm_f32x4_sqrt(vec); } + +#ifdef __wasm_unimplemented_simd128__ + v128_t TESTFN f32x4_qfma(v128_t a, v128_t b, v128_t c) { return wasm_f32x4_qfma(a, b, c); } @@ -630,9 +584,6 @@ v128_t TESTFN f32x4_min(v128_t x, v128_t y) { v128_t TESTFN f32x4_max(v128_t x, v128_t y) { return wasm_f32x4_max(x, y); } - -#ifdef __wasm_unimplemented_simd128__ - v128_t TESTFN f64x2_abs(v128_t vec) { return wasm_f64x2_abs(vec); } @@ -642,12 +593,18 @@ v128_t TESTFN f64x2_neg(v128_t vec) { v128_t TESTFN f64x2_sqrt(v128_t vec) { return wasm_f64x2_sqrt(vec); } + +#ifdef __wasm_unimplemented_simd128__ + v128_t TESTFN f64x2_qfma(v128_t a, v128_t b, v128_t c) { return wasm_f64x2_qfma(a, b, c); } v128_t TESTFN f64x2_qfms(v128_t a, v128_t b, v128_t c) { return wasm_f64x2_qfms(a, b, c); } + +#endif // __wasm_unimplemented_simd128__ + v128_t TESTFN f64x2_add(v128_t x, v128_t y) { return wasm_f64x2_add(x, y); } @@ -666,9 +623,6 @@ v128_t TESTFN f64x2_min(v128_t x, v128_t y) { v128_t TESTFN f64x2_max(v128_t x, v128_t y) { return wasm_f64x2_max(x, y); } - -#endif // __wasm_unimplemented_simd128__ - v128_t TESTFN i32x4_trunc_s_f32x4_sat(v128_t vec) { return wasm_i32x4_trunc_saturate_f32x4(vec); } @@ -905,26 +859,14 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(i16x8_const(), u16x8(1, 2, 3, 4, 5, 6, 7, 8)); expect_vec(i32x4_const(), u32x4(1, 2, 3, 4)); expect_vec(f32x4_const(), f32x4(1., 2., 3., 4.)); - -#ifdef __wasm_unimplemented_simd128__ - expect_vec(i64x2_const(), u64x2(1, 2)); expect_vec(f64x2_const(), f64x2(1., 2.)); - -#endif // __wasm_unimplemented_simd128__ - expect_vec(i8x16_make(1), u8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); expect_vec(i16x8_make(1), u16x8(1, 2, 3, 4, 5, 6, 7, 8)); expect_vec(i32x4_make(1), u32x4(1, 2, 3, 4)); expect_vec(f32x4_make(1), f32x4(1., 2., 3., 4.)); - -#ifdef __wasm_unimplemented_simd128__ - expect_vec(i64x2_make(1), u64x2(1, 2)); expect_vec(f64x2_make(1), f64x2(1., 2.)); - -#endif // __wasm_unimplemented_simd128__ - expect_vec( i8x16_shuffle_interleave_bytes( (v128_t)i8x16(1, 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 0, 13, 0, 15, 0), @@ -963,9 +905,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), -1 ); - -#ifdef __wasm_unimplemented_simd128__ - expect_eq( i8x16_extract_lane_u_first( (v128_t)i8x16(-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) @@ -978,9 +917,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), 255 ); - -#endif // __wasm_unimplemented_simd128__ - expect_vec( i8x16_replace_lane_first( (v128_t)i8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), @@ -1001,14 +937,8 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(i16x8_splat(65537), i16x8(1, 1, 1, 1, 1, 1, 1, 1)); expect_eq(i16x8_extract_lane_s_first((v128_t)i16x8(-1, 0, 0, 0, 0, 0, 0, 0)), -1); expect_eq(i16x8_extract_lane_s_last((v128_t)i16x8(0, 0, 0, 0, 0, 0, 0, -1)), -1); - -#ifdef __wasm_unimplemented_simd128__ - expect_eq(i16x8_extract_lane_u_first((v128_t)i16x8(-1, 0, 0, 0, 0, 0, 0, 0)), 65535); expect_eq(i16x8_extract_lane_u_last((v128_t)i16x8(0, 0, 0, 0, 0, 0, 0, -1)), 65535); - -#endif // __wasm_unimplemented_simd128__ - expect_vec( i16x8_replace_lane_first((v128_t)i16x8(0, 0, 0, 0, 0, 0, 0, 0), 7), i16x8(7, 0, 0, 0, 0, 0, 0, 0) @@ -1030,9 +960,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv i32x4_replace_lane_last((v128_t)i32x4(0, 0, 0, 0), 53), i32x4(0, 0, 0, 53) ); - -#ifdef __wasm_unimplemented_simd128__ - // i64x2 lane accesses expect_vec(i64x2_splat(-5), i64x2(-5, -5)); expect_eq(i64x2_extract_lane_first((v128_t)i64x2(-5, 0)), -5); @@ -1040,8 +967,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(i64x2_replace_lane_first((v128_t)i64x2(0, 0), 53), i64x2(53, 0)); expect_vec(i64x2_replace_lane_last((v128_t)i64x2(0, 0), 53), i64x2(0, 53)); -#endif // __wasm_unimplemented_simd128__ - // f32x4 lane accesses expect_vec(f32x4_splat(-5), f32x4(-5, -5, -5, -5)); expect_eq(f32x4_extract_lane_first((v128_t)f32x4(-5, 0, 0, 0)), -5); @@ -1049,8 +974,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(f32x4_replace_lane_first((v128_t)f32x4(0, 0, 0, 0), 53), f32x4(53, 0, 0, 0)); expect_vec(f32x4_replace_lane_last((v128_t)f32x4(0, 0, 0, 0), 53), f32x4(0, 0, 0, 53)); -#ifdef __wasm_unimplemented_simd128__ - // f64x2 lane accesses expect_vec(f64x2_splat(-5), f64x2(-5, -5)); expect_eq(f64x2_extract_lane_first((v128_t)f64x2(-5, 0)), -5); @@ -1058,8 +981,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(f64x2_replace_lane_first((v128_t)f64x2(0, 0), 53), f64x2(53, 0)); expect_vec(f64x2_replace_lane_last((v128_t)f64x2(0, 0), 53), f64x2(0, 53)); -#endif // __wasm_unimplemented_simd128__ - // i8x16 comparisons expect_vec( i8x16_eq( @@ -1320,8 +1241,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv u32x4(0, 0, 0, 0) ); -#ifdef __wasm_undefined_simd128__ - // f64x2 comparisons expect_vec(f64x2_eq((v128_t)f64x2(0, 1), (v128_t)f64x2(0, 0)), u64x2(-1, 0)); expect_vec(f64x2_ne((v128_t)f64x2(0, 1), (v128_t)f64x2(0, 0)), u64x2(0, -1)); @@ -1336,8 +1255,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_vec(f64x2_le((v128_t)f64x2(NAN, 0), (v128_t)f64x2(INFINITY, INFINITY)), u64x2(0, -1)); expect_vec(f64x2_ge((v128_t)f64x2(NAN, 0), (v128_t)f64x2(INFINITY, INFINITY)), u64x2(0, 0)); -#endif // __wasm_undefined_simd128__ - // bitwise operations expect_vec(v128_not((v128_t)i32x4(0, -1, 0, -1)), (v128_t)i32x4(-1, 0, -1, 0)); expect_vec( @@ -1353,14 +1270,14 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv i32x4(0, -1, -1, 0) ); -#ifdef __wasm_undefined_simd128__ +#ifdef __wasm_unimplemented_simd128__ expect_vec( v128_andnot((v128_t)i32x4(0, 0, -1, -1), (v128_t)i32x4(0, -1, 0, -1)), i32x4(0, -1, -1, 0) ); -#endif // __wasm_undefined_simd128__ +#endif // __wasm_unimplemented_simd128__ expect_vec( v128_bitselect( @@ -1383,32 +1300,31 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_eq(i8x16_all_true((v128_t)i8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), 0); expect_eq(i8x16_all_true((v128_t)i8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)), 0); expect_eq(i8x16_all_true((v128_t)i8x16(1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 0); - // https://bugs.chromium.org/p/v8/issues/detail?id=9372 - // expect_eq(i8x16_all_true((v128_t)i8x16(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 1); + expect_eq(i8x16_all_true((v128_t)i8x16(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 1); expect_vec( i8x16_shl((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 1), i8x16(0, 2, 4, 8, 16, 32, 64, -128, 0, 6, 12, 24, 48, 96, -64, -128) ); - /* expect_vec( */ - /* i8x16_shl((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), */ - /* i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) */ - /* ); */ + expect_vec( + i8x16_shl((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), + i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) + ); expect_vec( i8x16_shr_u((v128_t)u8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 1), u8x16(0, 0, 1, 2, 4, 8, 16, 32, 64, 1, 3, 6, 12, 24, 48, 96) ); - /* expect_vec( */ - /* i8x16_shr_u((v128_t)u8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), */ - /* u8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) */ - /* ); */ + expect_vec( + i8x16_shr_u((v128_t)u8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), + u8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) + ); expect_vec( i8x16_shr_s((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 1), i8x16(0, 0, 1, 2, 4, 8, 16, 32, -64, 1, 3, 6, 12, 24, 48, -32) ); - /* expect_vec( */ - /* i8x16_shr_s((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), */ - /* i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) */ - /* ); */ + expect_vec( + i8x16_shr_s((v128_t)i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64), 8), + i8x16(0, 1, 2, 4, 8, 16, 32, 64, -128, 3, 6, 12, 24, 48, 96, -64) + ); expect_vec( i8x16_add( (v128_t)i8x16(0, 42, 255, 128, 127, 129, 6, 29, 103, 196, 231, 142, 17, 250, 1, 73), @@ -1486,7 +1402,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), i8x16(3, 231, 255, 128, 129, 129, 103, 29, 103, 196, 231, 142, 17, 255, 127, 142) ); -#ifdef __wasm_unimplemented_simd__ expect_vec( i8x16_avgr_u( (v128_t)i8x16(0, 42, 255, 128, 127, 129, 6, 29, 103, 196, 231, 142, 17, 250, 1, 73), @@ -1494,7 +1409,6 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), i8x16(2, 137, 128, 128, 128, 68, 55, 23, 73, 113, 152, 92, 9, 253, 64, 108) ); -#endif // __wasm_unimplemented_simd__ // i16x8 arithmetic expect_vec( @@ -1508,31 +1422,31 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_eq(i16x8_all_true((v128_t)i16x8(0, 0, 0, 0, 0, 0, 0, 0)), 0); expect_eq(i16x8_all_true((v128_t)i16x8(0, 0, 1, 0, 0, 0, 0, 0)), 0); expect_eq(i16x8_all_true((v128_t)i16x8(1, 1, 1, 1, 1, 0, 1, 1)), 0); - // expect_eq(i16x8_all_true((v128_t)i16x8(1, 1, 1, 1, 1, 1, 1, 1)), 1); + expect_eq(i16x8_all_true((v128_t)i16x8(1, 1, 1, 1, 1, 1, 1, 1)), 1); expect_vec( i16x8_shl((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 1), i16x8(0, 16, 32, 256, 512, 4096, 8192, 0) ); - /* expect_vec( */ - /* i16x8_shl((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), */ - /* i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) */ - /* ); */ + expect_vec( + i16x8_shl((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), + i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) + ); expect_vec( i16x8_shr_u((v128_t)u16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 1), u16x8(0, 4, 8, 64, 128, 1024, 2048, 16384) ); - /* expect_vec( */ - /* i16x8_shr_u((v128_t)u16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), */ - /* u16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) */ - /* ); */ + expect_vec( + i16x8_shr_u((v128_t)u16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), + u16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) + ); expect_vec( i16x8_shr_s((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 1), i16x8(0, 4, 8, 64, 128, 1024, 2048, -16384) ); - /* expect_vec( */ - /* i16x8_shr_s((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), */ - /* i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) */ - /* ); */ + expect_vec( + i16x8_shr_s((v128_t)i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768), 16), + i16x8(0, 8, 16, 128, 256, 2048, 4096, -32768) + ); expect_vec( i16x8_add( (v128_t)i16x8(0, -256, -32768, 32512, -32512, -6400, -1536, 32766), @@ -1610,15 +1524,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), i16x8(768, -256, -32768, -32512, -32512, -6400, -256, 32766) ); -#ifdef __wasm_unimplemented_simd__ expect_vec( i16x8_max_u( (v128_t)i16x8(0, -256, -32768, 32512, -32512, -6400, -1536, 32766), (v128_t)i16x8(768, 1, -32768, -32512, 1536, 18688, -256, 2) ), - i16x8(384, 32641, -32768, -32768, 17280, -26624, -896, 16384) + i16x8(768, -256, -32768, -32512, -32512, -6400, -256, 32766) ); -#endif // __wasm_unimplemented_simd__ // i32x4 arithmetic expect_vec( @@ -1632,31 +1544,31 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv expect_eq(i32x4_all_true((v128_t)i32x4(0, 0, 0, 0)), 0); expect_eq(i32x4_all_true((v128_t)i32x4(0, 0, 1, 0)), 0); expect_eq(i32x4_all_true((v128_t)i32x4(1, 0, 1, 1)), 0); - // expect_eq(i32x4_all_true((v128_t)i32x4(1, 1, 1, 1)), 1); + expect_eq(i32x4_all_true((v128_t)i32x4(1, 1, 1, 1)), 1); expect_vec( i32x4_shl((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 1), i32x4(2, 0x80000000, 0, -2) ); - /* expect_vec( */ - /* i32x4_shl((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 32), */ - /* i32x4(1, 0x40000000, 0x80000000, -1) */ - /* ); */ + expect_vec( + i32x4_shl((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 32), + i32x4(1, 0x40000000, 0x80000000, -1) + ); expect_vec( i32x4_shr_s((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 1), i32x4(0, 0x20000000, 0xc0000000, -1) ); - /* expect_vec( */ - /* i32x4_shr_s((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 32), */ - /* i32x4(1, 0x40000000, 0x80000000, -1) */ - /* ); */ + expect_vec( + i32x4_shr_s((v128_t)i32x4(1, 0x40000000, 0x80000000, -1), 32), + i32x4(1, 0x40000000, 0x80000000, -1) + ); expect_vec( i32x4_shr_u((v128_t)u32x4(1, 0x40000000, 0x80000000, -1), 1), u32x4(0, 0x20000000, 0x40000000, 0x7fffffff) ); - /* expect_vec( */ - /* i32x4_shr_u((v128_t)u32x4(1, 0x40000000, 0x80000000, -1), 32), */ - /* u32x4(1, 0x40000000, 0x80000000, -1) */ - /* ); */ + expect_vec( + i32x4_shr_u((v128_t)u32x4(1, 0x40000000, 0x80000000, -1), 32), + u32x4(1, 0x40000000, 0x80000000, -1) + ); expect_vec( i32x4_add((v128_t)i32x4(0, 0x80000001, 42, 5), (v128_t)i32x4(0, 0x80000001, 5, 42)), i32x4(0, 2, 47, 47) @@ -1686,17 +1598,14 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv i32x4(0x80000001, -42, 42, -5) ); - -#ifdef __wasm_unimplemented_simd128__ - // i64x2 arithmetic expect_vec(i64x2_neg((v128_t)i64x2(0x8000000000000000, 42)), i64x2(0x8000000000000000, -42)); - expect_eq(i64x2_any_true((v128_t)i64x2(0, 0)), 0); - expect_eq(i64x2_any_true((v128_t)i64x2(1, 0)), 1); - expect_eq(i64x2_any_true((v128_t)i64x2(1, 1)), 1); - expect_eq(i64x2_all_true((v128_t)i64x2(0, 0)), 0); - expect_eq(i64x2_all_true((v128_t)i64x2(1, 0)), 0); - // expect_eq(i64x2_all_true((v128_t)i64x2(1, 1)), 1); + /* expect_eq(i64x2_any_true((v128_t)i64x2(0, 0)), 0); */ + /* expect_eq(i64x2_any_true((v128_t)i64x2(1, 0)), 1); */ + /* expect_eq(i64x2_any_true((v128_t)i64x2(1, 1)), 1); */ + /* expect_eq(i64x2_all_true((v128_t)i64x2(0, 0)), 0); */ + /* expect_eq(i64x2_all_true((v128_t)i64x2(1, 0)), 0); */ + /* expect_eq(i64x2_all_true((v128_t)i64x2(1, 1)), 1); */ expect_vec(i64x2_shl((v128_t)i64x2(1, 0x8000000000000000), 1), i64x2(2, 0)); expect_vec(i64x2_shl((v128_t)i64x2(1, 0x8000000000000000), 64), i64x2(1, 0x8000000000000000)); @@ -1713,18 +1622,10 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv i64x2(0x8000000000000001, 42) ); -#endif // __wasm_unimplemented_simd128__ - // f32x4 arithmetic expect_vec(f32x4_abs((v128_t)f32x4(-0., NAN, -INFINITY, 5)), f32x4(0, NAN, INFINITY, 5)); expect_vec(f32x4_neg((v128_t)f32x4(-0., NAN, -INFINITY, 5)), f32x4(0, -NAN, INFINITY, -5)); - -#ifdef __wasm_unimplemented_simd128__ - expect_vec(f32x4_sqrt((v128_t)f32x4(0., NAN, INFINITY, 4)), f32x4(-0., NAN, INFINITY, 2)); - -#endif // __wasm_unimplemented_simd128__ - // TODO: test QFMA/QFMS expect_vec( f32x4_add((v128_t)f32x4(NAN, -NAN, INFINITY, 42), (v128_t)f32x4(42, INFINITY, INFINITY, 1)), @@ -1751,19 +1652,15 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv f32x4(0, 0, NAN, NAN) ); -#ifdef __wasm_unimplemented_simd128__ - // f64x2 arithmetic expect_vec(f64x2_abs((v128_t)f64x2(-0., NAN)), f64x2(0, NAN)); expect_vec(f64x2_abs((v128_t)f64x2(-INFINITY, 5)), f64x2(INFINITY, 5)); - expect_vec(f64x2_neg((v128_t)f64x2(-0., NAN)), f64x2(0, -NAN)); expect_vec(f64x2_neg((v128_t)f64x2(-INFINITY, 5)), f64x2(INFINITY, -5)); - // TODO: test QFMA/QFMS - expect_vec(f64x2_sqrt((v128_t)f64x2(-0., NAN)), f64x2(-0., NAN)); - expect_vec(f64x2_sqrt((v128_t)f64x2(INFINITY, 4)), f64x2(INFINITY, 2)); - + // https://bugs.chromium.org/p/v8/issues/detail?id=10170 + // expect_vec(f64x2_sqrt((v128_t)f64x2(-0., NAN)), f64x2(-0., NAN)); + //expect_vec(f64x2_sqrt((v128_t)f64x2(INFINITY, 4)), f64x2(INFINITY, 2)); expect_vec( f64x2_add((v128_t)f64x2(NAN, -NAN), (v128_t)f64x2(42, INFINITY)), f64x2(NAN, -NAN) @@ -1796,14 +1693,11 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv f64x2_div((v128_t)f64x2(INFINITY, 42), (v128_t)f64x2(2, 2)), f64x2(INFINITY, 21) ); - expect_vec(f64x2_min((v128_t)f64x2(-0., 0), (v128_t)f64x2(0, -0)), f64x2(-0., -0)); expect_vec(f64x2_min((v128_t)f64x2(NAN, 5), (v128_t)f64x2(5, NAN)), f64x2(NAN, NAN)); expect_vec(f64x2_max((v128_t)f64x2(-0., 0), (v128_t)f64x2(0, -0)), f64x2(0, 0)); expect_vec(f64x2_max((v128_t)f64x2(NAN, 5), (v128_t)f64x2(5, NAN)), f64x2(NAN, NAN)); -#endif // __wasm_unimplemented_simd128__ - // conversions expect_vec( i32x4_trunc_s_f32x4_sat((v128_t)f32x4(42, NAN, INFINITY, -INFINITY)), @@ -1863,14 +1757,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), i8x16(127, 127, -128, 127, -128, -1, 1, 0, 0, 1, -1, -128, 127, -128, 127, 127) ); - // https://bugs.chromium.org/p/v8/issues/detail?id=9729 - /* expect_vec( */ - /* i8x16_narrow_i16x8_u( */ - /* (v128_t)i16x8(129, 127, -32767, 32767, -32768, -1, 1, 0), */ - /* (v128_t)i16x8(0, 1, -1, -32768, 32767, -32767, 127, 129) */ - /* ), */ - /* i8x16(129, 127, 0, 255, 0, 0, 1, 0, 0, 1, 0, 0, 255, 0, 127, 129) */ - /* ); */ + expect_vec( + i8x16_narrow_i16x8_u( + (v128_t)i16x8(129, 127, -32767, 32767, -32768, -1, 1, 0), + (v128_t)i16x8(0, 1, -1, -32768, 32767, -32767, 127, 129) + ), + i8x16(129, 127, 0, 255, 0, 0, 1, 0, 0, 1, 0, 0, 255, 0, 127, 129) + ); expect_vec( i16x8_narrow_i32x4_s( (v128_t)i32x4(32769, 32767, -2147483647, 2147483647), @@ -1878,14 +1771,13 @@ int EMSCRIPTEN_KEEPALIVE __attribute__((__optnone__)) main(int argc, char** argv ), i16x8(32767, 32767, -32768, 32767, 0, 1, -1, -32768) ); - // https://bugs.chromium.org/p/v8/issues/detail?id=9729 - /* expect_vec( */ - /* i16x8_narrow_i32x4_u( */ - /* (v128_t)i32x4(32769, 32767, -2147483647, 2147483647), */ - /* (v128_t)i32x4(0, 1, -1, -2147483647 - 1) */ - /* ), */ - /* i16x8(-32767, 32767, 0, -1, 0, 1, 0, 0) */ - /* ); */ + expect_vec( + i16x8_narrow_i32x4_u( + (v128_t)i32x4(32769, 32767, -2147483647, 2147483647), + (v128_t)i32x4(0, 1, -1, -2147483647 - 1) + ), + i16x8(-32767, 32767, 0, -1, 0, 1, 0, 0) + ); expect_vec( i16x8_widen_low_i8x16_s( (v128_t)i8x16(0, 1, -1, -128, 127, 129, 64, -64, -64, 64, 129, 127, -128, -1, 1, 0)