[PATCH] D33791: AMDGPU/GlobalISel: Mark 1-bit integer constants as legal

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 18:14:08 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL304628: AMDGPU/GlobalISel: Mark 1-bit integer constants as legal (authored by tstellar).

Changed prior to commit:
  https://reviews.llvm.org/D33791?vs=101053&id=101303#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33791

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


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -28,11 +28,16 @@
 AMDGPULegalizerInfo::AMDGPULegalizerInfo() {
   using namespace TargetOpcode;
 
+  const LLT S1= LLT::scalar(1);
   const LLT S32 = LLT::scalar(32);
   const LLT S64 = LLT::scalar(64);
   const LLT P1 = LLT::pointer(1, 64);
   const LLT P2 = LLT::pointer(2, 64);
 
+  // FIXME: i1 operands to intrinsics should always be legal, but other i1
+  // values may not be legal.  We need to figure out how to distinguish
+  // between these two scenarios.
+  setAction({G_CONSTANT, S1}, Legal);
   setAction({G_CONSTANT, S32}, Legal);
   setAction({G_CONSTANT, S64}, Legal);
 
Index: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
@@ -10,18 +10,27 @@
   entry:
     ret void
   }
+
+  declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
+
+  attributes #1 = { nounwind }
+
 ...
 
 ---
 name:            test_constant
 registers:
   - { id: 0, class: _ }
+  - { id: 1, class: _ }
 body: |
   bb.0.entry:
     ; CHECK-LABEL: name: test_constant
     ; CHECK: %0(s32) = G_CONSTANT i32 5
+    ; CHECK: %1(s1) = G_CONSTANT i1 false
 
     %0(s32) = G_CONSTANT i32 5
+    %1(s1) = G_CONSTANT i1 0
+    G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.exp.f32), %0, %0, %0, %0, %0, %0, %1, %1;
 ...
 
 ---


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33791.101303.patch
Type: text/x-patch
Size: 1708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170603/7c470207/attachment.bin>


More information about the llvm-commits mailing list