From: Cameron McInally Date: Tue, 21 May 2019 21:07:46 +0000 (+0000) Subject: [NFC][InstCombine] Add unary fneg tests to operand-complexity.ll. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e942acd06c0ed6e697643b6c24f61f13323e584;p=llvm [NFC][InstCombine] Add unary fneg tests to operand-complexity.ll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361311 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/operand-complexity.ll b/test/Transforms/InstCombine/operand-complexity.ll index c67fb0803e0..2cccb09328f 100644 --- a/test/Transforms/InstCombine/operand-complexity.ll +++ b/test/Transforms/InstCombine/operand-complexity.ll @@ -104,6 +104,21 @@ define float @fneg(float %x) { ret float %r } +define float @unary_fneg(float %x) { +; CHECK-LABEL: @unary_fneg( +; CHECK-NEXT: [[BO:%.*]] = fdiv float [[X:%.*]], 4.200000e+01 +; CHECK-NEXT: [[FNEGX:%.*]] = fneg float [[X]] +; CHECK-NEXT: [[R:%.*]] = fmul float [[BO]], [[FNEGX]] +; CHECK-NEXT: call void @use(float [[FNEGX]]) +; CHECK-NEXT: ret float [[R]] +; + %bo = fdiv float %x, 42.0 + %fnegx = fneg float %x + %r = fmul float %fnegx, %bo + call void @use(float %fnegx) + ret float %r +} + define <2 x float> @fneg_vec(<2 x float> %x) { ; CHECK-LABEL: @fneg_vec( ; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[X:%.*]], @@ -134,3 +149,18 @@ define <2 x float> @fneg_vec_undef(<2 x float> %x) { ret <2 x float> %r } +define <2 x float> @unary_fneg_vec(<2 x float> %x) { +; CHECK-LABEL: @unary_fneg_vec( +; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[X:%.*]], +; CHECK-NEXT: [[FNEGX:%.*]] = fneg <2 x float> [[X]] +; CHECK-NEXT: [[R:%.*]] = fmul <2 x float> [[BO]], [[FNEGX]] +; CHECK-NEXT: call void @use_vec(<2 x float> [[FNEGX]]) +; CHECK-NEXT: ret <2 x float> [[R]] +; + %bo = fdiv <2 x float> %x, + %fnegx = fneg <2 x float> %x + %r = fmul <2 x float> %fnegx, %bo + call void @use_vec(<2 x float> %fnegx) + ret <2 x float> %r +} +