@@ -7304,6 +7304,9 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
73047304 case WASM_OP_SELECT:
73057305 case WASM_OP_DROP_64:
73067306 case WASM_OP_SELECT_64:
7307+ #if WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0
7308+ case WASM_OP_SELECT_128:
7309+ #endif
73077310 break;
73087311
73097312#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
@@ -12788,17 +12791,15 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1278812791 case VALUE_TYPE_F64:
1278912792#if WASM_ENABLE_FAST_INTERP == 0
1279012793 *(p - 1) = WASM_OP_SELECT_64;
12791- #endif
12792- #if WASM_ENABLE_FAST_INTERP != 0
12794+ #else
1279312795 if (loader_ctx->p_code_compiled) {
1279412796 uint8 opcode_tmp = WASM_OP_SELECT_64;
1279512797#if WASM_ENABLE_LABELS_AS_VALUES != 0
1279612798#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
1279712799 *(void **)(p_code_compiled_tmp
1279812800 - sizeof(void *)) =
1279912801 handle_table[opcode_tmp];
12800- #else
12801- #if UINTPTR_MAX == UINT64_MAX
12802+ #elif UINTPTR_MAX == UINT64_MAX
1280212803 /* emit int32 relative offset in 64-bit target
1280312804 */
1280412805 int32 offset =
@@ -12811,7 +12812,6 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1281112812 *(uint32 *)(p_code_compiled_tmp
1281212813 - sizeof(uint32)) =
1281312814 (uint32)(uintptr_t)handle_table[opcode_tmp];
12814- #endif
1281512815#endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */
1281612816#else /* else of WASM_ENABLE_LABELS_AS_VALUES */
1281712817#if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
@@ -12827,6 +12827,39 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1282712827#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
1282812828 || (WASM_ENABLE_FAST_INTERP != 0)
1282912829 case VALUE_TYPE_V128:
12830+ #if WASM_ENABLE_FAST_INTERP == 0
12831+ *(p - 1) = WASM_OP_SELECT_128;
12832+ #else
12833+ if (loader_ctx->p_code_compiled) {
12834+ uint8 opcode_tmp = WASM_OP_SELECT_128;
12835+ #if WASM_ENABLE_LABELS_AS_VALUES != 0
12836+ #if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
12837+ *(void **)(p_code_compiled_tmp
12838+ - sizeof(void *)) =
12839+ handle_table[opcode_tmp];
12840+ #elif UINTPTR_MAX == UINT64_MAX
12841+ /* emit int32 relative offset in 64-bit target
12842+ */
12843+ int32 offset =
12844+ (int32)((uint8 *)handle_table[opcode_tmp]
12845+ - (uint8 *)handle_table[0]);
12846+ *(int32 *)(p_code_compiled_tmp
12847+ - sizeof(int32)) = offset;
12848+ #else
12849+ /* emit uint32 label address in 32-bit target */
12850+ *(uint32 *)(p_code_compiled_tmp
12851+ - sizeof(uint32)) =
12852+ (uint32)(uintptr_t)handle_table[opcode_tmp];
12853+ #endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */
12854+ #else /* else of WASM_ENABLE_LABELS_AS_VALUES */
12855+ #if WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0
12856+ *(p_code_compiled_tmp - 1) = opcode_tmp;
12857+ #else
12858+ *(p_code_compiled_tmp - 2) = opcode_tmp;
12859+ #endif /* end of WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS */
12860+ #endif /* end of WASM_ENABLE_LABELS_AS_VALUES */
12861+ }
12862+ #endif /* end of WASM_ENABLE_FAST_INTERP */
1283012863 break;
1283112864#endif /* (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
1283212865 (WASM_ENABLE_FAST_INTERP != 0) */
@@ -12924,12 +12957,12 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1292412957 uint8 opcode_tmp = WASM_OP_SELECT;
1292512958
1292612959 if (type == VALUE_TYPE_V128) {
12927- #if (WASM_ENABLE_SIMD == 0) \
12928- || ((WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
12929- && (WASM_ENABLE_FAST_INTERP == 0))
12960+ #if WASM_ENABLE_JIT != 0 \
12961+ || WASM_ENABLE_FAST_INTERP != 0 && WASM_ENABLE_SIMD != 0
12962+ opcode_tmp = WASM_OP_SELECT_128;
12963+ #else
1293012964 set_error_buf(error_buf, error_buf_size,
12931- "SIMD v128 type isn't supported");
12932- goto fail;
12965+ "v128 value type requires simd feature");
1293312966#endif
1293412967 }
1293512968 else {
0 commit comments