diff --git a/WasmNet.Core/WasmCompiler.cs b/WasmNet.Core/WasmCompiler.cs index deb5393..49369d2 100644 --- a/WasmNet.Core/WasmCompiler.cs +++ b/WasmNet.Core/WasmCompiler.cs @@ -188,34 +188,34 @@ private void CompileInstruction(WasmInstruction instruction) case WasmOpcode.I32Ne or WasmOpcode.I64Ne or WasmOpcode.F32Ne or WasmOpcode.F64Ne: NotEqual(); break; - case WasmOpcode.I32LtS: + case WasmOpcode.I32LtS or WasmOpcode.I64LtS: Clt(); break; - case WasmOpcode.I32LtU: + case WasmOpcode.I32LtU or WasmOpcode.I64LtU: Clt_Un(); break; - case WasmOpcode.I32GtS: + case WasmOpcode.I32GtS or WasmOpcode.I64GtS: Cgt(); break; - case WasmOpcode.I32GtU: + case WasmOpcode.I32GtU or WasmOpcode.I64GtU: Cgt_Un(); break; - case WasmOpcode.I32GeS: + case WasmOpcode.I32GeS or WasmOpcode.I64GeS: // >= is the same as !(<) Clt(); I32Eqz(); break; - case WasmOpcode.I32GeU: + case WasmOpcode.I32GeU or WasmOpcode.I64GeU: // >= is the same as !(<) Clt_Un(); I32Eqz(); break; - case WasmOpcode.I32LeS: + case WasmOpcode.I32LeS or WasmOpcode.I64LeS: // <= is the same as !(>) Cgt(); I32Eqz(); break; - case WasmOpcode.I32LeU: + case WasmOpcode.I32LeU or WasmOpcode.I64LeU: // <= is the same as !(>) Cgt_Un(); I32Eqz(); diff --git a/WasmNet.Core/WasmOpcode.cs b/WasmNet.Core/WasmOpcode.cs index 9ef3d61..9af9db1 100644 --- a/WasmNet.Core/WasmOpcode.cs +++ b/WasmNet.Core/WasmOpcode.cs @@ -54,6 +54,14 @@ public enum WasmOpcode I64Eqz = 0x50, I64Eq = 0x51, I64Ne = 0x52, + I64LtS = 0x53, + I64LtU = 0x54, + I64GtS = 0x55, + I64GtU = 0x56, + I64LeS = 0x57, + I64LeU = 0x58, + I64GeS = 0x59, + I64GeU = 0x5A, F32Eq = 0x5B, F32Ne = 0x5C, F64Eq = 0x61, diff --git a/WasmNet.Core/WasmReader.cs b/WasmNet.Core/WasmReader.cs index c0e5a82..fdbdedc 100644 --- a/WasmNet.Core/WasmReader.cs +++ b/WasmNet.Core/WasmReader.cs @@ -543,6 +543,14 @@ or WasmOpcode.I64Load32S case WasmOpcode.I64Eqz: case WasmOpcode.I64Eq: case WasmOpcode.I64Ne: + case WasmOpcode.I64LtS: + case WasmOpcode.I64LtU: + case WasmOpcode.I64GtS: + case WasmOpcode.I64GtU: + case WasmOpcode.I64LeS: + case WasmOpcode.I64LeU: + case WasmOpcode.I64GeS: + case WasmOpcode.I64GeU: case WasmOpcode.F32Add: case WasmOpcode.F32Sub: case WasmOpcode.F32Mul: diff --git a/WasmNet.Tests/IntegrationTests/0062-I32GeS.wat b/WasmNet.Tests/IntegrationTests/0062-I32GeS.wat index 11c9186..4b0174c 100644 --- a/WasmNet.Tests/IntegrationTests/0062-I32GeS.wat +++ b/WasmNet.Tests/IntegrationTests/0062-I32GeS.wat @@ -2,7 +2,6 @@ ;; expect: (i32:0) (module - (memory 1) (func (export "ges") (result i32) i32.const 10 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0063-I32LtS.wat b/WasmNet.Tests/IntegrationTests/0063-I32LtS.wat index d242a6f..b081c38 100644 --- a/WasmNet.Tests/IntegrationTests/0063-I32LtS.wat +++ b/WasmNet.Tests/IntegrationTests/0063-I32LtS.wat @@ -2,7 +2,6 @@ ;; expect: (i32:1) (module - (memory 1) (func (export "lts") (result i32) i32.const 10 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0064-I32LeS.wat b/WasmNet.Tests/IntegrationTests/0064-I32LeS.wat index 38dcd2b..31b0b3d 100644 --- a/WasmNet.Tests/IntegrationTests/0064-I32LeS.wat +++ b/WasmNet.Tests/IntegrationTests/0064-I32LeS.wat @@ -2,7 +2,6 @@ ;; expect: (i32:1) (module - (memory 1) (func (export "les") (result i32) i32.const 42 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0065-I32GtS.wat b/WasmNet.Tests/IntegrationTests/0065-I32GtS.wat index 49ad2a1..29ce8d8 100644 --- a/WasmNet.Tests/IntegrationTests/0065-I32GtS.wat +++ b/WasmNet.Tests/IntegrationTests/0065-I32GtS.wat @@ -2,7 +2,6 @@ ;; expect: (i32:0) (module - (memory 1) (func (export "gts") (result i32) i32.const 42 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0077-I32GeU.wat b/WasmNet.Tests/IntegrationTests/0077-I32GeU.wat index c5ce8a7..144817e 100644 --- a/WasmNet.Tests/IntegrationTests/0077-I32GeU.wat +++ b/WasmNet.Tests/IntegrationTests/0077-I32GeU.wat @@ -2,7 +2,6 @@ ;; expect: (i32:0) (module - (memory 1) (func (export "geu") (result i32) i32.const 10 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0078-I32LtU.wat b/WasmNet.Tests/IntegrationTests/0078-I32LtU.wat index 4bbb71c..d881603 100644 --- a/WasmNet.Tests/IntegrationTests/0078-I32LtU.wat +++ b/WasmNet.Tests/IntegrationTests/0078-I32LtU.wat @@ -2,7 +2,6 @@ ;; expect: (i32:1) (module - (memory 1) (func (export "ltu") (result i32) i32.const 10 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0079-I32LeU.wat b/WasmNet.Tests/IntegrationTests/0079-I32LeU.wat index b86b9f8..01a89df 100644 --- a/WasmNet.Tests/IntegrationTests/0079-I32LeU.wat +++ b/WasmNet.Tests/IntegrationTests/0079-I32LeU.wat @@ -2,7 +2,6 @@ ;; expect: (i32:1) (module - (memory 1) (func (export "leu") (result i32) i32.const 42 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0080-I32GtU.wat b/WasmNet.Tests/IntegrationTests/0080-I32GtU.wat index 1cfb7fd..0ff5a14 100644 --- a/WasmNet.Tests/IntegrationTests/0080-I32GtU.wat +++ b/WasmNet.Tests/IntegrationTests/0080-I32GtU.wat @@ -2,7 +2,6 @@ ;; expect: (i32:0) (module - (memory 1) (func (export "gtu") (result i32) i32.const 42 i32.const 42 diff --git a/WasmNet.Tests/IntegrationTests/0109-I64LtS.wat b/WasmNet.Tests/IntegrationTests/0109-I64LtS.wat new file mode 100644 index 0000000..43a08bb --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0109-I64LtS.wat @@ -0,0 +1,10 @@ +;; invoke: lts +;; expect: (i32:1) + +(module + (func (export "lts") (result i32) + i64.const -10 + i64.const 42 + i64.lt_s + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0110-I64LtU.wat b/WasmNet.Tests/IntegrationTests/0110-I64LtU.wat new file mode 100644 index 0000000..32cf937 --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0110-I64LtU.wat @@ -0,0 +1,10 @@ +;; invoke: ltu +;; expect: (i32:1) + +(module + (func (export "ltu") (result i32) + i64.const 10 + i64.const 42 + i64.lt_u + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0111-I64GtS.wat b/WasmNet.Tests/IntegrationTests/0111-I64GtS.wat new file mode 100644 index 0000000..d94cbca --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0111-I64GtS.wat @@ -0,0 +1,10 @@ +;; invoke: gts +;; expect: (i32:1) + +(module + (func (export "gts") (result i32) + i64.const 42 + i64.const -42 + i64.gt_s + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0112-I64GtU.wat b/WasmNet.Tests/IntegrationTests/0112-I64GtU.wat new file mode 100644 index 0000000..9341c48 --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0112-I64GtU.wat @@ -0,0 +1,10 @@ +;; invoke: gtu +;; expect: (i32:1) + +(module + (func (export "gtu") (result i32) + i64.const 42 + i64.const 1 + i64.gt_u + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0113-I64LeS.wat b/WasmNet.Tests/IntegrationTests/0113-I64LeS.wat new file mode 100644 index 0000000..819b16b --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0113-I64LeS.wat @@ -0,0 +1,10 @@ +;; invoke: les +;; expect: (i32:1) + +(module + (func (export "les") (result i32) + i64.const -42 + i64.const -42 + i64.le_s + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0114-I64LeU.wat b/WasmNet.Tests/IntegrationTests/0114-I64LeU.wat new file mode 100644 index 0000000..47e34cf --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0114-I64LeU.wat @@ -0,0 +1,10 @@ +;; invoke: leu +;; expect: (i32:1) + +(module + (func (export "leu") (result i32) + i64.const 42 + i64.const 42 + i64.le_u + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0115-I64GeS.wat b/WasmNet.Tests/IntegrationTests/0115-I64GeS.wat new file mode 100644 index 0000000..6b75c63 --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0115-I64GeS.wat @@ -0,0 +1,10 @@ +;; invoke: ges +;; expect: (i32:1) + +(module + (func (export "ges") (result i32) + i64.const -42 + i64.const -42 + i64.ge_s + ) +) \ No newline at end of file diff --git a/WasmNet.Tests/IntegrationTests/0116-I64GeU.wat b/WasmNet.Tests/IntegrationTests/0116-I64GeU.wat new file mode 100644 index 0000000..61c7aa6 --- /dev/null +++ b/WasmNet.Tests/IntegrationTests/0116-I64GeU.wat @@ -0,0 +1,10 @@ +;; invoke: geu +;; expect: (i32:1) + +(module + (func (export "geu") (result i32) + i64.const 42 + i64.const 42 + i64.ge_u + ) +) \ No newline at end of file