@@ -307,7 +307,8 @@ is_byte_a_type(uint8 type)
307307}
308308
309309#if WASM_ENABLE_SIMD != 0
310- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
310+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
311+ || (WASM_ENABLE_FAST_INTERP != 0)
311312static V128
312313read_i8x16(uint8 *p_buf, char *error_buf, uint32 error_buf_size)
313314{
@@ -320,7 +321,8 @@ read_i8x16(uint8 *p_buf, char *error_buf, uint32 error_buf_size)
320321
321322 return result;
322323}
323- #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */
324+ #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
325+ (WASM_ENABLE_FAST_INTERP != 0) */
324326#endif /* end of WASM_ENABLE_SIMD */
325327
326328static void *
@@ -707,7 +709,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
707709 goto fail;
708710 break;
709711#if WASM_ENABLE_SIMD != 0
710- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
712+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
713+ || (WASM_ENABLE_FAST_INTERP != 0)
711714 /* v128.const */
712715 case INIT_EXPR_TYPE_V128_CONST:
713716 {
@@ -736,7 +739,8 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
736739#endif
737740 break;
738741 }
739- #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */
742+ #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
743+ (WASM_ENABLE_FAST_INTERP != 0) */
740744#endif /* end of WASM_ENABLE_SIMD */
741745
742746#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
@@ -4105,7 +4109,8 @@ load_export_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
41054109 return false;
41064110 }
41074111#if WASM_ENABLE_SIMD != 0
4108- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
4112+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
4113+ || (WASM_ENABLE_FAST_INTERP != 0)
41094114 /* TODO: check func type, if it has v128 param or result,
41104115 report error */
41114116#endif
@@ -7566,7 +7571,8 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
75667571 }
75677572
75687573#if WASM_ENABLE_SIMD != 0
7569- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
7574+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
7575+ || (WASM_ENABLE_FAST_INTERP != 0)
75707576 case WASM_OP_SIMD_PREFIX:
75717577 {
75727578 uint32 opcode1;
@@ -7659,7 +7665,8 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
76597665 }
76607666 break;
76617667 }
7662- #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */
7668+ #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
7669+ (WASM_ENABLE_FAST_INTERP != 0) */
76637670#endif /* end of WASM_ENABLE_SIMD */
76647671
76657672#if WASM_ENABLE_SHARED_MEMORY != 0
@@ -9903,7 +9910,8 @@ check_memory_access_align(uint8 opcode, uint32 align, char *error_buf,
99039910}
99049911
99059912#if WASM_ENABLE_SIMD != 0
9906- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
9913+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
9914+ || (WASM_ENABLE_FAST_INTERP != 0)
99079915static bool
99089916check_simd_memory_access_align(uint8 opcode, uint32 align, char *error_buf,
99099917 uint32 error_buf_size)
@@ -12120,10 +12128,20 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1212012128#endif
1212112129 }
1212212130#if WASM_ENABLE_SIMD != 0
12123- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
12131+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
12132+ || (WASM_ENABLE_FAST_INTERP != 0)
1212412133 else if (*(loader_ctx->frame_ref - 1) == VALUE_TYPE_V128) {
1212512134 loader_ctx->frame_ref -= 4;
1212612135 loader_ctx->stack_cell_num -= 4;
12136+ #if WASM_ENABLE_FAST_INTERP != 0
12137+ skip_label();
12138+ loader_ctx->frame_offset -= 4;
12139+ if ((*(loader_ctx->frame_offset)
12140+ > loader_ctx->start_dynamic_offset)
12141+ && (*(loader_ctx->frame_offset)
12142+ < loader_ctx->max_dynamic_offset))
12143+ loader_ctx->dynamic_offset -= 4;
12144+ #endif
1212712145 }
1212812146#endif
1212912147#endif
@@ -12210,10 +12228,12 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1221012228#endif /* end of WASM_ENABLE_FAST_INTERP */
1221112229 break;
1221212230#if WASM_ENABLE_SIMD != 0
12213- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
12231+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
12232+ || (WASM_ENABLE_FAST_INTERP != 0)
1221412233 case VALUE_TYPE_V128:
1221512234 break;
12216- #endif /* (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */
12235+ #endif /* (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
12236+ (WASM_ENABLE_FAST_INTERP != 0) */
1221712237#endif /* WASM_ENABLE_SIMD != 0 */
1221812238 default:
1221912239 {
@@ -12308,8 +12328,9 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1230812328 uint8 opcode_tmp = WASM_OP_SELECT;
1230912329
1231012330 if (type == VALUE_TYPE_V128) {
12311- #if (WASM_ENABLE_SIMD == 0) \
12312- || ((WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0))
12331+ #if (WASM_ENABLE_SIMD == 0) \
12332+ || ((WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
12333+ && (WASM_ENABLE_FAST_INTERP == 0))
1231312334 set_error_buf(error_buf, error_buf_size,
1231412335 "SIMD v128 type isn't supported");
1231512336 goto fail;
@@ -14870,7 +14891,8 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1487014891 }
1487114892
1487214893#if WASM_ENABLE_SIMD != 0
14873- #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
14894+ #if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) \
14895+ || (WASM_ENABLE_FAST_INTERP != 0)
1487414896 case WASM_OP_SIMD_PREFIX:
1487514897 {
1487614898 uint32 opcode1;
@@ -14882,6 +14904,10 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1488214904
1488314905 read_leb_uint32(p, p_end, opcode1);
1488414906
14907+ #if WASM_ENABLE_FAST_INTERP != 0
14908+ emit_byte(loader_ctx, opcode1);
14909+ #endif
14910+
1488514911 /* follow the order of enum WASMSimdEXTOpcode in wasm_opcode.h
1488614912 */
1488714913 switch (opcode1) {
@@ -14938,7 +14964,13 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1493814964 /* basic operation */
1493914965 case SIMD_v128_const:
1494014966 {
14967+ uint64 high, low;
1494114968 CHECK_BUF1(p, p_end, 16);
14969+ #if WASM_ENABLE_FAST_INTERP != 0
14970+ wasm_runtime_read_v128(p, &high, &low);
14971+ emit_uint64(loader_ctx, high);
14972+ emit_uint64(loader_ctx, low);
14973+ #endif
1494214974 p += 16;
1494314975 PUSH_V128();
1494414976 break;
@@ -15524,7 +15556,8 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1552415556 }
1552515557 break;
1552615558 }
15527- #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) */
15559+ #endif /* end of (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0) || \
15560+ (WASM_ENABLE_FAST_INTERP != 0) */
1552815561#endif /* end of WASM_ENABLE_SIMD */
1552915562
1553015563#if WASM_ENABLE_SHARED_MEMORY != 0
0 commit comments