[llvm] [clang] [PowerPC][X86] Make cpu id builtins target independent and lower for PPC (PR #68919)
Nemanja Ivanovic via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 04:27:20 PST 2024
================
@@ -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;
----------------
nemanjai wrote:
That is a good point. These aren't externally documented- by Glibc, but they should be documented here in the code.
https://github.com/llvm/llvm-project/pull/68919
More information about the cfe-commits
mailing list