Skip to content

Commit c4a9854

Browse files
committed
use afn for int_to_fp and add comments
1 parent 41ab020 commit c4a9854

File tree

2 files changed

+6
-26
lines changed

2 files changed

+6
-26
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8905,10 +8905,13 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
89058905
// be lost at this stage, but is below the single-precision rounding
89068906
// position.
89078907
//
8908-
// However, if -enable-unsafe-fp-math is in effect, accept double
8908+
// However, if afn is in effect, accept double
89098909
// rounding to avoid the extra overhead.
8910+
// FIXME: Currently INT_TO_FP can't support fast math flags because
8911+
// of nneg flag, thus Op->getFlags().hasApproximateFuncs() is always
8912+
// false.
89108913
if (Op.getValueType() == MVT::f32 && !Subtarget.hasFPCVT() &&
8911-
!Op->getFlags().hasNoFPExcept()) {
8914+
!Op->getFlags().hasApproximateFuncs()) {
89128915

89138916
// Twiddle input to make sure the low 11 bits are zero. (If this
89148917
// is the case, we are guaranteed the value will fit into the 53 bit

llvm/test/CodeGen/PowerPC/i64_fp_round.ll

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,4 @@ entry:
5555
ret float %conv
5656
}
5757

58-
define float @test_constrained(i64 %x) nounwind readnone {
59-
; Also check that with fpexcept.ignore we do not get that extra
60-
; code sequence. Simply verify that there is no "isel" present.
61-
; CHECK-LABEL: test_constrained:
62-
; CHECK: # %bb.0: # %entry
63-
; CHECK-NEXT: std 3, -8(1)
64-
; CHECK-NEXT: lfd 0, -8(1)
65-
; CHECK-NEXT: xscvsxddp 0, 0
66-
; CHECK-NEXT: frsp 1, 0
67-
; CHECK-NEXT: blr
68-
;
69-
; CHECK-NO-ISEL-LABEL: test_constrained:
70-
; CHECK-NO-ISEL: # %bb.0: # %entry
71-
; CHECK-NO-ISEL-NEXT: std 3, -8(1)
72-
; CHECK-NO-ISEL-NEXT: lfd 0, -8(1)
73-
; CHECK-NO-ISEL-NEXT: xscvsxddp 0, 0
74-
; CHECK-NO-ISEL-NEXT: frsp 1, 0
75-
; CHECK-NO-ISEL-NEXT: blr
76-
entry:
77-
%conv = call float @llvm.experimental.constrained.sitofp.f32.i64(i64 %x, metadata !"round.dynamic", metadata !"fpexcept.ignore")
78-
ret float %conv
79-
}
80-
81-
declare float @llvm.experimental.constrained.sitofp.f32.i64(i64, metadata, metadata)
58+
; TODO: Add sitofp afn test.

0 commit comments

Comments
 (0)