Skip to content

Commit 90a8817

Browse files
committed
aarch64: ensure we set correct operand size at codegen stage
1 parent eab5a1b commit 90a8817

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/arch/aarch64/CodeGen.zig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,6 @@ fn binOpRegister(
13351335
.shift = .lsl,
13361336
} },
13371337
.mul,
1338-
.smull,
1339-
.umull,
13401338
.lsl_register,
13411339
.asr_register,
13421340
.lsr_register,
@@ -1345,6 +1343,13 @@ fn binOpRegister(
13451343
.rn = lhs_reg,
13461344
.rm = rhs_reg,
13471345
} },
1346+
.smull,
1347+
.umull,
1348+
=> .{ .rrr = .{
1349+
.rd = dest_reg.to64(),
1350+
.rn = lhs_reg,
1351+
.rm = rhs_reg,
1352+
} },
13481353
.and_shifted_register,
13491354
.orr_shifted_register,
13501355
.eor_shifted_register,

src/arch/aarch64/Emit.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,10 @@ fn mirDataProcessing3Source(emit: *Emit, inst: Mir.Inst.Index) !void {
10601060

10611061
switch (tag) {
10621062
.mul => try emit.writeInstruction(Instruction.mul(rrr.rd, rrr.rn, rrr.rm)),
1063-
.smulh => try emit.writeInstruction(Instruction.smulh(rrr.rd.to64(), rrr.rn.to64(), rrr.rm.to64())),
1064-
.smull => try emit.writeInstruction(Instruction.smull(rrr.rd.to64(), rrr.rn.to32(), rrr.rm.to32())),
1065-
.umulh => try emit.writeInstruction(Instruction.umulh(rrr.rd.to64(), rrr.rn.to64(), rrr.rm.to64())),
1066-
.umull => try emit.writeInstruction(Instruction.umull(rrr.rd.to64(), rrr.rn.to32(), rrr.rm.to32())),
1063+
.smulh => try emit.writeInstruction(Instruction.smulh(rrr.rd, rrr.rn, rrr.rm)),
1064+
.smull => try emit.writeInstruction(Instruction.smull(rrr.rd, rrr.rn, rrr.rm)),
1065+
.umulh => try emit.writeInstruction(Instruction.umulh(rrr.rd, rrr.rn, rrr.rm)),
1066+
.umull => try emit.writeInstruction(Instruction.umull(rrr.rd, rrr.rn, rrr.rm)),
10671067
else => unreachable,
10681068
}
10691069
}

0 commit comments

Comments
 (0)