From 761fac3e9b5b3bad2a165e95ca36b8251db0e21c Mon Sep 17 00:00:00 2001 From: Diana Picus Date: Tue, 28 Feb 2017 09:02:42 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296452 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMLegalizerInfo.cpp | 3 +++ test/CodeGen/ARM/GlobalISel/arm-legalizer.mir | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/Target/ARM/ARMLegalizerInfo.cpp b/lib/Target/ARM/ARMLegalizerInfo.cpp index 631d2b85e8c..32604811ab9 100644 --- a/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -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); diff --git a/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir b/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir index 49cf9f82271..edd8c3ac8f4 100644 --- a/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir +++ b/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir @@ -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 -- 2.40.0