Skip to content

Commit 9eba620

Browse files
committed
refactor(interpreter): improve variable naming and code clarity in SIMD operations
1 parent 5d8fe5d commit 9eba620

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

core/iwasm/interpreter/wasm_interp_fast.c

+21-21
Original file line numberDiff line numberDiff line change
@@ -5816,12 +5816,12 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
58165816
goto call_func_from_entry;
58175817
}
58185818
#if WASM_ENABLE_SIMDE != 0
5819-
#define SIMD_V128_TO_SIMDE_V128(v) \
5819+
#define SIMD_V128_TO_SIMDE_V128(s_v) \
58205820
({ \
58215821
bh_assert(sizeof(V128) == sizeof(simde_v128_t)); \
5822-
simde_v128_t result; \
5823-
bh_memcpy_s(&result, sizeof(simde_v128_t), &(v), sizeof(V128)); \
5824-
result; \
5822+
simde_v128_t se_v; \
5823+
bh_memcpy_s(&se_v, sizeof(simde_v128_t), &(s_v), sizeof(V128)); \
5824+
se_v; \
58255825
})
58265826

58275827
#define SIMDE_V128_TO_SIMD_V128(sv, v) \
@@ -5995,10 +5995,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
59955995
/* Splat */
59965996
#define SIMD_SPLAT_OP(simde_func, pop_func, val_type) \
59975997
do { \
5998-
val_type val = pop_func(); \
5998+
val_type v = pop_func(); \
59995999
addr_ret = GET_OFFSET(); \
60006000
\
6001-
simde_v128_t simde_result = simde_func(val); \
6001+
simde_v128_t simde_result = simde_func(v); \
60026002
\
60036003
V128 result; \
60046004
SIMDE_V128_TO_SIMD_V128(simde_result, result); \
@@ -6015,7 +6015,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
60156015

60166016
case SIMD_i8x16_splat:
60176017
{
6018-
uint32 val = POP_I32();
6018+
val = POP_I32();
60196019
addr_ret = GET_OFFSET();
60206020

60216021
simde_v128_t simde_result = simde_wasm_i8x16_splat(val);
@@ -6666,19 +6666,19 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
66666666
SIMD_SINGLE_OP(simde_wasm_f32x4_nearest);
66676667
break;
66686668
}
6669-
#define SIMD_LANE_SHIFT(simde_func) \
6670-
do { \
6671-
int32 count = POP_I32(); \
6672-
V128 v1 = POP_V128(); \
6673-
addr_ret = GET_OFFSET(); \
6674-
\
6675-
simde_v128_t simde_result = \
6676-
simde_func(SIMD_V128_TO_SIMDE_V128(v1), count); \
6677-
\
6678-
V128 result; \
6679-
SIMDE_V128_TO_SIMD_V128(simde_result, result); \
6680-
\
6681-
PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \
6669+
#define SIMD_LANE_SHIFT(simde_func) \
6670+
do { \
6671+
int32 c = POP_I32(); \
6672+
V128 v1 = POP_V128(); \
6673+
addr_ret = GET_OFFSET(); \
6674+
\
6675+
simde_v128_t simde_result = \
6676+
simde_func(SIMD_V128_TO_SIMDE_V128(v1), c); \
6677+
\
6678+
V128 result; \
6679+
SIMDE_V128_TO_SIMD_V128(simde_result, result); \
6680+
\
6681+
PUT_V128_TO_ADDR(frame_lp + addr_ret, result); \
66826682
} while (0)
66836683
case SIMD_i8x16_shl:
66846684
{
@@ -7488,7 +7488,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
74887488
#if WASM_ENABLE_LABELS_AS_VALUES == 0
74897489
continue;
74907490
#else
7491-
FETCH_OPCODE_AND_DISPATCH();
7491+
FETCH_OPCODE_AND_DISPATCH();
74927492
#endif
74937493

74947494
#if WASM_ENABLE_TAIL_CALL != 0 || WASM_ENABLE_GC != 0

0 commit comments

Comments
 (0)