| ... | ... | @@ -177,6 +177,10 @@ fn mirRType(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 177 | 177 | .add => try emit.writeInstruction(Instruction.add(r_type.rd, r_type.rs1, r_type.rs2)), |
| 178 | 178 | .sub => try emit.writeInstruction(Instruction.sub(r_type.rd, r_type.rs1, r_type.rs2)), |
| 179 | 179 | .cmp_gt => try emit.writeInstruction(Instruction.slt(r_type.rd, r_type.rs1, r_type.rs2)), |
| 180 | .cmp_eq => { |
| 181 | try emit.writeInstruction(Instruction.xor(r_type.rd, r_type.rs1, r_type.rs2)); |
| 182 | try emit.writeInstruction(Instruction.sltiu(r_type.rd, r_type.rd, 1)); |
| 183 | }, |
| 180 | 184 | else => unreachable, |
| 181 | 185 | } |
| 182 | 186 | } |
| ... | ... | @@ -459,6 +463,8 @@ fn instructionSize(emit: *Emit, inst: Mir.Inst.Index) usize { |
| 459 | 463 | |
| 460 | 464 | .abs => 12, // 3 * 4 |
| 461 | 465 | |
| 466 | .cmp_eq => 8, |
| 467 | |
| 462 | 468 | else => 4, |
| 463 | 469 | }; |
| 464 | 470 | } |