diff --git a/core/iwasm/interpreter/wasm_interp_fast.c b/core/iwasm/interpreter/wasm_interp_fast.c index 5744b7ab10..4e6dc00228 100644 --- a/core/iwasm/interpreter/wasm_interp_fast.c +++ b/core/iwasm/interpreter/wasm_interp_fast.c @@ -6391,14 +6391,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, break; } -#define SIMD_LOAD_LANE_OP(register, width) \ +#define SIMD_LOAD_LANE_COMMON(vec, register, lane, width) \ do { \ - uint32 offset, addr; \ - offset = read_uint32(frame_ip); \ - V128 vec = POP_V128(); \ - int32 base = POP_I32(); \ - offset += base; \ - int lane = *frame_ip++; \ addr = GET_OPERAND(uint32, I32, 0); \ addr_ret = GET_OFFSET(); \ CHECK_MEMORY_OVERFLOW(width / 8); \ @@ -6411,6 +6405,17 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, PUT_V128_TO_ADDR(frame_lp + addr_ret, vec); \ } while (0) +#define SIMD_LOAD_LANE_OP(register, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + V128 vec = POP_V128(); \ + int32 base = POP_I32(); \ + offset += base; \ + int lane = *frame_ip++; \ + SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ + } while (0) + case SIMD_v128_load8_lane: { SIMD_LOAD_LANE_OP(i8x16, 8); @@ -6435,10 +6440,29 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, case SIMD_v128_store16_lane: case SIMD_v128_store32_lane: case SIMD_v128_store64_lane: + { + wasm_set_exception(module, "unsupported SIMD opcode"); + break; + } +#define SIMD_LOAD_ZERO_OP(register, width) \ + do { \ + uint32 offset, addr; \ + offset = read_uint32(frame_ip); \ + int32 base = POP_I32(); \ + offset += base; \ + int32 lane = 0; \ + V128 vec = { 0 }; \ + SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \ + } while (0) + case SIMD_v128_load32_zero: + { + SIMD_LOAD_ZERO_OP(i32x4, 32); + break; + } case SIMD_v128_load64_zero: { - wasm_set_exception(module, "unsupported SIMD opcode"); + SIMD_LOAD_ZERO_OP(i64x2, 64); break; } diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 163f086141..a39dff89dc 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -15397,7 +15397,9 @@ 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 POP_AND_PUSH(mem_offset_type, VALUE_TYPE_V128); #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 func->has_memory_operations = true;