@@ -32,14 +32,7 @@ typedef double __f64x2 __attribute__((__vector_size__(16), __aligned__(16)));
3232
3333#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("simd128"), __min_vector_width__(128)))
3434
35- #ifdef __cplusplus
36- #include < type_traits>
37- #define __SAME_TYPE (t1, t2 ) (std::is_same<t1, t2>::value)
38- #else
39- #define __SAME_TYPE (t1, t2 ) (__builtin_types_compatible_p(t1, t2))
40- #endif
41-
42- #define __REQUIRE_CONSTANT (e, ty, msg ) _Static_assert (__builtin_constant_p(e) && __SAME_TYPE(__typeof__(e), ty), msg)
35+ #define __REQUIRE_CONSTANT (e ) _Static_assert(__builtin_constant_p(e), "Expected constant")
4336
4437// v128 wasm_v128_load(void* mem)
4538static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_v128_load (const void * __mem ) {
@@ -196,78 +189,78 @@ static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_f64x2_make(double c0, double c1
196189// v128_t wasm_i8x16_constant(...)
197190#define wasm_i8x16_const (c0 , c1 , c2 , c3 , c4 , c5 , c6 , c7 , c8 , c9 , c10 , c11 , c12 , c13 , c14 , c15 ) \
198191 __extension__({ \
199- __REQUIRE_CONSTANT (c0, int8_t , " expected constant int8_t " ); \
200- __REQUIRE_CONSTANT (c1, int8_t , " expected constant int8_t " ); \
201- __REQUIRE_CONSTANT (c2, int8_t , " expected constant int8_t " ); \
202- __REQUIRE_CONSTANT (c3, int8_t , " expected constant int8_t " ); \
203- __REQUIRE_CONSTANT (c4, int8_t , " expected constant int8_t " ); \
204- __REQUIRE_CONSTANT (c5, int8_t , " expected constant int8_t " ); \
205- __REQUIRE_CONSTANT (c6, int8_t , " expected constant int8_t " ); \
206- __REQUIRE_CONSTANT (c7, int8_t , " expected constant int8_t " ); \
207- __REQUIRE_CONSTANT (c8, int8_t , " expected constant int8_t " ); \
208- __REQUIRE_CONSTANT (c9, int8_t , " expected constant int8_t " ); \
209- __REQUIRE_CONSTANT (c10, int8_t , " expected constant int8_t " ); \
210- __REQUIRE_CONSTANT (c11, int8_t , " expected constant int8_t " ); \
211- __REQUIRE_CONSTANT (c12, int8_t , " expected constant int8_t " ); \
212- __REQUIRE_CONSTANT (c13, int8_t , " expected constant int8_t " ); \
213- __REQUIRE_CONSTANT (c14, int8_t , " expected constant int8_t " ); \
214- __REQUIRE_CONSTANT (c15, int8_t , " expected constant int8_t " ); \
192+ __REQUIRE_CONSTANT(c0); \
193+ __REQUIRE_CONSTANT(c1); \
194+ __REQUIRE_CONSTANT(c2); \
195+ __REQUIRE_CONSTANT(c3); \
196+ __REQUIRE_CONSTANT(c4); \
197+ __REQUIRE_CONSTANT(c5); \
198+ __REQUIRE_CONSTANT(c6); \
199+ __REQUIRE_CONSTANT(c7); \
200+ __REQUIRE_CONSTANT(c8); \
201+ __REQUIRE_CONSTANT(c9); \
202+ __REQUIRE_CONSTANT(c10); \
203+ __REQUIRE_CONSTANT(c11); \
204+ __REQUIRE_CONSTANT(c12); \
205+ __REQUIRE_CONSTANT(c13); \
206+ __REQUIRE_CONSTANT(c14); \
207+ __REQUIRE_CONSTANT(c15); \
215208 (v128_t)(__i8x16){c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15}; \
216209 })
217210
218211// v128_t wasm_i16x8_constant(...)
219- #define wasm_i16x8_const (c0, c1, c2, c3, c4, c5, c6, c7 ) \
220- __extension__ ({ \
221- __REQUIRE_CONSTANT (c0, int16_t , " expected constant int16_t " ); \
222- __REQUIRE_CONSTANT (c1, int16_t , " expected constant int16_t " ); \
223- __REQUIRE_CONSTANT (c2, int16_t , " expected constant int16_t " ); \
224- __REQUIRE_CONSTANT (c3, int16_t , " expected constant int16_t " ); \
225- __REQUIRE_CONSTANT (c4, int16_t , " expected constant int16_t " ); \
226- __REQUIRE_CONSTANT (c5, int16_t , " expected constant int16_t " ); \
227- __REQUIRE_CONSTANT (c6, int16_t , " expected constant int16_t " ); \
228- __REQUIRE_CONSTANT (c7, int16_t , " expected constant int16_t " ); \
229- (v128_t )(__i16x8){c0, c1, c2, c3, c4, c5, c6, c7}; \
212+ #define wasm_i16x8_const (c0 , c1 , c2 , c3 , c4 , c5 , c6 , c7 ) \
213+ __extension__({ \
214+ __REQUIRE_CONSTANT(c0); \
215+ __REQUIRE_CONSTANT(c1); \
216+ __REQUIRE_CONSTANT(c2); \
217+ __REQUIRE_CONSTANT(c3); \
218+ __REQUIRE_CONSTANT(c4); \
219+ __REQUIRE_CONSTANT(c5); \
220+ __REQUIRE_CONSTANT(c6); \
221+ __REQUIRE_CONSTANT(c7); \
222+ (v128_t)(__i16x8){c0, c1, c2, c3, c4, c5, c6, c7}; \
230223 })
231224
232225// v128_t wasm_i32x4_constant(...)
233- #define wasm_i32x4_const (c0, c1, c2, c3 ) \
234- __extension__ ({ \
235- __REQUIRE_CONSTANT (c0, int32_t , " expected constant int32_t " ); \
236- __REQUIRE_CONSTANT (c1, int32_t , " expected constant int32_t " ); \
237- __REQUIRE_CONSTANT (c2, int32_t , " expected constant int32_t " ); \
238- __REQUIRE_CONSTANT (c3, int32_t , " expected constant int32_t " ); \
239- (v128_t )(__i32x4){c0, c1, c2, c3}; \
226+ #define wasm_i32x4_const (c0 , c1 , c2 , c3 ) \
227+ __extension__({ \
228+ __REQUIRE_CONSTANT(c0); \
229+ __REQUIRE_CONSTANT(c1); \
230+ __REQUIRE_CONSTANT(c2); \
231+ __REQUIRE_CONSTANT(c3); \
232+ (v128_t)(__i32x4){c0, c1, c2, c3}; \
240233 })
241234
242235// v128_t wasm_f32x4_constant(...)
243- #define wasm_f32x4_const (c0, c1, c2, c3 ) \
244- __extension__ ({ \
245- __REQUIRE_CONSTANT (c0, float , " expected constant float " ); \
246- __REQUIRE_CONSTANT (c1, float , " expected constant float " ); \
247- __REQUIRE_CONSTANT (c2, float , " expected constant float " ); \
248- __REQUIRE_CONSTANT (c3, float , " expected constant float " ); \
249- (v128_t )(__f32x4){c0, c1, c2, c3}; \
236+ #define wasm_f32x4_const (c0 , c1 , c2 , c3 ) \
237+ __extension__({ \
238+ __REQUIRE_CONSTANT(c0); \
239+ __REQUIRE_CONSTANT(c1); \
240+ __REQUIRE_CONSTANT(c2); \
241+ __REQUIRE_CONSTANT(c3); \
242+ (v128_t)(__f32x4){c0, c1, c2, c3}; \
250243 })
251244
252245#ifdef __wasm_unimplemented_simd128__
253246
254247// v128_t wasm_i64x2_constant(...)
255- #define wasm_i64x2_const (c0, c1 ) \
256- __extension__ ({ \
257- __REQUIRE_CONSTANT (c0, int64_t , " expected constant int64_t " ); \
258- __REQUIRE_CONSTANT (c1, int64_t , " expected constant int64_t " ); \
259- (v128_t )(__i64x2){c0, c1}; \
248+ #define wasm_i64x2_const (c0 , c1 ) \
249+ __extension__({ \
250+ __REQUIRE_CONSTANT(c0); \
251+ __REQUIRE_CONSTANT(c1); \
252+ (v128_t)(__i64x2){c0, c1}; \
260253 })
261254
262255// v128_t wasm_f64x2_constant(...)
263256#define wasm_f64x2_const (c0 , c1 ) \
264257 __extension__({ \
265- __REQUIRE_CONSTANT (c0, double , " expected constant double " ); \
266- __REQUIRE_CONSTANT (c1, double , " expected constant double " ); \
258+ __REQUIRE_CONSTANT(c0); \
259+ __REQUIRE_CONSTANT(c1); \
267260 (v128_t)(__f64x2){c0, c1}; \
268261 })
269262
270- #endif // __wasm_unimplemented_sidm128__
263+ #endif // __wasm_unimplemented_simd128__
271264
272265// v128_t wasm_i8x16_splat(int8_t a)
273266static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_splat (int8_t a ) {
0 commit comments