diff --git a/hbasm/src/lib.rs b/hbasm/src/lib.rs index f939838..e2201b8 100644 --- a/hbasm/src/lib.rs +++ b/hbasm/src/lib.rs @@ -62,7 +62,7 @@ tokendef![ "nop", "add", "sub", "mul", "and", "or", "xor", "sl", "sr", "srs", "cmp", "cmpu", "dir", "neg", "not", "addi", "muli", "andi", "ori", "xori", "sli", "sri", "srsi", "cmpi", "cmpui", "cp", "swa", "li", "ld", "st", "bmc", "brc", "jmp", "jeq", "jne", - "jlt", "jgt", "jltu", "jgtu", "ecall", "addf", "subf", "mulf", "dirf", "fma", "negf", + "jlt", "jgt", "jltu", "jgtu", "ecall", "addf", "subf", "mulf", "dirf", "fmaf", "negf", "itf", "fti", "addfi", "mulfi", ]; diff --git a/hbbytecode/hbbytecode.h b/hbbytecode/hbbytecode.h index 10eebac..307ca92 100644 --- a/hbbytecode/hbbytecode.h +++ b/hbbytecode/hbbytecode.h @@ -17,7 +17,7 @@ enum hbbc_Opcode: uint8_t { hbbc_Op_CMPUI , hbbc_Op_CP , hbbc_Op_SWA , hbbc_Op_LI , hbbc_Op_LD , hbbc_Op_ST , hbbc_Op_BMC , hbbc_Op_BRC , hbbc_Op_JMP , hbbc_Op_JEQ , hbbc_Op_JNE , hbbc_Op_JLT , hbbc_Op_JGT , hbbc_Op_JLTU , hbbc_Op_JGTU , hbbc_Op_ECALL , hbbc_Op_ADDF , hbbc_Op_SUBF , - hbbc_Op_MULF , hbbc_Op_DIRF , hbbc_Op_FMA , hbbc_Op_NEGF , hbbc_Op_ITF , hbbc_Op_FTI , + hbbc_Op_MULF , hbbc_Op_DIRF , hbbc_Op_FMAF , hbbc_Op_NEGF , hbbc_Op_ITF , hbbc_Op_FTI , hbbc_Op_ADDFI , hbbc_Op_MULFI , } typedef hbbc_Opcode; diff --git a/hbbytecode/src/lib.rs b/hbbytecode/src/lib.rs index 6e85797..19f4648 100644 --- a/hbbytecode/src/lib.rs +++ b/hbbytecode/src/lib.rs @@ -67,7 +67,7 @@ constmod!(pub opcode(u8) { SUBF = 41, "BBB; #0 ← #1 -. #2"; MULF = 42, "BBB; #0 ← #1 +. #2"; DIRF = 43, "BBBB; #0 ← #2 / #3, #1 ← #2 % #3"; - FMA = 44, "BBBB; #0 ← (#1 * #2) + #3"; + FMAF = 44, "BBBB; #0 ← (#1 * #2) + #3"; NEGF = 45, "BB; #0 ← -#1"; ITF = 46, "BB; #0 ← #1 as float"; FTI = 47, "BB; #0 ← #1 as int"; diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 8375706..0f6fa2f 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -284,7 +284,7 @@ impl<'a, T: HandleTrap> Vm<'a, T> { self.write_reg(dt, a0 / a1); self.write_reg(rt, a0 % a1); } - FMA => { + FMAF => { let ParamBBBB(dt, a0, a1, a2) = param!(self, ParamBBBB); self.write_reg( dt, diff --git a/spec.md b/spec.md index 4dc2291..4c64f26 100644 --- a/spec.md +++ b/spec.md @@ -214,7 +214,7 @@ | Opcode | Name | Action | |:------:|:----:|:---------------------:| -| 44 | FMA | `#0 ← (#1 * #2) + #3` | +| 44 | FMAF | `#0 ← (#1 * #2) + #3` | ### Negation - Type BB