Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
James Marsh committed Oct 31, 2024
1 parent 060a0b1 commit d92cfd9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ if (WAMR_BUILD_SIMD EQUAL 1)
else ()
message (" SIMD disabled due to not supported on target RISCV64")
endif ()
if(WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR "ARM.*")
add_definitions (-DWAMR_BUILD_SIMDE=1)
if(WAMR_BUILD_SIMDE EQUAL 1 AND WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR "ARM.*")
add_definitions (-DWASM_ENABLE_SIMDE=1)
endif()
endif ()
if (WAMR_BUILD_AOT_STACK_FRAME EQUAL 1)
Expand Down
57 changes: 30 additions & 27 deletions core/iwasm/common/wasm_runtime_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,33 +272,36 @@ STORE_U16(void *addr, uint16_t value)
((uint8_t *)(addr))[1] = u.u8[1];
}

#define STORE_V128(addr, value) \
do { \
uintptr_t addr_ = (uintptr_t)(addr); \
union { \
V128 val; \
uint64 u64[2]; \
uint32 u32[4]; \
uint16 u16[8]; \
uint8 u8[16]; \
} u; \
if ((addr_ & (uintptr_t)15) == 0) \
*(V128 *)(addr) = (V128)(value); \
else { \
u.val = (V128)(value); \
if ((addr_ & (uintptr_t)7) == 0) { \
((uint64 *)(addr))[0] = u.u64[0]; \
((uint64 *)(addr))[1] = u.u64[1]; \
} \
else { \
bh_assert((addr_ & (uintptr_t)3) == 0); \
((uint32 *)(addr))[0] = u.u32[0]; \
((uint32 *)(addr))[1] = u.u32[1]; \
((uint32 *)(addr))[2] = u.u32[2]; \
((uint32 *)(addr))[3] = u.u32[3]; \
} \
} \
} while (0)
static inline void
STORE_V128(void *addr, V128 value)
{
uintptr_t addr_ = (uintptr_t)(addr);
union {
V128 val;
uint64 u64[2];
uint32 u32[4];
uint16 u16[8];
uint8 u8[16];
} u;

if ((addr_ & (uintptr_t)15) == 0) {
*(V128 *)addr = value;
}
else {
u.val = value;
if ((addr_ & (uintptr_t)7) == 0) {
((uint64 *)(addr))[0] = u.u64[0];
((uint64 *)(addr))[1] = u.u64[1];
}
else {
bh_assert((addr_ & (uintptr_t)3) == 0);
((uint32 *)addr)[0] = u.u32[0];
((uint32 *)addr)[1] = u.u32[1];
((uint32 *)addr)[2] = u.u32[2];
((uint32 *)addr)[3] = u.u32[3];
}
}
}

/* For LOAD opcodes */
static inline V128
Expand Down
4 changes: 2 additions & 2 deletions core/iwasm/interpreter/wasm_interp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "../common/wasm_shared_memory.h"
#endif

#if WASM_ENABLE_SIMD != 0 && WAMR_BUILD_SIMDE != 0
#if WASM_ENABLE_SIMDE != 0
#include "simde/wasm/simd128.h"
#endif

Expand Down Expand Up @@ -5650,7 +5650,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
#endif
goto call_func_from_entry;
}
#if WASM_ENABLE_SIMD != 0 && WAMR_BUILD_SIMDE != 0
#if WASM_ENABLE_SIMDE != 0
#define SIMD_V128_TO_SIMDE_V128(v) \
({ \
bh_assert(sizeof(V128) == sizeof(simde_v128_t)); \
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/interpreter/wasm_opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ typedef enum WASMAtomicEXTOpcode {
#define SET_GOTO_TABLE_ELEM(opcode) [opcode] = HANDLE_OPCODE(opcode)

#if (WASM_ENABLE_JIT != 0 || WASM_ENABLE_FAST_INTERP != 0) \
&& WASM_ENABLE_SIMD != 0 && WAMR_BUILD_SIMDE != 0
&& WASM_ENABLE_SIMD != 0 && WASM_ENABLE_SIMDE != 0
#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() \
SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX),
#else
Expand Down
2 changes: 2 additions & 0 deletions core/iwasm/libraries/simde/simde.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright (C) 2024 Amazon Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# simde is a header only library

set (LIB_SIMDE_DIR ${CMAKE_CURRENT_LIST_DIR})
Expand Down
5 changes: 0 additions & 5 deletions product-mini/platforms/linux-sgx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ if (NOT DEFINED WAMR_BUILD_LIB_RATS)
set (WAMR_BUILD_LIB_RATS 0)
endif()

if (NOT DEFINED WAMR_BUILD_SIMDE)
# Disable lib simde by default
set (WAMR_BUILD_SIMDE 0)
endif()

if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
# Enable fast interpreter
set (WAMR_BUILD_FAST_INTERP 1)
Expand Down

0 comments on commit d92cfd9

Please sign in to comment.