Skip to content

Commit 8ce74b7

Browse files
authored
Fix load/store (#4054)
Fix v128 load/store
1 parent 07fd987 commit 8ce74b7

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

core/iwasm/interpreter/wasm_interp_fast.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5766,10 +5766,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
57665766
case SIMD_v128_load:
57675767
{
57685768
uint32 offset, addr;
5769-
offset = read_uint32(
5770-
frame_ip); // TODO: Check with an offset!
5771-
addr = GET_OPERAND(uint32, I32, 0);
5772-
frame_ip += 2;
5769+
offset = read_uint32(frame_ip);
5770+
addr = POP_I32();
57735771
addr_ret = GET_OFFSET();
57745772
CHECK_MEMORY_OVERFLOW(16);
57755773
PUT_V128_TO_ADDR(frame_lp + addr_ret, LOAD_V128(maddr));
@@ -5879,8 +5877,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
58795877
{
58805878
uint32 offset, addr;
58815879
offset = read_uint32(frame_ip);
5882-
frame_ip += 2;
5883-
addr = GET_OPERAND(uint32, I32, 0);
5880+
V128 data = POP_V128();
5881+
addr = POP_I32();
58845882

58855883
V128 data;
58865884
data = POP_V128();
@@ -6393,7 +6391,6 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
63936391

63946392
#define SIMD_LOAD_LANE_COMMON(vec, register, lane, width) \
63956393
do { \
6396-
addr = GET_OPERAND(uint32, I32, 0); \
63976394
addr_ret = GET_OFFSET(); \
63986395
CHECK_MEMORY_OVERFLOW(width / 8); \
63996396
if (width == 64) { \
@@ -6410,8 +6407,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
64106407
uint32 offset, addr; \
64116408
offset = read_uint32(frame_ip); \
64126409
V128 vec = POP_V128(); \
6413-
int32 base = POP_I32(); \
6414-
offset += base; \
6410+
addr = POP_I32(); \
64156411
int lane = *frame_ip++; \
64166412
SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \
64176413
} while (0)
@@ -6441,11 +6437,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
64416437
uint32 offset, addr; \
64426438
offset = read_uint32(frame_ip); \
64436439
V128 vec = POP_V128(); \
6444-
int32 base = POP_I32(); \
6445-
offset += base; \
6440+
addr = POP_I32(); \
64466441
int lane = *frame_ip++; \
6447-
addr = GET_OPERAND(uint32, I32, 0); \
6448-
addr_ret = GET_OFFSET(); \
64496442
CHECK_MEMORY_OVERFLOW(width / 8); \
64506443
if (width == 64) { \
64516444
STORE_I64(maddr, vec.register[lane]); \
@@ -6482,8 +6475,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
64826475
do { \
64836476
uint32 offset, addr; \
64846477
offset = read_uint32(frame_ip); \
6485-
int32 base = POP_I32(); \
6486-
offset += base; \
6478+
addr = POP_I32(); \
64876479
int32 lane = 0; \
64886480
V128 vec = { 0 }; \
64896481
SIMD_LOAD_LANE_COMMON(vec, register, lane, width); \

core/iwasm/interpreter/wasm_loader.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15362,10 +15362,6 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1536215362

1536315363
read_leb_mem_offset(p, p_end, mem_offset); /* offset */
1536415364

15365-
#if WASM_ENABLE_FAST_INTERP != 0
15366-
emit_uint32(loader_ctx, mem_offset);
15367-
#endif
15368-
1536915365
CHECK_BUF(p, p_end, 1);
1537015366
lane = read_uint8(p);
1537115367
if (!check_simd_access_lane(opcode1, lane, error_buf,

0 commit comments

Comments
 (0)