implement v128.load with signed and unsigined extend

This commit is contained in:
Ilya Rezvov
2023-09-08 11:32:13 -06:00
parent dad521025e
commit f16ccb85a9
5 changed files with 104 additions and 11 deletions
+24
View File
@@ -157,6 +157,12 @@ import Language.Wasm.Lexer (
'v128.load64_splat' { Lexeme _ (TKeyword "v128.load64_splat") }
'v128.load32_zero' { Lexeme _ (TKeyword "v128.load32_zero") }
'v128.load64_zero' { Lexeme _ (TKeyword "v128.load64_zero") }
'v128.load8x8_s' { Lexeme _ (TKeyword "v128.load8x8_s") }
'v128.load8x8_u' { Lexeme _ (TKeyword "v128.load8x8_u") }
'v128.load16x4_s' { Lexeme _ (TKeyword "v128.load16x4_s") }
'v128.load16x4_u' { Lexeme _ (TKeyword "v128.load16x4_u") }
'v128.load32x2_s' { Lexeme _ (TKeyword "v128.load32x2_s") }
'v128.load32x2_u' { Lexeme _ (TKeyword "v128.load32x2_u") }
'i32.load8_s' { Lexeme _ (TKeyword "i32.load8_s") }
'i32.load8_u' { Lexeme _ (TKeyword "i32.load8_u") }
'i32.load16_s' { Lexeme _ (TKeyword "i32.load16_s") }
@@ -575,6 +581,12 @@ plaininstr :: { PlainInstr }
| 'v128.load64_splat' memarg8 { V128Load64Splat $2 }
| 'v128.load32_zero' memarg4 { V128Load32Zero $2 }
| 'v128.load64_zero' memarg8 { V128Load64Zero $2 }
| 'v128.load8x8_s' memarg8 { V128Load8x8S $2 }
| 'v128.load8x8_u' memarg8 { V128Load8x8U $2 }
| 'v128.load16x4_s' memarg8 { V128Load16x4S $2 }
| 'v128.load16x4_u' memarg8 { V128Load16x4U $2 }
| 'v128.load32x2_s' memarg8 { V128Load32x2S $2 }
| 'v128.load32x2_u' memarg8 { V128Load32x2U $2 }
| 'i32.load8_s' memarg1 { I32Load8S $2 }
| 'i32.load8_u' memarg1 { I32Load8U $2 }
| 'i32.load16_s' memarg2 { I32Load16S $2 }
@@ -1447,6 +1459,12 @@ data PlainInstr =
| V128Load64Splat MemArg
| V128Load32Zero MemArg
| V128Load64Zero MemArg
| V128Load8x8S MemArg
| V128Load8x8U MemArg
| V128Load16x4S MemArg
| V128Load16x4U MemArg
| V128Load32x2S MemArg
| V128Load32x2U MemArg
| I32Load8S MemArg
| I32Load8U MemArg
| I32Load16S MemArg
@@ -1976,6 +1994,12 @@ desugarize fields = do
synInstrToStruct _ (PlainInstr (V128Load64Splat memArg)) = return $ S.V128Load64Splat memArg
synInstrToStruct _ (PlainInstr (V128Load32Zero memArg)) = return $ S.V128Load32Zero memArg
synInstrToStruct _ (PlainInstr (V128Load64Zero memArg)) = return $ S.V128Load64Zero memArg
synInstrToStruct _ (PlainInstr (V128Load8x8S memArg)) = return $ S.V128Load8x8S memArg
synInstrToStruct _ (PlainInstr (V128Load8x8U memArg)) = return $ S.V128Load8x8U memArg
synInstrToStruct _ (PlainInstr (V128Load16x4S memArg)) = return $ S.V128Load16x4S memArg
synInstrToStruct _ (PlainInstr (V128Load16x4U memArg)) = return $ S.V128Load16x4U memArg
synInstrToStruct _ (PlainInstr (V128Load32x2S memArg)) = return $ S.V128Load32x2S memArg
synInstrToStruct _ (PlainInstr (V128Load32x2U memArg)) = return $ S.V128Load32x2U memArg
synInstrToStruct _ (PlainInstr (I32Load8S memArg)) = return $ S.I32Load8S memArg
synInstrToStruct _ (PlainInstr (I32Load8U memArg)) = return $ S.I32Load8U memArg
synInstrToStruct _ (PlainInstr (I32Load16S memArg)) = return $ S.I32Load16S memArg