summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2019-08-29 16:45:19 +0000
committerJessica Paquette <jpaquette@apple.com>2019-08-29 16:45:19 +0000
commitb8b23a1648ec4fb800957465e3c92db6cc1d9072 (patch)
treedb9056dc6704fd54c54131908257533b2c7accaa /llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
parent907452107dfb1e7ffdc2e8e70eecdeb95ca7ef2f (diff)
downloadbcm5719-llvm-b8b23a1648ec4fb800957465e3c92db6cc1d9072.tar.gz
bcm5719-llvm-b8b23a1648ec4fb800957465e3c92db6cc1d9072.zip
[GlobalISel][AArch64] Use a GISelPredicateCode to select llvm.aarch64.stlxr.*
Remove manual selection code for this intrinsic and use a GISelPredicateCode instead. This allows us to fully select this intrinsic without any tricky custom C++ matching. Differential Revision: https://reviews.llvm.org/D65780 llvm-svn: 370380
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
index 88ab0a385c8..dda8f1c0968 100644
--- a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -3912,23 +3912,6 @@ static unsigned findIntrinsicID(MachineInstr &I) {
return IntrinOp->getIntrinsicID();
}
-/// Helper function to emit the correct opcode for a llvm.aarch64.stlxr
-/// intrinsic.
-static unsigned getStlxrOpcode(unsigned NumBytesToStore) {
- switch (NumBytesToStore) {
- // TODO: 1 and 2 byte stores
- case 4:
- return AArch64::STLXRW;
- case 8:
- return AArch64::STLXRX;
- default:
- LLVM_DEBUG(dbgs() << "Unexpected number of bytes to store! ("
- << NumBytesToStore << ")\n");
- break;
- }
- return 0;
-}
-
bool AArch64InstructionSelector::selectIntrinsicWithSideEffects(
MachineInstr &I, MachineRegisterInfo &MRI) const {
// Find the intrinsic ID.
@@ -3949,48 +3932,6 @@ bool AArch64InstructionSelector::selectIntrinsicWithSideEffects(
return false;
MIRBuilder.buildInstr(AArch64::BRK, {}, {}).addImm(0xF000);
break;
- case Intrinsic::aarch64_stlxr:
- Register StatReg = I.getOperand(0).getReg();
- assert(RBI.getSizeInBits(StatReg, MRI, TRI) == 32 &&
- "Status register must be 32 bits!");
- Register SrcReg = I.getOperand(2).getReg();
-
- if (RBI.getSizeInBits(SrcReg, MRI, TRI) != 64) {
- LLVM_DEBUG(dbgs() << "Only support 64-bit sources right now.\n");
- return false;
- }
-
- Register PtrReg = I.getOperand(3).getReg();
- assert(MRI.getType(PtrReg).isPointer() && "Expected pointer operand");
-
- // Expect only one memory operand.
- if (!I.hasOneMemOperand())
- return false;
-
- const MachineMemOperand *MemOp = *I.memoperands_begin();
- unsigned NumBytesToStore = MemOp->getSize();
- unsigned Opc = getStlxrOpcode(NumBytesToStore);
- if (!Opc)
- return false;
- unsigned NumBitsToStore = NumBytesToStore * 8;
- if (NumBitsToStore != 64) {
- // The intrinsic always has a 64-bit source, but we might actually want
- // a differently-sized source for the instruction. Try to get it.
- // TODO: For 1 and 2-byte stores, this will have a G_AND. For now, let's
- // just handle 4-byte stores.
- // TODO: If we don't find a G_ZEXT, we'll have to truncate the value down
- // to the right size for the STLXR.
- MachineInstr *Zext = getOpcodeDef(TargetOpcode::G_ZEXT, SrcReg, MRI);
- if (!Zext)
- return false;
- SrcReg = Zext->getOperand(1).getReg();
- // We should get an appropriately-sized register here.
- if (RBI.getSizeInBits(SrcReg, MRI, TRI) != NumBitsToStore)
- return false;
- }
- auto StoreMI = MIRBuilder.buildInstr(Opc, {StatReg}, {SrcReg, PtrReg})
- .addMemOperand(*I.memoperands_begin());
- constrainSelectedInstRegOperands(*StoreMI, TII, TRI, RBI);
}
I.eraseFromParent();
OpenPOWER on IntegriCloud