diff options
author | Shravan Narayan <shravanrn@gmail.com> | 2023-07-30 14:27:04 -0400 |
---|---|---|
committer | Shravan Narayan <shravanrn@gmail.com> | 2023-07-30 15:18:49 -0400 |
commit | 70b1c9d2652bae15785ceb449fda44fe31bbe0d5 (patch) | |
tree | 354e555be1118c6d5716d337591b132b97b076f7 | |
parent | 319f0c6112caa407c6b354772beda4ef986bac72 (diff) | |
download | wabt-70b1c9d2652bae15785ceb449fda44fe31bbe0d5.tar.gz wabt-70b1c9d2652bae15785ceb449fda44fe31bbe0d5.tar.bz2 wabt-70b1c9d2652bae15785ceb449fda44fe31bbe0d5.zip |
wasm2c: ensure force read constraints compile for clang on mips
-rw-r--r-- | src/prebuilt/wasm2c_atomicops_source_declarations.cc | 18 | ||||
-rw-r--r-- | src/prebuilt/wasm2c_simd_source_declarations.cc | 4 | ||||
-rw-r--r-- | src/prebuilt/wasm2c_source_declarations.cc | 56 | ||||
-rw-r--r-- | src/template/wasm2c.declarations.c | 48 | ||||
-rw-r--r-- | src/template/wasm2c_atomicops.declarations.c | 18 | ||||
-rw-r--r-- | src/template/wasm2c_simd.declarations.c | 4 | ||||
-rw-r--r-- | test/wasm2c/add.txt | 48 | ||||
-rw-r--r-- | test/wasm2c/check-imports.txt | 48 | ||||
-rw-r--r-- | test/wasm2c/export-names.txt | 48 | ||||
-rw-r--r-- | test/wasm2c/hello.txt | 48 | ||||
-rw-r--r-- | test/wasm2c/minimal.txt | 48 | ||||
-rw-r--r-- | wasm2c/examples/fac/fac.c | 48 |
12 files changed, 254 insertions, 182 deletions
diff --git a/src/prebuilt/wasm2c_atomicops_source_declarations.cc b/src/prebuilt/wasm2c_atomicops_source_declarations.cc index 61e88df5..91b6929e 100644 --- a/src/prebuilt/wasm2c_atomicops_source_declarations.cc +++ b/src/prebuilt/wasm2c_atomicops_source_declarations.cc @@ -225,7 +225,7 @@ R"w2c_template( TRAP(UNALIGNED); \ R"w2c_template( } )w2c_template" R"w2c_template( -#define DEFINE_ATOMIC_LOAD(name, t1, t2, t3) \ +#define DEFINE_ATOMIC_LOAD(name, t1, t2, t3, force_read) \ )w2c_template" R"w2c_template( static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ )w2c_template" @@ -239,26 +239,26 @@ R"w2c_template( wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ )w2c_template" R"w2c_template( result = atomic_load_##t1(&mem->data[addr]); \ )w2c_template" -R"w2c_template( wasm_asm("" ::"r"(result)); \ +R"w2c_template( force_read(result); \ )w2c_template" R"w2c_template( return (t3)(t2)result; \ )w2c_template" R"w2c_template( } )w2c_template" R"w2c_template( -DEFINE_ATOMIC_LOAD(i32_atomic_load, u32, u32, u32) +DEFINE_ATOMIC_LOAD(i32_atomic_load, u32, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load, u64, u64, u64) +R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load, u64, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i32_atomic_load8_u, u8, u32, u32) +R"w2c_template(DEFINE_ATOMIC_LOAD(i32_atomic_load8_u, u8, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load8_u, u8, u64, u64) +R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load8_u, u8, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i32_atomic_load16_u, u16, u32, u32) +R"w2c_template(DEFINE_ATOMIC_LOAD(i32_atomic_load16_u, u16, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load16_u, u16, u64, u64) +R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load16_u, u16, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load32_u, u32, u64, u64) +R"w2c_template(DEFINE_ATOMIC_LOAD(i64_atomic_load32_u, u32, u64, u64, FORCE_READ_INT) )w2c_template" R"w2c_template( #define DEFINE_ATOMIC_STORE(name, t1, t2) \ diff --git a/src/prebuilt/wasm2c_simd_source_declarations.cc b/src/prebuilt/wasm2c_simd_source_declarations.cc index cc8bd8c6..bbd10ee5 100644 --- a/src/prebuilt/wasm2c_simd_source_declarations.cc +++ b/src/prebuilt/wasm2c_simd_source_declarations.cc @@ -1,6 +1,6 @@ -const char* s_simd_source_declarations = R"w2c_template(#ifdef __x86_64__ +const char* s_simd_source_declarations = R"w2c_template(#if defined(__GNUC__) && defined(__x86_64__) )w2c_template" -R"w2c_template(#define SIMD_FORCE_READ(var) wasm_asm("" ::"x"(var)); +R"w2c_template(#define SIMD_FORCE_READ(var) __asm__("" ::"x"(var)); )w2c_template" R"w2c_template(#else )w2c_template" diff --git a/src/prebuilt/wasm2c_source_declarations.cc b/src/prebuilt/wasm2c_source_declarations.cc index ca541778..5b076796 100644 --- a/src/prebuilt/wasm2c_source_declarations.cc +++ b/src/prebuilt/wasm2c_source_declarations.cc @@ -88,11 +88,27 @@ R"w2c_template(#endif R"w2c_template( #ifdef __GNUC__ )w2c_template" -R"w2c_template(#define wasm_asm __asm__ +R"w2c_template(#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +)w2c_template" +R"w2c_template(// Clang on Mips requires "f" constraints on floats +)w2c_template" +R"w2c_template(#if defined(__clang__) && \ +)w2c_template" +R"w2c_template( (defined(mips) || defined(__mips__) || defined(__mips)) +)w2c_template" +R"w2c_template(#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); +)w2c_template" +R"w2c_template(#else +)w2c_template" +R"w2c_template(#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +)w2c_template" +R"w2c_template(#endif )w2c_template" R"w2c_template(#else )w2c_template" -R"w2c_template(#define wasm_asm(X) +R"w2c_template(#define FORCE_READ_INT(var) +)w2c_template" +R"w2c_template(#define FORCE_READ_FLOAT(var) )w2c_template" R"w2c_template(#endif )w2c_template" @@ -135,7 +151,7 @@ R"w2c_template( load_data(&(m.data[m.size - o - s]), i, s); \ )w2c_template" R"w2c_template( } while (0) )w2c_template" -R"w2c_template(#define DEFINE_LOAD(name, t1, t2, t3) \ +R"w2c_template(#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ )w2c_template" R"w2c_template( static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ )w2c_template" @@ -147,7 +163,7 @@ R"w2c_template( wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof( )w2c_template" R"w2c_template( sizeof(t1)); \ )w2c_template" -R"w2c_template( wasm_asm("" ::"r"(result)); \ +R"w2c_template( force_read(result); \ )w2c_template" R"w2c_template( return (t3)(t2)result; \ )w2c_template" @@ -192,7 +208,7 @@ R"w2c_template( load_data(&(m.data[o]), i, s); \ )w2c_template" R"w2c_template( } while (0) )w2c_template" -R"w2c_template(#define DEFINE_LOAD(name, t1, t2, t3) \ +R"w2c_template(#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ )w2c_template" R"w2c_template( static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ )w2c_template" @@ -202,7 +218,7 @@ R"w2c_template( t1 result; \ )w2c_template" R"w2c_template( wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ )w2c_template" -R"w2c_template( wasm_asm("" ::"r"(result)); \ +R"w2c_template( force_read(result); \ )w2c_template" R"w2c_template( return (t3)(t2)result; \ )w2c_template" @@ -224,33 +240,33 @@ R"w2c_template( } R"w2c_template(#endif )w2c_template" R"w2c_template( -DEFINE_LOAD(i32_load, u32, u32, u32) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load, u64, u64, u64) +R"w2c_template(DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(f32_load, f32, f32, f32) +R"w2c_template(DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) )w2c_template" -R"w2c_template(DEFINE_LOAD(f64_load, f64, f64, f64) +R"w2c_template(DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i32_load8_s, s8, s32, u32) +R"w2c_template(DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load8_s, s8, s64, u64) +R"w2c_template(DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i32_load8_u, u8, u32, u32) +R"w2c_template(DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load8_u, u8, u64, u64) +R"w2c_template(DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i32_load16_s, s16, s32, u32) +R"w2c_template(DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load16_s, s16, s64, u64) +R"w2c_template(DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i32_load16_u, u16, u32, u32) +R"w2c_template(DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load16_u, u16, u64, u64) +R"w2c_template(DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load32_s, s32, s64, u64) +R"w2c_template(DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) )w2c_template" -R"w2c_template(DEFINE_LOAD(i64_load32_u, u32, u64, u64) +R"w2c_template(DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) )w2c_template" R"w2c_template(DEFINE_STORE(i32_store, u32, u32) )w2c_template" diff --git a/src/template/wasm2c.declarations.c b/src/template/wasm2c.declarations.c index 2e4fefb9..a1105fb9 100644 --- a/src/template/wasm2c.declarations.c +++ b/src/template/wasm2c.declarations.c @@ -48,9 +48,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -72,13 +80,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -101,12 +109,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -118,20 +126,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/src/template/wasm2c_atomicops.declarations.c b/src/template/wasm2c_atomicops.declarations.c index fa16bc31..78d9772e 100644 --- a/src/template/wasm2c_atomicops.declarations.c +++ b/src/template/wasm2c_atomicops.declarations.c @@ -125,24 +125,24 @@ TRAP(UNALIGNED); \ } -#define DEFINE_ATOMIC_LOAD(name, t1, t2, t3) \ +#define DEFINE_ATOMIC_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ ATOMIC_ALIGNMENT_CHECK(addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ result = atomic_load_##t1(&mem->data[addr]); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } -DEFINE_ATOMIC_LOAD(i32_atomic_load, u32, u32, u32) -DEFINE_ATOMIC_LOAD(i64_atomic_load, u64, u64, u64) -DEFINE_ATOMIC_LOAD(i32_atomic_load8_u, u8, u32, u32) -DEFINE_ATOMIC_LOAD(i64_atomic_load8_u, u8, u64, u64) -DEFINE_ATOMIC_LOAD(i32_atomic_load16_u, u16, u32, u32) -DEFINE_ATOMIC_LOAD(i64_atomic_load16_u, u16, u64, u64) -DEFINE_ATOMIC_LOAD(i64_atomic_load32_u, u32, u64, u64) +DEFINE_ATOMIC_LOAD(i32_atomic_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i64_atomic_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i32_atomic_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i64_atomic_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i32_atomic_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i64_atomic_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_ATOMIC_LOAD(i64_atomic_load32_u, u32, u64, u64, FORCE_READ_INT) #define DEFINE_ATOMIC_STORE(name, t1, t2) \ static inline void name(wasm_rt_memory_t* mem, u64 addr, t2 value) { \ diff --git a/src/template/wasm2c_simd.declarations.c b/src/template/wasm2c_simd.declarations.c index d6c2af73..aee5d600 100644 --- a/src/template/wasm2c_simd.declarations.c +++ b/src/template/wasm2c_simd.declarations.c @@ -1,5 +1,5 @@ -#ifdef __x86_64__ -#define SIMD_FORCE_READ(var) wasm_asm("" ::"x"(var)); +#if defined(__GNUC__) && defined(__x86_64__) +#define SIMD_FORCE_READ(var) __asm__("" ::"x"(var)); #else #define SIMD_FORCE_READ(var) #endif diff --git a/test/wasm2c/add.txt b/test/wasm2c/add.txt index 59e2d3f3..e4ccbde7 100644 --- a/test/wasm2c/add.txt +++ b/test/wasm2c/add.txt @@ -115,9 +115,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -139,13 +147,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -168,12 +176,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -185,20 +193,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/test/wasm2c/check-imports.txt b/test/wasm2c/check-imports.txt index 6b20bcf1..39d3fb3c 100644 --- a/test/wasm2c/check-imports.txt +++ b/test/wasm2c/check-imports.txt @@ -138,9 +138,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -162,13 +170,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -191,12 +199,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -208,20 +216,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/test/wasm2c/export-names.txt b/test/wasm2c/export-names.txt index 34cdaf40..1913d955 100644 --- a/test/wasm2c/export-names.txt +++ b/test/wasm2c/export-names.txt @@ -138,9 +138,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -162,13 +170,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -191,12 +199,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -208,20 +216,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/test/wasm2c/hello.txt b/test/wasm2c/hello.txt index a0cb344e..05af5b00 100644 --- a/test/wasm2c/hello.txt +++ b/test/wasm2c/hello.txt @@ -146,9 +146,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -170,13 +178,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -199,12 +207,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -216,20 +224,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/test/wasm2c/minimal.txt b/test/wasm2c/minimal.txt index 498d9472..5ee6bfce 100644 --- a/test/wasm2c/minimal.txt +++ b/test/wasm2c/minimal.txt @@ -109,9 +109,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -133,13 +141,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -162,12 +170,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -179,20 +187,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) diff --git a/wasm2c/examples/fac/fac.c b/wasm2c/examples/fac/fac.c index 819a4ebf..f0ba9511 100644 --- a/wasm2c/examples/fac/fac.c +++ b/wasm2c/examples/fac/fac.c @@ -67,9 +67,17 @@ static inline bool func_types_eq(const wasm_rt_func_type_t a, #endif #ifdef __GNUC__ -#define wasm_asm __asm__ +#define FORCE_READ_INT(var) __asm__("" ::"r"(var)); +// Clang on Mips requires "f" constraints on floats +#if defined(__clang__) && \ + (defined(mips) || defined(__mips__) || defined(__mips)) +#define FORCE_READ_FLOAT(var) __asm__("" ::"f"(var)); #else -#define wasm_asm(X) +#define FORCE_READ_FLOAT(var) __asm__("" ::"r"(var)); +#endif +#else +#define FORCE_READ_INT(var) +#define FORCE_READ_FLOAT(var) #endif #if WABT_BIG_ENDIAN @@ -91,13 +99,13 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), m.size - o - s, s); \ load_data(&(m.data[m.size - o - s]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[mem->size - addr - sizeof(t1)], \ sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -120,12 +128,12 @@ static inline void load_data(void* dest, const void* src, size_t n) { RANGE_CHECK((&m), o, s); \ load_data(&(m.data[o]), i, s); \ } while (0) -#define DEFINE_LOAD(name, t1, t2, t3) \ +#define DEFINE_LOAD(name, t1, t2, t3, force_read) \ static inline t3 name(wasm_rt_memory_t* mem, u64 addr) { \ MEMCHECK(mem, addr, t1); \ t1 result; \ wasm_rt_memcpy(&result, &mem->data[addr], sizeof(t1)); \ - wasm_asm("" ::"r"(result)); \ + force_read(result); \ return (t3)(t2)result; \ } @@ -137,20 +145,20 @@ static inline void load_data(void* dest, const void* src, size_t n) { } #endif -DEFINE_LOAD(i32_load, u32, u32, u32) -DEFINE_LOAD(i64_load, u64, u64, u64) -DEFINE_LOAD(f32_load, f32, f32, f32) -DEFINE_LOAD(f64_load, f64, f64, f64) -DEFINE_LOAD(i32_load8_s, s8, s32, u32) -DEFINE_LOAD(i64_load8_s, s8, s64, u64) -DEFINE_LOAD(i32_load8_u, u8, u32, u32) -DEFINE_LOAD(i64_load8_u, u8, u64, u64) -DEFINE_LOAD(i32_load16_s, s16, s32, u32) -DEFINE_LOAD(i64_load16_s, s16, s64, u64) -DEFINE_LOAD(i32_load16_u, u16, u32, u32) -DEFINE_LOAD(i64_load16_u, u16, u64, u64) -DEFINE_LOAD(i64_load32_s, s32, s64, u64) -DEFINE_LOAD(i64_load32_u, u32, u64, u64) +DEFINE_LOAD(i32_load, u32, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load, u64, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(f32_load, f32, f32, f32, FORCE_READ_FLOAT) +DEFINE_LOAD(f64_load, f64, f64, f64, FORCE_READ_FLOAT) +DEFINE_LOAD(i32_load8_s, s8, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_s, s8, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load8_u, u8, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load8_u, u8, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_s, s16, s32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_s, s16, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i32_load16_u, u16, u32, u32, FORCE_READ_INT) +DEFINE_LOAD(i64_load16_u, u16, u64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_s, s32, s64, u64, FORCE_READ_INT) +DEFINE_LOAD(i64_load32_u, u32, u64, u64, FORCE_READ_INT) DEFINE_STORE(i32_store, u32, u32) DEFINE_STORE(i64_store, u64, u64) DEFINE_STORE(f32_store, f32, f32) |