AMDGPU: Make undef legal for v2i16/v2f16
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 13 May 2018 10:04:38 +0000 (10:04 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sun, 13 May 2018 10:04:38 +0000 (10:04 +0000)
This is apparently necessary to stop undef from being
turned into a build_vector of 0s.

llvm-svn: 332195

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

index 31d8392c374dd0a7e9ce70e4ec401dec58321c1a..cca47f58ba59f45568ec1f44ae89142456cc7013 100644 (file)
@@ -441,6 +441,9 @@ SITargetLowering::SITargetLowering(const TargetMachine &TM,
     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);
index 0aa64e2290dc0c65657969524ea556beb519ea42..9cbbdc3ffd1ffadd36517ca19eadccbd24de3093 100644 (file)
@@ -23,12 +23,9 @@ define amdgpu_kernel void @s_cvt_pkrtz_samereg_v2f16_f32(<2 x half> addrspace(1)
   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