zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 90a8817f558bb5c5b4292c666b2ed61b4a415f8d (tree)
parent eab5a1bd5a6b6fb6f968cb99895a862ad5639f15
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Thu,  5 May 2022 22:33:03 +0200

aarch64: ensure we set correct operand size at codegen stage

Diffstat:
Msrc/arch/aarch64/CodeGen.zig | 9+++++++--
Msrc/arch/aarch64/Emit.zig | 8++++----
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig @@ -1335,8 +1335,6 @@ fn binOpRegister( .shift = .lsl, } }, .mul, - .smull, - .umull, .lsl_register, .asr_register, .lsr_register, @@ -1345,6 +1343,13 @@ fn binOpRegister( .rn = lhs_reg, .rm = rhs_reg, } }, + .smull, + .umull, + => .{ .rrr = .{ + .rd = dest_reg.to64(), + .rn = lhs_reg, + .rm = rhs_reg, + } }, .and_shifted_register, .orr_shifted_register, .eor_shifted_register, diff --git a/src/arch/aarch64/Emit.zig b/src/arch/aarch64/Emit.zig @@ -1060,10 +1060,10 @@ fn mirDataProcessing3Source(emit: *Emit, inst: Mir.Inst.Index) !void { switch (tag) { .mul => try emit.writeInstruction(Instruction.mul(rrr.rd, rrr.rn, rrr.rm)), - .smulh => try emit.writeInstruction(Instruction.smulh(rrr.rd.to64(), rrr.rn.to64(), rrr.rm.to64())), - .smull => try emit.writeInstruction(Instruction.smull(rrr.rd.to64(), rrr.rn.to32(), rrr.rm.to32())), - .umulh => try emit.writeInstruction(Instruction.umulh(rrr.rd.to64(), rrr.rn.to64(), rrr.rm.to64())), - .umull => try emit.writeInstruction(Instruction.umull(rrr.rd.to64(), rrr.rn.to32(), rrr.rm.to32())), + .smulh => try emit.writeInstruction(Instruction.smulh(rrr.rd, rrr.rn, rrr.rm)), + .smull => try emit.writeInstruction(Instruction.smull(rrr.rd, rrr.rn, rrr.rm)), + .umulh => try emit.writeInstruction(Instruction.umulh(rrr.rd, rrr.rn, rrr.rm)), + .umull => try emit.writeInstruction(Instruction.umull(rrr.rd, rrr.rn, rrr.rm)), else => unreachable, } }