[llvm] 7d225bf - [AArch64] Clarify that Anyext is OK for MOPS instructions. NFC
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 13:59:45 PDT 2023
Author: David Green
Date: 2023-10-27T21:59:40+01:00
New Revision: 7d225bf347fc6b6abb3cac8380073f97910dcdaf
URL: https://github.com/llvm/llvm-project/commit/7d225bf347fc6b6abb3cac8380073f97910dcdaf
DIFF: https://github.com/llvm/llvm-project/commit/7d225bf347fc6b6abb3cac8380073f97910dcdaf.diff
LOG: [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
Added:
Modified:
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index 226cdee44ece208..598a195d4fb1016 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -1270,11 +1270,12 @@ bool AArch64LegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
}
case Intrinsic::aarch64_mops_memset_tag: {
assert(MI.getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS);
- // Zext the value to 64 bit
+ // Anyext the value being set to 64 bit (only the bottom 8 bits are read by
+ // the instruction).
MachineIRBuilder MIB(MI);
auto &Value = MI.getOperand(3);
- Register ZExtValueReg = MIB.buildAnyExt(LLT::scalar(64), Value).getReg(0);
- Value.setReg(ZExtValueReg);
+ Register ExtValueReg = MIB.buildAnyExt(LLT::scalar(64), Value).getReg(0);
+ Value.setReg(ExtValueReg);
return true;
}
case Intrinsic::prefetch: {
@@ -1793,11 +1794,12 @@ bool AArch64LegalizerInfo::legalizeMemOps(MachineInstr &MI,
// Tagged version MOPSMemorySetTagged is legalised in legalizeIntrinsic
if (MI.getOpcode() == TargetOpcode::G_MEMSET) {
- // Zext the value operand to 64 bit
+ // Anyext the value being set to 64 bit (only the bottom 8 bits are read by
+ // the instruction).
auto &Value = MI.getOperand(1);
- Register ZExtValueReg =
+ Register ExtValueReg =
MIRBuilder.buildAnyExt(LLT::scalar(64), Value).getReg(0);
- Value.setReg(ZExtValueReg);
+ Value.setReg(ExtValueReg);
return true;
}
More information about the llvm-commits
mailing list