[llvm] r296108 - [ARM] GlobalISel: Legalize stores

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 03:28:24 PST 2017


Author: rovka
Date: Fri Feb 24 05:28:24 2017
New Revision: 296108

URL: http://llvm.org/viewvc/llvm-project?rev=296108&view=rev
Log:
[ARM] GlobalISel: Legalize stores

Allow the same types that we allow for loads.

Modified:
    llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
    llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir

Modified: llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp?rev=296108&r1=296107&r2=296108&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp Fri Feb 24 05:28:24 2017
@@ -37,9 +37,11 @@ ARMLegalizerInfo::ARMLegalizerInfo(const
 
   setAction({G_FRAME_INDEX, p0}, Legal);
 
-  for (auto Ty : {s1, s8, s16, s32, p0})
-    setAction({G_LOAD, Ty}, Legal);
-  setAction({G_LOAD, 1, p0}, Legal);
+  for (unsigned Op : {G_LOAD, G_STORE}) {
+    for (auto Ty : {s1, s8, s16, s32, p0})
+      setAction({Op, Ty}, Legal);
+    setAction({Op, 1, p0}, Legal);
+  }
 
   for (auto Ty : {s1, s8, s16, s32})
     setAction({G_ADD, Ty}, Legal);
@@ -55,6 +57,7 @@ ARMLegalizerInfo::ARMLegalizerInfo(const
     setAction({G_FADD, s64}, Legal);
 
     setAction({G_LOAD, s64}, Legal);
+    setAction({G_STORE, s64}, Legal);
   }
 
   computeTables();

Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir?rev=296108&r1=296107&r2=296108&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir Fri Feb 24 05:28:24 2017
@@ -9,6 +9,7 @@
 
   define void @test_load_from_stack() { ret void }
   define void @test_legal_loads() #0 { ret void }
+  define void @test_legal_stores() #0 { ret void }
 
   define void @test_fadd_s32() #0 { ret void }
   define void @test_fadd_s64() #0 { ret void }
@@ -199,6 +200,48 @@ body:             |
     BX_RET 14, _
 ...
 ---
+name:            test_legal_stores
+# CHECK-LABEL: name: test_legal_stores
+legalized:       false
+# CHECK: legalized: true
+regBankSelected: false
+selected:        false
+tracksRegLiveness: true
+registers:
+  - { id: 0, class: _ }
+  - { id: 1, class: _ }
+  - { id: 2, class: _ }
+  - { id: 3, class: _ }
+  - { id: 4, class: _ }
+  - { id: 5, class: _ }
+  - { id: 6, class: _ }
+body:             |
+  bb.0:
+    liveins: %r0, %r1, %r2, %r3, %r4, %r5, %r6, %d1
+
+    ; These are all legal, so we should find them unchanged in the output
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(s64), %0(p0)
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(s32), %0(p0)
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(s16), %0(p0)
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(s8), %0(p0)
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(s1), %0(p0)
+    ; CHECK-DAG: G_STORE {{%[0-9]+}}(p0), %0(p0)
+    %0(p0) = COPY %r0
+    %1(s64) = COPY %d1
+    G_STORE %1(s64), %0(p0) :: (store 8)
+    %2(s32) = COPY %r2
+    G_STORE %2(s32), %0(p0) :: (store 4)
+    %3(s16) = COPY %r3
+    G_STORE %3(s16), %0(p0) :: (store 2)
+    %4(s8) = COPY %r4
+    G_STORE %4(s8), %0(p0) :: (store 1)
+    %5(s1) = COPY %r5
+    G_STORE %5(s1), %0(p0) :: (store 1)
+    %6(p0) = COPY %r6
+    G_STORE %6(p0), %0(p0) :: (store 4)
+    BX_RET 14, _
+...
+---
 name:            test_fadd_s32
 # CHECK-LABEL: name: test_fadd_s32
 legalized:       false




More information about the llvm-commits mailing list