From: Cameron McInally Date: Fri, 17 May 2019 21:10:11 +0000 (+0000) Subject: [NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e36567e474f0f4aaa55f845da7ee0e61e551ed37;p=llvm [NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361076 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/test/Transforms/InstSimplify/floating-point-arithmetic.ll index b24293cead4..ee8a6451fe7 100644 --- a/test/Transforms/InstSimplify/floating-point-arithmetic.ll +++ b/test/Transforms/InstSimplify/floating-point-arithmetic.ll @@ -1,6 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instsimplify -S | FileCheck %s +; fneg (fneg X) ==> X define float @fneg_fneg_var(float %a) { ; CHECK-LABEL: @fneg_fneg_var( ; CHECK-NEXT: ret float [[A:%.*]] @@ -10,6 +11,34 @@ define float @fneg_fneg_var(float %a) { ret float %r1 } +; fneg (fsub -0.0, X) ==> X +define float @fsub_-0_x(float %a) { +; CHECK-LABEL: @fsub_-0_x( +; CHECK-NEXT: ret float [[A:%.*]] +; + %t1 = fsub float -0.0, %a + %ret = fneg float %t1 + ret float %ret +} + +define <2 x float> @fsub_-0_x_vec(<2 x float> %a) { +; CHECK-LABEL: @fsub_-0_x_vec( +; CHECK-NEXT: ret <2 x float> [[A:%.*]] +; + %t1 = fsub <2 x float> , %a + %ret = fneg <2 x float> %t1 + ret <2 x float> %ret +} + +define <2 x float> @fsub_-0_x_vec_undef_elts(<2 x float> %a) { +; CHECK-LABEL: @fsub_-0_x_vec_undef_elts( +; CHECK-NEXT: ret <2 x float> [[A:%.*]] +; + %t1 = fsub <2 x float> , %a + %ret = fneg <2 x float> %t1 + ret <2 x float> %ret +} + define <2 x float> @fsub_negzero_vec_undef_elts(<2 x float> %x) { ; CHECK-LABEL: @fsub_negzero_vec_undef_elts( ; CHECK-NEXT: ret <2 x float> [[X:%.*]]