From 84d627db937914840389033421c03e9d43d60f29 Mon Sep 17 00:00:00 2001 From: Maks Litskevich Date: Fri, 24 Jan 2025 12:27:33 +0000 Subject: [PATCH] Fix load/store Fix v128 load/store style --- core/iwasm/interpreter/wasm_interp_fast.c | 22 +++++++--------------- core/iwasm/interpreter/wasm_loader.c | 4 ---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/core/iwasm/interpreter/wasm_interp_fast.c b/core/iwasm/interpreter/wasm_interp_fast.c index f66a4d6987..298d39668b 100644 --- a/core/iwasm/interpreter/wasm_interp_fast.c +++ b/core/iwasm/interpreter/wasm_interp_fast.c @@ -5766,10 +5766,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, case SIMD_v128_load: { uint32 offset, addr; - offset = read_uint32( - frame_ip); // TODO: Check with an offset! - addr = GET_OPERAND(uint32, I32, 0); - frame_ip += 2; + offset = read_uint32(frame_ip); + addr = POP_I32(); addr_ret = GET_OFFSET(); CHECK_MEMORY_OVERFLOW(16); PUT_V128_TO_ADDR(frame_lp + addr_ret, LOAD_V128(maddr)); @@ -5879,8 +5877,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, { uint32 offset, addr; offset = read_uint32(frame_ip); - frame_ip += 2; - addr = GET_OPERAND(uint32, I32, 0); + V128 data = POP_V128(); + addr = POP_I32(); V128 data; data = POP_V128(); @@ -6393,7 +6391,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, #define SIMD_LOAD_LANE_COMMON(vec, register, lane, width) \ do { \ - addr = GET_OPERAND(uint32, I32, 0); \ addr_ret = GET_OFFSET(); \ CHECK_MEMORY_OVERFLOW(width / 8); \ if (width == 64) { \ @@ -6410,8 +6407,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint32 offset, addr; \ offset = read_uint32(frame_ip); \ V128 vec = POP_V128(); \ - int32 base = POP_I32(); \ - offset += base; \ + addr = POP_I32(); \ int lane = *frame_ip++; \ SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ } while (0) @@ -6441,11 +6437,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint32 offset, addr; \ offset = read_uint32(frame_ip); \ V128 vec = POP_V128(); \ - int32 base = POP_I32(); \ - offset += base; \ + addr = POP_I32(); \ int lane = *frame_ip++; \ - addr = GET_OPERAND(uint32, I32, 0); \ - addr_ret = GET_OFFSET(); \ CHECK_MEMORY_OVERFLOW(width / 8); \ if (width == 64) { \ STORE_I64(maddr, vec.register[lane]); \ @@ -6482,8 +6475,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, do { \ uint32 offset, addr; \ offset = read_uint32(frame_ip); \ - int32 base = POP_I32(); \ - offset += base; \ + addr = POP_I32(); \ int32 lane = 0; \ V128 vec = { 0 }; \ SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 10a5573a78..a39dff89dc 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -15362,10 +15362,6 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func, read_leb_mem_offset(p, p_end, mem_offset); /* offset */ -#if WASM_ENABLE_FAST_INTERP != 0 - emit_uint32(loader_ctx, mem_offset); -#endif - CHECK_BUF(p, p_end, 1); lane = read_uint8(p); if (!check_simd_access_lane(opcode1, lane, error_buf,