OSDN Git Service

[GlobalISel][AArch64] Select ADDXri.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 15 Mar 2017 19:20:59 +0000 (19:20 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Wed, 15 Mar 2017 19:20:59 +0000 (19:20 +0000)
We're now able to select ADDWri thanks to the new complex pattern
support.  Extend that to ADDXri.

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

include/llvm/Target/GlobalISel/Target.td
lib/Target/AArch64/AArch64InstrFormats.td
test/CodeGen/AArch64/GlobalISel/select-binop.mir

index b4ca2f8..fa1a424 100644 (file)
@@ -22,6 +22,7 @@
 class LLT;
 
 def s32 : LLT;
+def s64 : LLT;
 
 // Defines a matcher for complex operands. This is analogous to ComplexPattern
 // from SelectionDAG.
index d57e1db..6da7306 100644 (file)
@@ -693,6 +693,10 @@ def gi_addsub_shifted_imm32 :
     GIComplexOperandMatcher<s32, (ops i32imm, i32imm), "selectArithImmed">,
     GIComplexPatternEquiv<addsub_shifted_imm32>;
 
+def gi_addsub_shifted_imm64 :
+    GIComplexOperandMatcher<s64, (ops i32imm, i32imm), "selectArithImmed">,
+    GIComplexPatternEquiv<addsub_shifted_imm64>;
+
 class neg_addsub_shifted_imm<ValueType Ty>
     : Operand<Ty>, ComplexPattern<Ty, 2, "SelectNegArithImmed", [imm]> {
   let PrintMethod = "printAddSubImm";
index 9d7ecf4..c922af7 100644 (file)
@@ -7,6 +7,8 @@
   define void @add_s64_gpr() { ret void }
 
   define void @add_imm_s32_gpr() { ret void }
+  define void @add_imm_s64_gpr() { ret void }
+
   define void @add_imm_s32_gpr_bb() { ret void }
 
   define void @sub_s32_gpr() { ret void }
@@ -140,6 +142,33 @@ body:             |
 ...
 
 ---
+# CHECK-LABEL: name: add_imm_s64_gpr
+name:            add_imm_s64_gpr
+legalized:       true
+regBankSelected: true
+
+# CHECK:      registers:
+# CHECK-NEXT:  - { id: 0, class: gpr64sp }
+# CHECK-NEXT:  - { id: 1, class: gpr64 }
+# CHECK-NEXT:  - { id: 2, class: gpr64sp }
+registers:
+  - { id: 0, class: gpr }
+  - { id: 1, class: gpr }
+  - { id: 2, class: gpr }
+
+# CHECK:  body:
+# CHECK:    %0 = COPY %x0
+# CHECK:    %2 = ADDXri %0, 1, 0
+body:             |
+  bb.0:
+    liveins: %x0, %w1
+
+    %0(s64) = COPY %x0
+    %1(s64) = G_CONSTANT 1
+    %2(s64) = G_ADD %0, %1
+...
+
+---
 # CHECK-LABEL: name: add_imm_s32_gpr_bb
 name:            add_imm_s32_gpr_bb
 legalized:       true