]> granicus.if.org Git - llvm/commitdiff
[NFC][InstSimplify] Add more unary fneg tests to floating-point-arithmetic.ll
authorCameron McInally <cameron.mcinally@nyu.edu>
Fri, 17 May 2019 21:10:11 +0000 (21:10 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Fri, 17 May 2019 21:10:11 +0000 (21:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361076 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstSimplify/floating-point-arithmetic.ll

index b24293cead4f662c444c614180dbdb0b640f5616..ee8a6451fe726ec469340a08dd32acce6225a73c 100644 (file)
@@ -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:%.*]]