]> granicus.if.org Git - llvm/commitdiff
[ARM] GlobalISel: Legalize 32-bit constants
authorDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 11:33:46 +0000 (11:33 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 11:33:46 +0000 (11:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296468 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMLegalizerInfo.cpp
test/CodeGen/ARM/GlobalISel/arm-legalizer.mir

index 32604811ab98347465c97a1d21983e711449af4e..cc30547a7b4e87c3c003cf82c30513bbf342c8d9 100644 (file)
@@ -55,6 +55,8 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
   setAction({G_GEP, p0}, Legal);
   setAction({G_GEP, 1, s32}, Legal);
 
+  setAction({G_CONSTANT, s32}, Legal);
+
   if (ST.hasVFP2()) {
     setAction({G_FADD, s32}, Legal);
     setAction({G_FADD, s64}, Legal);
index edd8c3ac8f4db2755d60ceaf20cd99ceea1604c8..cbff7e12fb77c872bbb61c41720e8a7c622bbff0 100644 (file)
@@ -13,6 +13,8 @@
 
   define void @test_gep() { ret void }
 
+  define void @test_constants() { ret void }
+
   define void @test_fadd_s32() #0 { ret void }
   define void @test_fadd_s64() #0 { ret void }
 
@@ -269,6 +271,24 @@ body:             |
     BX_RET 14, _, implicit %r0
 ...
 ---
+name:            test_constants
+# CHECK-LABEL: name: test_constants
+legalized:       false
+# CHECK: legalized: true
+regBankSelected: false
+selected:        false
+tracksRegLiveness: true
+registers:
+  - { id: 0, class: _ }
+body:             |
+  bb.0:
+    %0(s32) = G_CONSTANT 42
+    ; CHECK: {{%[0-9]+}}(s32) = G_CONSTANT 42
+
+    %r0 = COPY %0(s32)
+    BX_RET 14, _, implicit %r0
+...
+---
 name:            test_fadd_s32
 # CHECK-LABEL: name: test_fadd_s32
 legalized:       false