]> granicus.if.org Git - llvm/commitdiff
[NFC][InstCombine] Add unary fneg tests to operand-complexity.ll.
authorCameron McInally <cameron.mcinally@nyu.edu>
Tue, 21 May 2019 21:07:46 +0000 (21:07 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Tue, 21 May 2019 21:07:46 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361311 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/operand-complexity.ll

index c67fb0803e03b692f85fe195e61d665a168d1cc6..2cccb09328f960f5a90e14ece4fd8794602abd4d 100644 (file)
@@ -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>
@@ -134,3 +149,18 @@ define <2 x float> @fneg_vec_undef(<2 x float> %x) {
   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
+}
+