From 7dc0230252fae9c0de31b582852147385ba7c16c Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Wed, 29 May 2019 16:50:14 +0000 Subject: [PATCH] [NFC][InstCombine] Add a unary FNeg test to fsub.ll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361988 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/fsub.ll | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/Transforms/InstCombine/fsub.ll b/test/Transforms/InstCombine/fsub.ll index 33f994da29b..f4d971c7ff1 100644 --- a/test/Transforms/InstCombine/fsub.ll +++ b/test/Transforms/InstCombine/fsub.ll @@ -14,6 +14,17 @@ define float @test1(float %x, float %y) { ret float %t2 } +define float @test1_unary(float %x, float %y) { +; CHECK-LABEL: @test1_unary( +; CHECK-NEXT: [[T1:%.*]] = fsub float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[T2:%.*]] = fneg float [[T1]] +; CHECK-NEXT: ret float [[T2]] +; + %t1 = fsub float %x, %y + %t2 = fneg float %t1 + ret float %t2 +} + ; Can't do anything with the test above because -0.0 - 0.0 = -0.0, but if we have nsz: ; -(X - Y) --> Y - X -- 2.40.0