summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2017-02-16 11:00:31 +0000
committerDiana Picus <diana.picus@linaro.org>2017-02-16 11:00:31 +0000
commita93803b9fe8817607ce7be9c5ba8ce3b3611e8ee (patch)
tree2188f470a0b86da7d2b644b8eac00426a6c0e9cd /llvm
parentf7de84ab9f0611dee1f07470afda5171055f325d (diff)
downloadbcm5719-llvm-a93803b9fe8817607ce7be9c5ba8ce3b3611e8ee.tar.gz
bcm5719-llvm-a93803b9fe8817607ce7be9c5ba8ce3b3611e8ee.zip
[ARM] GlobalISel: Add reg bank mappings for G_SEQUENCE and G_EXTRACT
Support G_SEQUENCE and G_EXTRACT as needed for passing double precision floating point values in the soft-fp float mode. llvm-svn: 295306
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp26
-rw-r--r--llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir32
2 files changed, 58 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp b/llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
index 7af51c68b3a..193a85502e6 100644
--- a/llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
@@ -143,6 +143,32 @@ ARMRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
case G_FRAME_INDEX:
OperandsMapping = getOperandsMapping({&ARM::ValueMappings[0], nullptr});
break;
+ case G_SEQUENCE: {
+ // We only support G_SEQUENCE for creating a double precision floating point
+ // value out of two GPRs.
+ LLT Ty1 = MRI.getType(MI.getOperand(1).getReg());
+ LLT Ty2 = MRI.getType(MI.getOperand(3).getReg());
+ if (Ty.getSizeInBits() != 64 || Ty1.getSizeInBits() != 32 ||
+ Ty2.getSizeInBits() != 32)
+ return InstructionMapping{};
+ OperandsMapping =
+ getOperandsMapping({&ARM::ValueMappings[6], &ARM::ValueMappings[0],
+ nullptr, &ARM::ValueMappings[0], nullptr});
+ break;
+ }
+ case G_EXTRACT: {
+ // We only support G_EXTRACT for splitting a double precision floating point
+ // value into two GPRs.
+ LLT Ty1 = MRI.getType(MI.getOperand(1).getReg());
+ LLT Ty2 = MRI.getType(MI.getOperand(2).getReg());
+ if (Ty.getSizeInBits() != 32 || Ty1.getSizeInBits() != 32 ||
+ Ty2.getSizeInBits() != 64)
+ return InstructionMapping{};
+ OperandsMapping =
+ getOperandsMapping({&ARM::ValueMappings[0], &ARM::ValueMappings[0],
+ &ARM::ValueMappings[6], nullptr, nullptr});
+ break;
+ }
default:
return InstructionMapping{};
}
diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir b/llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir
index 7d3b6c23109..cc80634abd1 100644
--- a/llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir
+++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-regbankselect.mir
@@ -9,6 +9,8 @@
define void @test_fadd_s32() { ret void }
define void @test_fadd_s64() { ret void }
+
+ define void @test_soft_fp_s64() { ret void }
...
---
name: test_add_s32
@@ -202,5 +204,35 @@ body: |
BX_RET 14, _, implicit %d0
...
+---
+name: test_soft_fp_s64
+# CHECK-LABEL: name: test_soft_fp_s64
+legalized: true
+regBankSelected: false
+selected: false
+# CHECK: registers:
+# CHECK: - { id: 0, class: gprb }
+# CHECK: - { id: 1, class: gprb }
+# CHECK: - { id: 2, class: fprb }
+# CHECK: - { id: 3, class: gprb }
+# CHECK: - { id: 4, class: gprb }
+
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+ - { id: 2, class: _ }
+ - { id: 3, class: _ }
+ - { id: 4, class: _ }
+body: |
+ bb.0:
+ liveins: %r0, %r1
+
+ %0(s32) = COPY %r0
+ %1(s32) = COPY %r1
+ %2(s64) = G_SEQUENCE %0(s32), 0, %1(s32), 32
+ %3(s32), %4(s32) = G_EXTRACT %2(s64), 0, 32
+ %r0 = COPY %3(s32)
+ %r1 = COPY %4(s32)
+ BX_RET 14, _, implicit %r0, implicit %r1
...
OpenPOWER on IntegriCloud