Преглед изворни кода

implement POP_V128()

This is to simplify the simd implementation for fast interpreter
Marcin Kolny пре 1 година
родитељ
комит
860379bc58
2 измењених фајлова са 5 додато и 3 уклоњено
  1. 2 1
      core/iwasm/common/wasm_loader_common.c
  2. 3 2
      core/iwasm/interpreter/wasm_interp_fast.c

+ 2 - 1
core/iwasm/common/wasm_loader_common.c

@@ -89,7 +89,8 @@ is_valid_value_type(uint8 type)
 bool
 is_valid_value_type_for_interpreter(uint8 value_type)
 {
-#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
+#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
+    && (WASM_ENABLE_FAST_INTERP == 0)
     /*
      * Note: regardless of WASM_ENABLE_SIMD, our interpreters don't have
      * SIMD implemented. It's safer to reject v128, especially for the

+ 3 - 2
core/iwasm/interpreter/wasm_interp_fast.c

@@ -485,6 +485,8 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
 
 #define POP_I64() (GET_I64_FROM_ADDR(frame_lp + GET_OFFSET()))
 
+#define POP_V128() (GET_V128_FROM_ADDR(frame_lp + GET_OFFSET()))
+
 #define POP_F64() (GET_F64_FROM_ADDR(frame_lp + GET_OFFSET()))
 
 #define POP_REF()                                                    \
@@ -5662,8 +5664,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
                     }
                     case SIMD_v128_any_true:
                     {
-                        V128 value = GET_OPERAND_V128(0);
-                        frame_ip += 2;
+                        V128 value = POP_V128();
                         addr_ret = GET_OFFSET();
                         frame_lp[addr_ret] =
                             value.i64x2[0] != 0 || value.i64x2[1] != 0;