Skip to content

Commit 86a60e1

Browse files
committed
use afn for int_to_fp and add comments
1 parent b5eb4b6 commit 86a60e1

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
@@ -8901,10 +8901,13 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
89018901
// be lost at this stage, but is below the single-precision rounding
89028902
// position.
89038903
//
8904-
// However, if -enable-unsafe-fp-math is in effect, accept double
8904+
// However, if afn is in effect, accept double
89058905
// rounding to avoid the extra overhead.
8906+
// FIXME: Currently INT_TO_FP can't support fast math flags because
8907+
// of nneg flag, thus Op->getFlags().hasApproximateFuncs() is always
8908+
// false.
89068909
if (Op.getValueType() == MVT::f32 && !Subtarget.hasFPCVT() &&
8907-
!Op->getFlags().hasNoFPExcept()) {
8910+
!Op->getFlags().hasApproximateFuncs()) {
89088911

89098912
// Twiddle input to make sure the low 11 bits are zero. (If this
89108913
// 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)