Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzzabiyaka committed Jan 28, 2025
1 parent 632f662 commit b1d0fbf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
16 changes: 7 additions & 9 deletions core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
HANDLE_OP_END();
}

#if WASM_ENABLE_SIMDE != 0
#if WASM_ENABLE_SIMD != 0
HANDLE_OP(EXT_OP_SET_LOCAL_FAST_V128)
HANDLE_OP(EXT_OP_TEE_LOCAL_FAST_V128)
{
Expand Down Expand Up @@ -3595,8 +3595,8 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
GET_I64_FROM_ADDR((uint32 *)global_addr));
HANDLE_OP_END();
}
#if WASM_ENABLE_SIMDE != 0
HANDLE_OP(WASM_OP_GET_GLOBAL_128)
#if WASM_ENABLE_SIMD != 0
HANDLE_OP(WASM_OP_GET_GLOBAL_V128)
{
global_idx = read_uint32(frame_ip);
bh_assert(global_idx < module->e->global_count);
Expand Down Expand Up @@ -3675,7 +3675,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
HANDLE_OP_END();
}
#if WASM_ENABLE_SIMDE != 0
HANDLE_OP(WASM_OP_SET_GLOBAL_128)
HANDLE_OP(WASM_OP_SET_GLOBAL_V128)
{
global_idx = read_uint32(frame_ip);
bh_assert(global_idx < module->e->global_count);
Expand Down Expand Up @@ -4932,7 +4932,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,

HANDLE_OP_END();
}
#if WASM_ENABLE_SIMDE != 0
#if WASM_ENABLE_SIMD != 0
HANDLE_OP(EXT_OP_COPY_STACK_TOP_V128)
{
addr1 = GET_OFFSET();
Expand Down Expand Up @@ -5836,8 +5836,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
case SIMD_v128_load:
{
uint32 offset, addr;
offset = read_uint32(
frame_ip); // TODO: Check with an offset!
offset = read_uint32(frame_ip);
addr = GET_OPERAND(uint32, I32, 0);
frame_ip += 2;
addr_ret = GET_OFFSET();
Expand All @@ -5852,15 +5851,14 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
addr = GET_OPERAND(uint32, I32, 0); \
frame_ip += 2; \
addr_ret = GET_OFFSET(); \
CHECK_MEMORY_OVERFLOW(4); \
CHECK_MEMORY_OVERFLOW(16); \
\
simde_v128_t simde_result = simde_func(maddr); \
\
V128 result; \
SIMDE_V128_TO_SIMD_V128(simde_result, result); \
PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \
\
break; \
} while (0)
case SIMD_v128_load8x8_s:
{
Expand Down
8 changes: 4 additions & 4 deletions core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -7301,8 +7301,8 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
case WASM_OP_GET_GLOBAL_64:
case WASM_OP_SET_GLOBAL_64:
#if WASM_ENABLE_SIMDE != 0
case WASM_OP_GET_GLOBAL_128:
case WASM_OP_SET_GLOBAL_128:
case WASM_OP_GET_GLOBAL_V128:
case WASM_OP_SET_GLOBAL_V128:
#endif
case WASM_OP_SET_GLOBAL_AUX_STACK:
skip_leb_uint32(p, p_end); /* local index */
Expand Down Expand Up @@ -13226,7 +13226,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
#if WASM_ENABLE_SIMDE != 0
if (global_type == VALUE_TYPE_V128) {
skip_label();
emit_label(WASM_OP_GET_GLOBAL_128);
emit_label(WASM_OP_GET_GLOBAL_V128);
}
#endif /* end of WASM_ENABLE_SIMDE */
emit_uint32(loader_ctx, global_idx);
Expand Down Expand Up @@ -13326,7 +13326,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
#if WASM_ENABLE_SIMDE != 0
else if (global_type == VALUE_TYPE_V128) {
skip_label();
emit_label(WASM_OP_SET_GLOBAL_128);
emit_label(WASM_OP_SET_GLOBAL_V128);
}
#endif /* end of WASM_ENABLE_SIMDE */
emit_uint32(loader_ctx, global_idx);
Expand Down
22 changes: 11 additions & 11 deletions core/iwasm/interpreter/wasm_opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ typedef enum WASMOpcode {
DEBUG_OP_BREAK = 0xdc, /* debug break point */
#endif

#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_FAST_INTERP != 0 \
&& WASM_ENABLE_SIMD != 0
#if WASM_ENABLE_JIT != 0 \
|| WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0
EXT_OP_SET_LOCAL_FAST_V128 = 0xdd,
EXT_OP_TEE_LOCAL_FAST_V128 = 0xde,
EXT_OP_COPY_STACK_TOP_V128 = 0xdf,
WASM_OP_GET_GLOBAL_128 = 0xe0,
WASM_OP_SET_GLOBAL_128 = 0xe1,
WASM_OP_GET_GLOBAL_V128 = 0xe0,
WASM_OP_SET_GLOBAL_V128 = 0xe1,
#endif

/* Post-MVP extend op prefix */
Expand Down Expand Up @@ -798,13 +798,13 @@ typedef enum WASMAtomicEXTOpcode {
#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM()
#endif

#if WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0
#define DEF_EXT_V128_HANDLE() \
SET_GOTO_TABLE_ELEM(EXT_OP_SET_LOCAL_FAST_V128), \
SET_GOTO_TABLE_ELEM(EXT_OP_TEE_LOCAL_FAST_V128), \
SET_GOTO_TABLE_ELEM(EXT_OP_COPY_STACK_TOP_V128), \
SET_GOTO_TABLE_ELEM(WASM_OP_GET_GLOBAL_V128), \
SET_GOTO_TABLE_ELEM(WASM_OP_SET_GLOBAL_V128),
#if (WASM_ENABLE_FAST_INTERP != 0) && WASM_ENABLE_SIMD != 0
#define DEF_EXT_V128_HANDLE() \
SET_GOTO_TABLE_ELEM(EXT_OP_SET_LOCAL_FAST_V128), /* 0xdd */ \
SET_GOTO_TABLE_ELEM(EXT_OP_TEE_LOCAL_FAST_V128), /* 0xde */ \
SET_GOTO_TABLE_ELEM(EXT_OP_COPY_STACK_TOP_V128), /* 0xdf */ \
SET_GOTO_TABLE_ELEM(WASM_OP_GET_GLOBAL_V128), /* 0xe0 */ \
SET_GOTO_TABLE_ELEM(WASM_OP_SET_GLOBAL_V128), /* 0xe1 */

#else
#define DEF_EXT_V128_HANDLE()
Expand Down

0 comments on commit b1d0fbf

Please sign in to comment.