[clang] [llvm] [PowerPC][X86] Make cpu id builtins target independent and lower for PPC (PR #68919)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 14 10:34:53 PST 2023
================
@@ -3124,6 +3125,36 @@ bool PPCInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
.addReg(Reg);
return true;
}
+ case PPC::PPCLdFixedAddr: {
+ assert(Subtarget.isTargetLinux() &&
+ "Only Linux target is expected to contain PPCLdFixedAddr");
+ int64_t Offset = 0;
+ const unsigned Reg = Subtarget.isPPC64() ? PPC::X13 : PPC::R2;
+ MI.setDesc(get(PPC::LWZ));
+ uint64_t FAType = MI.getOperand(1).getImm();
+#undef PPC_FEATURE
+#undef PPC_CPU
+#include "llvm/TargetParser/PPCTargetParser.def"
+ // The HWCAP and HWCAP2 word offsets are reversed on big endian Linux.
+ if ((FAType == PPC_FAWORD_HWCAP && Subtarget.isLittleEndian()) ||
+ (FAType == PPC_FAWORD_HWCAP2 && !Subtarget.isLittleEndian()))
+ Offset = Subtarget.isPPC64() ? -0x7064 : -0x703C;
----------------
diggerlin wrote:
suggest do not use integer here, it is not easy to know what the 0x7064 stand for. please using a `constexpr int Name=-0x7064` to explain what is the -0x7064 stand for.
https://github.com/llvm/llvm-project/pull/68919
More information about the cfe-commits
mailing list