@@ -541,12 +541,15 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
541
541
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i32, Custom);
542
542
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i64, Custom);
543
543
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i128, Custom);
544
- setOperationAction(ISD::FP_ROUND, MVT::f16, Custom);
545
544
setOperationAction(ISD::FP_ROUND, MVT::f32, Custom);
546
545
setOperationAction(ISD::FP_ROUND, MVT::f64, Custom);
547
546
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f16, Custom);
548
547
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f32, Custom);
549
548
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f64, Custom);
549
+ if (!Subtarget->hasFullFP16())
550
+ setOperationAction(ISD::FP_ROUND, MVT::f16, Expand);
551
+ else
552
+ setOperationAction(ISD::FP_ROUND, MVT::f16, Custom);
550
553
551
554
setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i32, Custom);
552
555
setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i64, Custom);
@@ -24616,6 +24619,10 @@ void AArch64TargetLowering::ReplaceBITCASTResults(
24616
24619
EVT VT = N->getValueType(0);
24617
24620
EVT SrcVT = Op.getValueType();
24618
24621
24622
+ // Default to the generic legalizer
24623
+ if (SrcVT == MVT::f16 && !Subtarget->hasFullFP16())
24624
+ return;
24625
+
24619
24626
if (VT == MVT::v2i16 && SrcVT == MVT::i32) {
24620
24627
CustomNonLegalBITCASTResults(N, Results, DAG, MVT::v2i32, MVT::v4i16);
24621
24628
return;
@@ -25044,14 +25051,6 @@ void AArch64TargetLowering::ReplaceNodeResults(
25044
25051
Results.push_back(
25045
25052
LowerToPredicatedOp(SDValue(N, 0), DAG, AArch64ISD::MULHU_PRED));
25046
25053
return;
25047
- case ISD::FP_ROUND: {
25048
- if (N->getValueType(0) == MVT::f16 && !Subtarget->hasFullFP16()) {
25049
- SDLoc DL(N);
25050
- Results.push_back(
25051
- DAG.getNode(ISD::FP_TO_FP16, DL, MVT::i16, N->getOperand(0)));
25052
- }
25053
- return;
25054
- }
25055
25054
case ISD::FP_TO_UINT:
25056
25055
case ISD::FP_TO_SINT:
25057
25056
case ISD::STRICT_FP_TO_SINT:
0 commit comments