[llvm] r302919 - AMDGPU/GlobalISel: Mark 32-bit integer constants as legal

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 09:46:46 PDT 2017


Author: tstellar
Date: Fri May 12 11:46:46 2017
New Revision: 302919

URL: http://llvm.org/viewvc/llvm-project?rev=302919&view=rev
Log:
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

Added:
    llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
Modified:
    llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp?rev=302919&r1=302918&r2=302919&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp Fri May 12 11:46:46 2017
@@ -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);

Added: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir?rev=302919&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir Fri May 12 11:46:46 2017
@@ -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
+...




More information about the llvm-commits mailing list