From: Diana Picus Date: Tue, 28 Feb 2017 11:33:46 +0000 (+0000) Subject: [ARM] GlobalISel: Legalize 32-bit constants X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e855e8c47574be2d8bd3a74dc2f937b225e3a5ba;p=llvm [ARM] GlobalISel: Legalize 32-bit constants git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296468 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMLegalizerInfo.cpp b/lib/Target/ARM/ARMLegalizerInfo.cpp index 32604811ab9..cc30547a7b4 100644 --- a/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -55,6 +55,8 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) { setAction({G_GEP, p0}, Legal); setAction({G_GEP, 1, s32}, Legal); + setAction({G_CONSTANT, 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 edd8c3ac8f4..cbff7e12fb7 100644 --- a/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir +++ b/test/CodeGen/ARM/GlobalISel/arm-legalizer.mir @@ -13,6 +13,8 @@ define void @test_gep() { ret void } + define void @test_constants() { ret void } + define void @test_fadd_s32() #0 { ret void } define void @test_fadd_s64() #0 { ret void } @@ -269,6 +271,24 @@ body: | BX_RET 14, _, implicit %r0 ... --- +name: test_constants +# CHECK-LABEL: name: test_constants +legalized: false +# CHECK: legalized: true +regBankSelected: false +selected: false +tracksRegLiveness: true +registers: + - { id: 0, class: _ } +body: | + bb.0: + %0(s32) = G_CONSTANT 42 + ; CHECK: {{%[0-9]+}}(s32) = G_CONSTANT 42 + + %r0 = COPY %0(s32) + BX_RET 14, _, implicit %r0 +... +--- name: test_fadd_s32 # CHECK-LABEL: name: test_fadd_s32 legalized: false