[llvm] r332195 - AMDGPU: Make undef legal for v2i16/v2f16

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun May 13 03:04:38 PDT 2018


Author: arsenm
Date: Sun May 13 03:04:38 2018
New Revision: 332195

URL: http://llvm.org/viewvc/llvm-project?rev=332195&view=rev
Log:
AMDGPU: Make undef legal for v2i16/v2f16

This is apparently necessary to stop undef from being
turned into a build_vector of 0s.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
    llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll

Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=332195&r1=332194&r2=332195&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Sun May 13 03:04:38 2018
@@ -441,6 +441,9 @@ SITargetLowering::SITargetLowering(const
     setOperationAction(ISD::Constant, MVT::v2i16, Legal);
     setOperationAction(ISD::ConstantFP, MVT::v2f16, Legal);
 
+    setOperationAction(ISD::UNDEF, MVT::v2i16, Legal);
+    setOperationAction(ISD::UNDEF, MVT::v2f16, Legal);
+
     setOperationAction(ISD::STORE, MVT::v2i16, Promote);
     AddPromotedToType(ISD::STORE, MVT::v2i16, MVT::i32);
     setOperationAction(ISD::STORE, MVT::v2f16, Promote);

Modified: llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll?rev=332195&r1=332194&r2=332195&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.pkrtz.ll Sun May 13 03:04:38 2018
@@ -23,12 +23,9 @@ define amdgpu_kernel void @s_cvt_pkrtz_s
   ret void
 }
 
-; FIXME: Folds to 0 on gfx9
 ; GCN-LABEL: {{^}}s_cvt_pkrtz_undef_undef:
 ; GCN-NEXT: ; %bb.0
-; SI-NEXT: s_endpgm
-; VI-NEXT: s_endpgm
-; GFX9: v_mov_b32_e32 v{{[0-9]+}}, 0{{$}}
+; GCN-NEXT: s_endpgm
 define amdgpu_kernel void @s_cvt_pkrtz_undef_undef(<2 x half> addrspace(1)* %out) #0 {
   %result = call <2 x half> @llvm.amdgcn.cvt.pkrtz(float undef, float undef)
   store <2 x half> %result, <2 x half> addrspace(1)* %out




More information about the llvm-commits mailing list