Fix load/store (#4054)

Fix v128 load/store
This commit is contained in:
Maks Litskevich 2025-02-01 04:14:35 +00:00 committed by GitHub
parent 07fd987ad8
commit 8ce74b75bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 19 deletions

View File

@ -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); \

View File

@ -15362,10 +15362,6 @@ re_scan:
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,