llvm.org GIT mirror llvm / f966a40
AMDGPU: cvt_pk_rtz_f16 canonicalizes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339078 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 1 year, 6 months ago
3 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
43354335 // one?
43364336 return false;
43374337 }
4338 case AMDGPUISD::FMUL_LEGACY: {
4338 case AMDGPUISD::FMUL_LEGACY:
4339 case AMDGPUISD::CVT_PKRTZ_F16_F32: {
43394340 if (SNaN)
43404341 return true;
43414342 return DAG.isKnownNeverNaN(Op.getOperand(0), SNaN, Depth + 1) &&
67906790 case AMDGPUISD::DIV_FIXUP:
67916791 case AMDGPUISD::FRACT:
67926792 case AMDGPUISD::LDEXP:
6793 case AMDGPUISD::CVT_PKRTZ_F16_F32:
67936794 return true;
67946795
67956796 // It can/will be lowered or combined as a bit operation.
68626863 case ISD::UNDEF:
68636864 // Could be anything.
68646865 return false;
6866
6867 case ISD::INTRINSIC_WO_CHAIN: {
6868 unsigned IntrinsicID
6869 = cast(Op.getOperand(0))->getZExtValue();
6870 // TODO: Handle more intrinsics
6871 switch (IntrinsicID) {
6872 case Intrinsic::amdgcn_cvt_pkrtz:
6873 return true;
6874 default:
6875 break;
6876 }
6877 }
68656878 default:
68666879 return denormalsEnabledForType(Op.getValueType()) &&
68676880 DAG.isKnownNeverSNaN(Op);
823823 %vec.op = fmul <2 x half> %vec,
824824 %ins = insertelement <2 x half> %vec.op, half %val, i32 %idx
825825 %canonicalized = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %ins)
826 ret <2 x half> %canonicalized
827 }
828
829 ; GCN-LABEL: {{^}}v_test_canonicalize_cvt_pkrtz:
830 ; GCN: s_waitcnt
831 ; GCN-NEXT: v_cvt_pkrtz_f16_f32 v0, v0, v1
832 ; GCN-NEXT: s_setpc_b64
833 define <2 x half> @v_test_canonicalize_cvt_pkrtz(float %a, float %b) {
834 %cvt = call <2 x half> @llvm.amdgcn.cvt.pkrtz(float %a, float %b)
835 %canonicalized = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %cvt)
826836 ret <2 x half> %canonicalized
827837 }
828838
851861 declare float @llvm.minnum.f32(float, float) #0
852862 declare float @llvm.maxnum.f32(float, float) #0
853863 declare double @llvm.maxnum.f64(double, double) #0
864 declare <2 x half> @llvm.amdgcn.cvt.pkrtz(float, float) #0
854865
855866 attributes #0 = { nounwind readnone }
856867 attributes #1 = { "no-nans-fp-math"="true" }