From a0d67c748ad08134a771a09faa99d1957505748a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 12 May 2017 16:46:46 +0000 Subject: [PATCH] AMDGPU/GlobalISel: Mark 32-bit integer constants as legal Reviewers: arsenm Reviewed By: arsenm Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, igorb, dstuttard, tpr, t-tye, llvm-commits Differential Revision: https://reviews.llvm.org/D33115 llvm-svn: 302919 --- llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | 1 + .../CodeGen/AMDGPU/GlobalISel/legalize-constant.mir | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index a2567a5..9de3029 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -33,6 +33,7 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo() { const LLT P1 = LLT::pointer(1, 64); const LLT P2 = LLT::pointer(2, 64); + setAction({G_CONSTANT, S32}, Legal); setAction({G_CONSTANT, S64}, Legal); setAction({G_GEP, P1}, Legal); diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir new file mode 100644 index 0000000..8839ba8 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir @@ -0,0 +1,20 @@ +# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer -global-isel %s -o - | FileCheck %s + +--- | + define void @test_constant() { + entry: + ret void + } +... + +--- +name: test_constant +registers: + - { id: 0, class: _ } +body: | + bb.0.entry: + ; CHECK-LABEL: name: test_constant + ; CHECK: %0(s32) = G_CONSTANT i32 5 + + %0(s32) = G_CONSTANT i32 5 +... -- 2.7.4