Skip to content

Commit 7d225bf

Browse files
committed
[AArch64] Clarify that Anyext is OK for MOPS instructions. NFC
The instruction should only read the bottom 8 bits of the register, so an anyext is OK here. Update the comment from zext->anyext to clarify. Closes #70270 and #70298
1 parent 505e323 commit 7d225bf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,11 +1270,12 @@ bool AArch64LegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
12701270
}
12711271
case Intrinsic::aarch64_mops_memset_tag: {
12721272
assert(MI.getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS);
1273-
// Zext the value to 64 bit
1273+
// Anyext the value being set to 64 bit (only the bottom 8 bits are read by
1274+
// the instruction).
12741275
MachineIRBuilder MIB(MI);
12751276
auto &Value = MI.getOperand(3);
1276-
Register ZExtValueReg = MIB.buildAnyExt(LLT::scalar(64), Value).getReg(0);
1277-
Value.setReg(ZExtValueReg);
1277+
Register ExtValueReg = MIB.buildAnyExt(LLT::scalar(64), Value).getReg(0);
1278+
Value.setReg(ExtValueReg);
12781279
return true;
12791280
}
12801281
case Intrinsic::prefetch: {
@@ -1793,11 +1794,12 @@ bool AArch64LegalizerInfo::legalizeMemOps(MachineInstr &MI,
17931794

17941795
// Tagged version MOPSMemorySetTagged is legalised in legalizeIntrinsic
17951796
if (MI.getOpcode() == TargetOpcode::G_MEMSET) {
1796-
// Zext the value operand to 64 bit
1797+
// Anyext the value being set to 64 bit (only the bottom 8 bits are read by
1798+
// the instruction).
17971799
auto &Value = MI.getOperand(1);
1798-
Register ZExtValueReg =
1800+
Register ExtValueReg =
17991801
MIRBuilder.buildAnyExt(LLT::scalar(64), Value).getReg(0);
1800-
Value.setReg(ZExtValueReg);
1802+
Value.setReg(ExtValueReg);
18011803
return true;
18021804
}
18031805

0 commit comments

Comments
 (0)