]> granicus.if.org Git - llvm/commitdiff
[ARM] GlobalISel: Select G_GEP
authorDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 10:14:38 +0000 (10:14 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 10:14:38 +0000 (10:14 +0000)
At this point, G_GEP is just an add, so we treat it exactly like a G_ADD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296462 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstructionSelector.cpp
test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir

index c7ed3c3d6e3be81873d656cb11228e36c00dd13b..dccd717eb995ef1d0a1017237b5c45dfc7b33693 100644 (file)
@@ -299,6 +299,7 @@ bool ARMInstructionSelector::select(MachineInstr &I) const {
     break;
   }
   case G_ADD:
+  case G_GEP:
     I.setDesc(TII.get(ARM::ADDrr));
     MIB.add(predOps(ARMCC::AL)).add(condCodeOp());
     break;
index 24b95647e95163408116bf45afc16be678631df5..847c10c29701c2b93b101c13a2c0618922ba7ae1 100644 (file)
@@ -18,6 +18,8 @@
 
   define void @test_stores() #0 { ret void }
 
+  define void @test_gep() { ret void }
+
   define void @test_soft_fp_double() #0 { ret void }
 
   attributes #0 = { "target-features"="+vfp2,-neonfp" }
@@ -437,6 +439,33 @@ body:             |
     BX_RET 14, _
 ...
 ---
+name:            test_gep
+# CHECK-LABEL: name: test_gep
+legalized:       true
+regBankSelected: true
+selected:        false
+# CHECK: selected: true
+registers:
+  - { id: 0, class: gprb }
+  - { id: 1, class: gprb }
+  - { id: 2, class: gprb }
+# CHECK: id: [[PTR:[0-9]+]], class: gpr
+# CHECK: id: [[OFF:[0-9]+]], class: gpr
+# CHECK: id: [[GEP:[0-9]+]], class: gpr
+body:             |
+  bb.0:
+    liveins: %r0, %r1
+
+    %0(p0) = COPY %r0
+    %1(s32) = COPY %r1
+
+    %2(p0) = G_GEP %0, %1(s32)
+    ; CHECK: %[[GEP]] = ADDrr %[[PTR]], %[[OFF]], 14, _, _
+
+    %r0 = COPY %2(p0)
+    BX_RET 14, _, implicit %r0
+...
+---
 name:            test_soft_fp_double
 # CHECK-LABEL: name: test_soft_fp_double
 legalized:       true