[GlobalISel][AArch64] Select ADDXri.

We're now able to select ADDWri thanks to the new complex pattern
support.  Extend that to ADDXri.

llvm-svn: 297874
This commit is contained in:
Ahmed Bougacha 2017-03-15 19:20:59 +00:00
parent 86e02ce2dc
commit 62cd73d989
3 changed files with 34 additions and 0 deletions

View 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.

View 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";

View 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 }
@ -139,6 +141,33 @@ body: |
%2(s32) = G_ADD %0, %1
...
---
# 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