forked from GitHub/haskell-wasm
implement v128.imul
This commit is contained in:
@@ -1446,6 +1446,14 @@ eval budget store inst FunctionInstance { funcType, moduleInstance, code = Funct
|
|||||||
_ -> error "impossible due to validation"
|
_ -> error "impossible due to validation"
|
||||||
in
|
in
|
||||||
return $ Done ctx { stack = VV128 r : rest }
|
return $ Done ctx { stack = VV128 r : rest }
|
||||||
|
step ctx@EvalCtx{ stack = (VV128 v2:VV128 v1:rest) } (IBinOp (BS128 shape) IMul) =
|
||||||
|
let r = case shape of
|
||||||
|
I16x8 -> lanewise @Word16 shape v1 v2 (*)
|
||||||
|
I32x4 -> lanewise @Word32 shape v1 v2 (*)
|
||||||
|
I64x2 -> lanewise @Word64 shape v1 v2 (*)
|
||||||
|
_ -> error "impossible due to validation"
|
||||||
|
in
|
||||||
|
return $ Done ctx { stack = VV128 r : rest }
|
||||||
step ctx@EvalCtx{ stack = (VV128 v2:VV128 v1:rest) } (IBinOp (BS128 shape) IAddSatU) =
|
step ctx@EvalCtx{ stack = (VV128 v2:VV128 v1:rest) } (IBinOp (BS128 shape) IAddSatU) =
|
||||||
let r = case shape of
|
let r = case shape of
|
||||||
I8x16 -> lanewise @Word8 shape v1 v2 $ \a b ->
|
I8x16 -> lanewise @Word8 shape v1 v2 $ \a b ->
|
||||||
|
|||||||
@@ -421,6 +421,9 @@ import Language.Wasm.Lexer (
|
|||||||
'i16x8.add_sat_u' { Lexeme _ (TKeyword "i16x8.add_sat_u") }
|
'i16x8.add_sat_u' { Lexeme _ (TKeyword "i16x8.add_sat_u") }
|
||||||
'i8x16.sub_sat_u' { Lexeme _ (TKeyword "i8x16.sub_sat_u") }
|
'i8x16.sub_sat_u' { Lexeme _ (TKeyword "i8x16.sub_sat_u") }
|
||||||
'i16x8.sub_sat_u' { Lexeme _ (TKeyword "i16x8.sub_sat_u") }
|
'i16x8.sub_sat_u' { Lexeme _ (TKeyword "i16x8.sub_sat_u") }
|
||||||
|
'i16x8.mul' { Lexeme _ (TKeyword "i16x8.mul") }
|
||||||
|
'i32x4.mul' { Lexeme _ (TKeyword "i32x4.mul") }
|
||||||
|
'i64x2.mul' { Lexeme _ (TKeyword "i64x2.mul") }
|
||||||
'i8x16.abs' { Lexeme _ (TKeyword "i8x16.abs") }
|
'i8x16.abs' { Lexeme _ (TKeyword "i8x16.abs") }
|
||||||
'i16x8.abs' { Lexeme _ (TKeyword "i16x8.abs") }
|
'i16x8.abs' { Lexeme _ (TKeyword "i16x8.abs") }
|
||||||
'i32x4.abs' { Lexeme _ (TKeyword "i32x4.abs") }
|
'i32x4.abs' { Lexeme _ (TKeyword "i32x4.abs") }
|
||||||
@@ -899,6 +902,9 @@ plaininstr :: { PlainInstr }
|
|||||||
| 'i16x8.add_sat_u' { IBinOp (BS128 I16x8) IAddSatU }
|
| 'i16x8.add_sat_u' { IBinOp (BS128 I16x8) IAddSatU }
|
||||||
| 'i8x16.sub_sat_u' { IBinOp (BS128 I8x16) ISubSatU }
|
| 'i8x16.sub_sat_u' { IBinOp (BS128 I8x16) ISubSatU }
|
||||||
| 'i16x8.sub_sat_u' { IBinOp (BS128 I16x8) ISubSatU }
|
| 'i16x8.sub_sat_u' { IBinOp (BS128 I16x8) ISubSatU }
|
||||||
|
| 'i16x8.mul' { IBinOp (BS128 I16x8) IMul }
|
||||||
|
| 'i32x4.mul' { IBinOp (BS128 I32x4) IMul }
|
||||||
|
| 'i64x2.mul' { IBinOp (BS128 I64x2) IMul }
|
||||||
| 'i8x16.shl' { IBinOp (BS128 I8x16) IShl }
|
| 'i8x16.shl' { IBinOp (BS128 I8x16) IShl }
|
||||||
| 'i16x8.shl' { IBinOp (BS128 I16x8) IShl }
|
| 'i16x8.shl' { IBinOp (BS128 I16x8) IShl }
|
||||||
| 'i32x4.shl' { IBinOp (BS128 I32x4) IShl }
|
| 'i32x4.shl' { IBinOp (BS128 I32x4) IShl }
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ main = do
|
|||||||
filter (List.isPrefixOf "simd") .
|
filter (List.isPrefixOf "simd") .
|
||||||
filter (List.isSuffixOf ".wast")
|
filter (List.isSuffixOf ".wast")
|
||||||
<$> Directory.listDirectory "tests/spec"
|
<$> Directory.listDirectory "tests/spec"
|
||||||
-- let files = ["simd_i8x16_sat_arith.wast"]
|
let files = ["simd_i16x8_cmp.wast"]
|
||||||
scriptTestCases <- (`mapM` files) $ \file -> do
|
scriptTestCases <- (`mapM` files) $ \file -> do
|
||||||
test <- LBS.readFile ("tests/spec/" ++ file)
|
test <- LBS.readFile ("tests/spec/" ++ file)
|
||||||
return $ testCase file $ do
|
return $ testCase file $ do
|
||||||
|
|||||||
Reference in New Issue
Block a user