[llvm] r361076 - [NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 14:10:12 PDT 2019


Author: mcinally
Date: Fri May 17 14:10:11 2019
New Revision: 361076

URL: http://llvm.org/viewvc/llvm-project?rev=361076&view=rev
Log:
[NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll

Modified:
    llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll

Modified: llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll?rev=361076&r1=361075&r2=361076&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll Fri May 17 14:10:11 2019
@@ -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> <float -0.0, float -0.0>, %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> <float -0.0, float undef>, %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:%.*]]




More information about the llvm-commits mailing list