Skip to content

Commit e88f793

Browse files
committed
Responding to review comments
Change-Id: Ib18e0ceeaab18d31d3fc43daab838ea95d62c2c1
1 parent 752605f commit e88f793

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,15 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
541541
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i32, Custom);
542542
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i64, Custom);
543543
setOperationAction(ISD::STRICT_UINT_TO_FP, MVT::i128, Custom);
544-
setOperationAction(ISD::FP_ROUND, MVT::f16, Custom);
545544
setOperationAction(ISD::FP_ROUND, MVT::f32, Custom);
546545
setOperationAction(ISD::FP_ROUND, MVT::f64, Custom);
547546
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f16, Custom);
548547
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f32, Custom);
549548
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);
550553

551554
setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i32, Custom);
552555
setOperationAction(ISD::FP_TO_UINT_SAT, MVT::i64, Custom);
@@ -24616,6 +24619,10 @@ void AArch64TargetLowering::ReplaceBITCASTResults(
2461624619
EVT VT = N->getValueType(0);
2461724620
EVT SrcVT = Op.getValueType();
2461824621

24622+
// Default to the generic legalizer
24623+
if (SrcVT == MVT::f16 && !Subtarget->hasFullFP16())
24624+
return;
24625+
2461924626
if (VT == MVT::v2i16 && SrcVT == MVT::i32) {
2462024627
CustomNonLegalBITCASTResults(N, Results, DAG, MVT::v2i32, MVT::v4i16);
2462124628
return;
@@ -25044,14 +25051,6 @@ void AArch64TargetLowering::ReplaceNodeResults(
2504425051
Results.push_back(
2504525052
LowerToPredicatedOp(SDValue(N, 0), DAG, AArch64ISD::MULHU_PRED));
2504625053
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-
}
2505525054
case ISD::FP_TO_UINT:
2505625055
case ISD::FP_TO_SINT:
2505725056
case ISD::STRICT_FP_TO_SINT:

llvm/test/CodeGen/AArch64/float16-promotion-with-nofp.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ define half @f2h(float %a) {
88
; CHECK-NEXT: .cfi_def_cfa_offset 16
99
; CHECK-NEXT: .cfi_offset w30, -16
1010
; CHECK-NEXT: bl __gnu_f2h_ieee
11+
; CHECK-NEXT: and w0, w0, #0xffff
12+
; CHECK-NEXT: bl __gnu_h2f_ieee
13+
; CHECK-NEXT: bl __gnu_f2h_ieee
1114
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
1215
; CHECK-NEXT: ret
1316
entry:

0 commit comments

Comments
 (0)