[llvm] r305692 - AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> legal
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 06:15:46 PDT 2017
Author: tstellar
Date: Mon Jun 19 08:15:45 2017
New Revision: 305692
URL: http://llvm.org/viewvc/llvm-project?rev=305692&view=rev
Log:
AMDGPU/GlobalISel: Mark G_BITCAST s32 <--> <2 x s16> 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/D34129
Added:
llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.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=305692&r1=305691&r2=305692&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp Mon Jun 19 08:15:45 2017
@@ -29,6 +29,7 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo
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);
@@ -36,6 +37,12 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo
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.
Added: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir?rev=305692&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir Mon Jun 19 08:15:45 2017
@@ -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
+...
More information about the llvm-commits
mailing list