[llvm] r361311 - [NFC][InstCombine] Add unary fneg tests to operand-complexity.ll.

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 14:07:46 PDT 2019


Author: mcinally
Date: Tue May 21 14:07:46 2019
New Revision: 361311

URL: http://llvm.org/viewvc/llvm-project?rev=361311&view=rev
Log:
[NFC][InstCombine] Add unary fneg tests to operand-complexity.ll.

Modified:
    llvm/trunk/test/Transforms/InstCombine/operand-complexity.ll

Modified: llvm/trunk/test/Transforms/InstCombine/operand-complexity.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/operand-complexity.ll?rev=361311&r1=361310&r2=361311&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/operand-complexity.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/operand-complexity.ll Tue May 21 14:07:46 2019
@@ -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:%.*]], <float 4.200000e+01, float -4.200000e+01>
@@ -132,5 +147,20 @@ define <2 x float> @fneg_vec_undef(<2 x
   %r = fmul <2 x float> %fnegx, %bo
   call void @use_vec(<2 x float> %fnegx)
   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:%.*]], <float 4.200000e+01, float -4.200000e+01>
+; 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, <float 42.0, float -42.0>
+  %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
 }
 




More information about the llvm-commits mailing list