From: Sanjay Patel Date: Fri, 5 Apr 2019 16:42:21 +0000 (+0000) Subject: [InstCombine] add test to show reassociation that creates a denormal constant; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a81f025cf5dd06487b1b27d20b2dad44177c1ab;p=llvm [InstCombine] add test to show reassociation that creates a denormal constant; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357776 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll index 3d5821c6209..d8a970266ec 100644 --- a/test/Transforms/InstCombine/fmul.ll +++ b/test/Transforms/InstCombine/fmul.ll @@ -460,6 +460,21 @@ define <4 x float> @fdiv_constant_denominator_fmul_vec_constexpr(<4 x float> %x) 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