authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-13 00:27:51+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-06-24 21:08:41+07:00
log5c8612642b84d2d3f91e6bbe26f9cde2579997f7
tree3dd59ce1c929821276e0f0accf6f9a07073e1eda
parente7fde5f64e29ad5a730f18e82485dda00f658db8

stage2: sparc64: Use official encoding for `not rs2, rs1`


2 files changed, 4 insertions(+), 3 deletions(-)

src/arch/sparc64/Emit.zig+1-1
...@@ -203,7 +203,7 @@ fn mirArithmetic2Op(emit: *Emit, inst: Mir.Inst.Index) !void {...@@ -203,7 +203,7 @@ fn mirArithmetic2Op(emit: *Emit, inst: Mir.Inst.Index) !void {
203 .@"return" => try emit.writeInstruction(Instruction.@"return"(Register, rs1, rs2)),203 .@"return" => try emit.writeInstruction(Instruction.@"return"(Register, rs1, rs2)),
204 .cmp => try emit.writeInstruction(Instruction.subcc(Register, rs1, rs2, .g0)),204 .cmp => try emit.writeInstruction(Instruction.subcc(Register, rs1, rs2, .g0)),
205 .mov => try emit.writeInstruction(Instruction.@"or"(Register, .g0, rs2, rs1)),205 .mov => try emit.writeInstruction(Instruction.@"or"(Register, .g0, rs2, rs1)),
206 .not => try emit.writeInstruction(Instruction.xnor(Register, .g0, rs2, rs1)),206 .not => try emit.writeInstruction(Instruction.xnor(Register, rs2, .g0, rs1)),
207 else => unreachable,207 else => unreachable,
208 }208 }
209 }209 }
src/arch/sparc64/Mir.zig+3-2
...@@ -158,8 +158,9 @@ pub const Inst = struct {...@@ -158,8 +158,9 @@ pub const Inst = struct {
158 /// This uses the arithmetic_2op field, with rs1158 /// This uses the arithmetic_2op field, with rs1
159 /// being the *destination* register.159 /// being the *destination* register.
160 // TODO is it okay to abuse rs1 in this way?160 // TODO is it okay to abuse rs1 in this way?
161 // TODO this differs from official encoding for convenience, fix it later161 // not rs2, rs1 -> xnor rs2, %g0, rs1
162 not, // not rs2/imm, rs1 -> xnor %g0, rs2/imm, rs1162 // not imm, rs1 -> xnor %g0, imm, rs1
163 not,
163 };164 };
164165
165 /// The position of an MIR instruction within the `Mir` instructions array.166 /// The position of an MIR instruction within the `Mir` instructions array.