Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 17 additions & 41 deletions system/include/wasm_simd128.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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__({ \
Expand Down Expand Up @@ -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); \
Expand All @@ -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__({ \
Expand All @@ -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};
Expand All @@ -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))
Expand All @@ -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))

Expand All @@ -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};
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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!',
Expand Down
Loading