Skip to content

Commit

Permalink
Fix load/store
Browse files Browse the repository at this point in the history
Fix v128 load/store

style
  • Loading branch information
Zzzabiyaka committed Jan 27, 2025
1 parent 07fd987 commit f32aeb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
21 changes: 7 additions & 14 deletions core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -5767,9 +5767,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
{
uint32 offset, addr;
offset = read_uint32(
frame_ip); // TODO: Check with an offset!
addr = GET_OPERAND(uint32, I32, 0);
frame_ip += 2;
frame_ip);
addr = POP_I32();
addr_ret = GET_OFFSET();
CHECK_MEMORY_OVERFLOW(16);
PUT_V128_TO_ADDR(frame_lp + addr_ret, LOAD_V128(maddr));
Expand Down Expand Up @@ -5879,8 +5878,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();
Expand Down Expand Up @@ -6393,7 +6392,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) { \
Expand All @@ -6410,8 +6408,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)
Expand Down Expand Up @@ -6441,11 +6438,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]); \
Expand Down Expand Up @@ -6482,8 +6476,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); \
Expand Down
4 changes: 0 additions & 4 deletions core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f32aeb8

Please sign in to comment.