summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-11-08 17:44:07 +0000
committerTim Northover <tnorthover@apple.com>2016-11-08 17:44:07 +0000
commit5f7dea85c21e82cf3089ee5a34ad51ac90887642 (patch)
tree75e70feccedc24d6dae3f05efd825a895e483d6c /llvm/lib
parent243a4700cee5228602059d434e763627aa429344 (diff)
downloadbcm5719-llvm-5f7dea85c21e82cf3089ee5a34ad51ac90887642.tar.gz
bcm5719-llvm-5f7dea85c21e82cf3089ee5a34ad51ac90887642.zip
GlobalISel: support selecting fpext/fptrunc instructions on AArch64.
llvm-svn: 286253
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
index 80ea8d6d61d..ac8323ac624 100644
--- a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -953,6 +953,60 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
case TargetOpcode::G_BITCAST:
return selectCopy(I, TII, MRI, TRI, RBI);
+ case TargetOpcode::G_FPEXT: {
+ if (MRI.getType(I.getOperand(0).getReg()) != LLT::scalar(64)) {
+ DEBUG(dbgs() << "G_FPEXT to type " << Ty
+ << ", expected: " << LLT::scalar(64) << '\n');
+ return false;
+ }
+
+ if (MRI.getType(I.getOperand(1).getReg()) != LLT::scalar(32)) {
+ DEBUG(dbgs() << "G_FPEXT from type " << Ty
+ << ", expected: " << LLT::scalar(32) << '\n');
+ return false;
+ }
+
+ const unsigned DefReg = I.getOperand(0).getReg();
+ const RegisterBank &RB = *RBI.getRegBank(DefReg, MRI, TRI);
+
+ if (RB.getID() != AArch64::FPRRegBankID) {
+ DEBUG(dbgs() << "G_FPEXT on bank: " << RB << ", expected: FPR\n");
+ return false;
+ }
+
+ I.setDesc(TII.get(AArch64::FCVTDSr));
+ constrainSelectedInstRegOperands(I, TII, TRI, RBI);
+
+ return true;
+ }
+
+ case TargetOpcode::G_FPTRUNC: {
+ if (MRI.getType(I.getOperand(0).getReg()) != LLT::scalar(32)) {
+ DEBUG(dbgs() << "G_FPTRUNC to type " << Ty
+ << ", expected: " << LLT::scalar(32) << '\n');
+ return false;
+ }
+
+ if (MRI.getType(I.getOperand(1).getReg()) != LLT::scalar(64)) {
+ DEBUG(dbgs() << "G_FPTRUNC from type " << Ty
+ << ", expected: " << LLT::scalar(64) << '\n');
+ return false;
+ }
+
+ const unsigned DefReg = I.getOperand(0).getReg();
+ const RegisterBank &RB = *RBI.getRegBank(DefReg, MRI, TRI);
+
+ if (RB.getID() != AArch64::FPRRegBankID) {
+ DEBUG(dbgs() << "G_FPTRUNC on bank: " << RB << ", expected: FPR\n");
+ return false;
+ }
+
+ I.setDesc(TII.get(AArch64::FCVTSDr));
+ constrainSelectedInstRegOperands(I, TII, TRI, RBI);
+
+ return true;
+ }
+
case TargetOpcode::G_SELECT: {
if (MRI.getType(I.getOperand(1).getReg()) != LLT::scalar(1)) {
DEBUG(dbgs() << "G_SELECT cond has type: " << Ty
OpenPOWER on IntegriCloud