Skip to content

Commit 8c77741

Browse files
authored
[AArch64][GISel] Drop custom selectors for ptrauth_* intrinsics (#75328)
Drop custom selector code for ptrauth_(sign|strip|blend) intrinsics from AArch64InstructionSelector::selectIntrinsic function. The code for strip and blend intrinsics was needed because of a bug in TableGen fixed in 78623b0. The ptrauth_sign intrinsic was presumably fixed long ago.
1 parent c0d2ea9 commit 8c77741

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

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

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6717,68 +6717,6 @@ bool AArch64InstructionSelector::selectIntrinsic(MachineInstr &I,
67176717
I.eraseFromParent();
67186718
return true;
67196719
}
6720-
case Intrinsic::ptrauth_sign: {
6721-
Register DstReg = I.getOperand(0).getReg();
6722-
Register ValReg = I.getOperand(2).getReg();
6723-
uint64_t Key = I.getOperand(3).getImm();
6724-
Register DiscReg = I.getOperand(4).getReg();
6725-
auto DiscVal = getIConstantVRegVal(DiscReg, MRI);
6726-
bool IsDiscZero = DiscVal && DiscVal->isZero();
6727-
6728-
if (Key > AArch64PACKey::LAST)
6729-
return false;
6730-
6731-
unsigned Opcodes[][4] = {
6732-
{AArch64::PACIA, AArch64::PACIB, AArch64::PACDA, AArch64::PACDB},
6733-
{AArch64::PACIZA, AArch64::PACIZB, AArch64::PACDZA, AArch64::PACDZB}};
6734-
unsigned Opcode = Opcodes[IsDiscZero][Key];
6735-
6736-
auto PAC = MIB.buildInstr(Opcode, {DstReg}, {ValReg});
6737-
6738-
if (!IsDiscZero) {
6739-
PAC.addUse(DiscReg);
6740-
RBI.constrainGenericRegister(DiscReg, AArch64::GPR64spRegClass, MRI);
6741-
}
6742-
6743-
RBI.constrainGenericRegister(DstReg, AArch64::GPR64RegClass, MRI);
6744-
I.eraseFromParent();
6745-
return true;
6746-
}
6747-
case Intrinsic::ptrauth_strip: {
6748-
Register DstReg = I.getOperand(0).getReg();
6749-
Register ValReg = I.getOperand(2).getReg();
6750-
uint64_t Key = I.getOperand(3).getImm();
6751-
6752-
if (Key > AArch64PACKey::LAST)
6753-
return false;
6754-
unsigned Opcode = getXPACOpcodeForKey((AArch64PACKey::ID)Key);
6755-
6756-
MIB.buildInstr(Opcode, {DstReg}, {ValReg});
6757-
6758-
RBI.constrainGenericRegister(DstReg, AArch64::GPR64RegClass, MRI);
6759-
RBI.constrainGenericRegister(ValReg, AArch64::GPR64RegClass, MRI);
6760-
I.eraseFromParent();
6761-
return true;
6762-
}
6763-
case Intrinsic::ptrauth_blend: {
6764-
MachineFunction &MF = *I.getParent()->getParent();
6765-
auto RHS = getIConstantVRegVal(I.getOperand(3).getReg(), MRI);
6766-
if (RHS && (RHS->getZExtValue() <= 0xffff)) {
6767-
I.setDesc(TII.get(AArch64::MOVKXi));
6768-
I.removeOperand(3);
6769-
I.removeOperand(1);
6770-
MachineInstrBuilder(MF, I)
6771-
.addImm(RHS->getZExtValue() & 0xffff)
6772-
.addImm(48)
6773-
.constrainAllUses(TII, TRI, RBI);
6774-
} else {
6775-
I.setDesc(TII.get(AArch64::BFMXri));
6776-
I.removeOperand(1);
6777-
MachineInstrBuilder(MF, I).addImm(16).addImm(15).constrainAllUses(
6778-
TII, TRI, RBI);
6779-
}
6780-
return true;
6781-
}
67826720
case Intrinsic::frameaddress:
67836721
case Intrinsic::returnaddress: {
67846722
MachineFunction &MF = *I.getParent()->getParent();

0 commit comments

Comments
 (0)