1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Add a comment noting that the fdiv -> fmul conversion won't generate

multiplication by a denormal, and some tests checking that.

llvm-svn: 154431
This commit is contained in:
Duncan Sands 2012-04-10 20:35:27 +00:00
parent 16712e549c
commit 6d360055c5
2 changed files with 19 additions and 3 deletions

View File

@ -5769,9 +5769,9 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
APFloat N1APF = N1CFP->getValueAPF();
APFloat Recip(N1APF.getSemantics(), 1); // 1.0
APFloat::opStatus st = Recip.divide(N1APF, APFloat::rmNearestTiesToEven);
// Only do the transform if the reciprocal is not too horrible (eg not NaN)
// and the reciprocal is a legal fp imm.
if ((st == APFloat::opOK || st == APFloat::opInexact) &&
// Only do the transform if the reciprocal is a legal fp immediate that
// isn't too nasty (eg NaN, denormal, ...).
if ((st == APFloat::opOK || st == APFloat::opInexact) && // Not too nasty
(!LegalOperations ||
// FIXME: custom lowering of ConstantFP might fail (see e.g. ARM
// backend)... we should handle this gracefully after Legalize.

View File

@ -23,3 +23,19 @@ define double @funky(double %x) {
%div = fdiv double %x, 0.0
ret double %div
}
define double @denormal1(double %x) {
; Don't generate multiplication by a denormal.
; CHECK: @denormal1
; CHECK: divsd
%div = fdiv double %x, 0x7FD0000000000001
ret double %div
}
define double @denormal2(double %x) {
; Don't generate multiplication by a denormal.
; CHECK: @denormal
; CHECK: divsd
%div = fdiv double %x, 0x7FEFFFFFFFFFFFFF
ret double %div
}