[llvm] r357776 - [InstCombine] add test to show reassociation that creates a denormal constant; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 5 09:42:21 PDT 2019
Author: spatel
Date: Fri Apr 5 09:42:21 2019
New Revision: 357776
URL: http://llvm.org/viewvc/llvm-project?rev=357776&view=rev
Log:
[InstCombine] add test to show reassociation that creates a denormal constant; NFC
Modified:
llvm/trunk/test/Transforms/InstCombine/fmul.ll
Modified: llvm/trunk/test/Transforms/InstCombine/fmul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fmul.ll?rev=357776&r1=357775&r2=357776&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fmul.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fmul.ll Fri Apr 5 09:42:21 2019
@@ -460,6 +460,21 @@ define <4 x float> @fdiv_constant_denomi
ret <4 x float> %t3
}
+; This shows that at least part of instcombine does not check constant
+; values to see if it is creating denorms (0x3800000000000000 is a denorm
+; for 32-bit float), so protecting against denorms in other parts is
+; probably not doing the intended job.
+
+define float @fmul_constant_reassociation(float %x) {
+; CHECK-LABEL: @fmul_constant_reassociation(
+; CHECK-NEXT: [[R:%.*]] = fmul reassoc nsz float [[X:%.*]], 0x3800000000000000
+; CHECK-NEXT: ret float [[R]]
+;
+ %mul_flt_min = fmul reassoc nsz float %x, 0x3810000000000000
+ %r = fmul reassoc nsz float %mul_flt_min, 0.5
+ ret float %r
+}
+
; Rule "X/C1 * C2 => X * (C2/C1) is not applicable if C2/C1 is abnormal
; 0x3810000000000000 == FLT_MIN
More information about the llvm-commits
mailing list