llvm.org GIT mirror llvm / 507bb7a
Add a comment noting that the fdiv -> fmul conversion won't generate multiplication by a denormal, and some tests checking that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154431 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 8 years ago
2 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
57685768 APFloat N1APF = N1CFP->getValueAPF();
57695769 APFloat Recip(N1APF.getSemantics(), 1); // 1.0
57705770 APFloat::opStatus st = Recip.divide(N1APF, APFloat::rmNearestTiesToEven);
5771 // Only do the transform if the reciprocal is not too horrible (eg not NaN)
5772 // and the reciprocal is a legal fp imm.
5773 if ((st == APFloat::opOK || st == APFloat::opInexact) &&
5771 // Only do the transform if the reciprocal is a legal fp immediate that
5772 // isn't too nasty (eg NaN, denormal, ...).
5773 if ((st == APFloat::opOK || st == APFloat::opInexact) && // Not too nasty
57745774 (!LegalOperations ||
57755775 // FIXME: custom lowering of ConstantFP might fail (see e.g. ARM
57765776 // backend)... we should handle this gracefully after Legalize.
2222 %div = fdiv double %x, 0.0
2323 ret double %div
2424 }
25
26 define double @denormal1(double %x) {
27 ; Don't generate multiplication by a denormal.
28 ; CHECK: @denormal1
29 ; CHECK: divsd
30 %div = fdiv double %x, 0x7FD0000000000001
31 ret double %div
32 }
33
34 define double @denormal2(double %x) {
35 ; Don't generate multiplication by a denormal.
36 ; CHECK: @denormal
37 ; CHECK: divsd
38 %div = fdiv double %x, 0x7FEFFFFFFFFFFFFF
39 ret double %div
40 }