[PATCH] D34129: AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 06:16:34 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305692: AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal (authored by tstellar).

Changed prior to commit:
  https://reviews.llvm.org/D34129?vs=102277&id=103035#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34129

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


Index: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
@@ -0,0 +1,23 @@
+# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
+
+--- |
+  define void @test_bitcast() { ret void }
+...
+
+---
+name:            test_bitcast
+registers:
+  - { id: 0, class: _ }
+  - { id: 1, class: _ }
+  - { id: 2, class: _ }
+body: |
+  bb.0:
+    liveins: %vgpr0
+    ; CHECK-LABEL: name: test_bitcast
+    ; CHECK: %1(<2 x s16>) = G_BITCAST %0
+    ; CHECK: %2(s32) = G_BITCAST %1
+
+    %0(s32) = COPY %vgpr0
+    %1(<2 x s16>) = G_BITCAST %0
+    %2(s32) = G_BITCAST %1
+...
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -29,13 +29,20 @@
   using namespace TargetOpcode;
 
   const LLT S1= LLT::scalar(1);
+  const LLT V2S16 = LLT::vector(2, 16);
   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);
 
   setAction({G_ADD, S32}, Legal);
 
+  setAction({G_BITCAST, V2S16}, Legal);
+  setAction({G_BITCAST, 1, S32}, Legal);
+
+  setAction({G_BITCAST, S32}, Legal);
+  setAction({G_BITCAST, 1, V2S16}, Legal);
+
   // 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34129.103035.patch
Type: text/x-patch
Size: 1747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170619/fc05f3fd/attachment.bin>


More information about the llvm-commits mailing list