Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/makslit/v128_fixes' into makslit…
Browse files Browse the repository at this point in the history
…/local_global
  • Loading branch information
Zzzabiyaka committed Jan 27, 2025
2 parents 6d3cf0b + 84d627d commit 362946f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
22 changes: 6 additions & 16 deletions core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -5836,10 +5836,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));
Expand Down Expand Up @@ -5934,9 +5932,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 offset, addr;
offset = read_uint32(frame_ip);
V128 data = POP_V128();
int32 base = POP_I32();
offset += base;
addr = GET_OPERAND(uint32, I32, 0);
addr = POP_I32();

CHECK_MEMORY_OVERFLOW(4);
STORE_V128(maddr, data);
Expand Down Expand Up @@ -6466,7 +6462,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 @@ -6483,8 +6478,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 @@ -6514,11 +6508,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 @@ -6555,8 +6546,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 @@ -15483,10 +15483,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
7 changes: 5 additions & 2 deletions core/iwasm/libraries/simde/simde.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

set (LIB_SIMDE_DIR ${CMAKE_CURRENT_LIST_DIR})

if (WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR "ARM.*")
if (WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR WAMR_BUILD_TARGET MATCHES "ARM.*")
add_definitions (-DWASM_ENABLE_SIMDE=1)
endif ()
else()
message(WARNING "Disabling SIMD for fast interpreter as the target is not supported")
set(WAMR_BUILD_SIMD 0)
endif()

include_directories(${LIB_SIMDE_DIR} ${LIB_SIMDE_DIR}/simde)

Expand Down

0 comments on commit 362946f

Please sign in to comment.