[ARM] GlobalISel: Legalize G_GEP with 32-bit offsets

At the moment we're only interested in GEPs for putting call parameters on the
stack, so we'll stick to 32-bit offsets.

llvm-svn: 296452
This commit is contained in:
Diana Picus 2017-02-28 09:02:42 +00:00
parent a31efc4b6c
commit 95763abcda
2 changed files with 30 additions and 0 deletions

View File

@ -52,6 +52,9 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
setAction({Op, 1, Ty}, Legal);
}
setAction({G_GEP, p0}, Legal);
setAction({G_GEP, 1, s32}, Legal);
if (ST.hasVFP2()) {
setAction({G_FADD, s32}, Legal);
setAction({G_FADD, s64}, Legal);

View File

@ -11,6 +11,8 @@
define void @test_legal_loads() #0 { ret void }
define void @test_legal_stores() #0 { ret void }
define void @test_gep() { ret void }
define void @test_fadd_s32() #0 { ret void }
define void @test_fadd_s64() #0 { ret void }
@ -242,6 +244,31 @@ body: |
BX_RET 14, _
...
---
name: test_gep
# CHECK-LABEL: name: test_gep
legalized: false
# CHECK: legalized: true
regBankSelected: false
selected: false
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
body: |
bb.0:
liveins: %r0, %r1
%0(p0) = COPY %r0
%1(s32) = COPY %r1
; CHECK: {{%[0-9]+}}(p0) = G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s32)
%2(p0) = G_GEP %0, %1(s32)
%r0 = COPY %2(p0)
BX_RET 14, _, implicit %r0
...
---
name: test_fadd_s32
# CHECK-LABEL: name: test_fadd_s32
legalized: false