[llvm] r361973 - [NFC][InstCombine] Add unary FNeg tests to fpcast.ll and fpextend.ll

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 08:29:35 PDT 2019


Author: mcinally
Date: Wed May 29 08:29:35 2019
New Revision: 361973

URL: http://llvm.org/viewvc/llvm-project?rev=361973&view=rev
Log:
[NFC][InstCombine] Add unary FNeg tests to fpcast.ll and fpextend.ll

Modified:
    llvm/trunk/test/Transforms/InstCombine/fpcast.ll
    llvm/trunk/test/Transforms/InstCombine/fpextend.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fpcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fpcast.ll?rev=361973&r1=361972&r2=361973&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fpcast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fpcast.ll Wed May 29 08:29:35 2019
@@ -40,6 +40,18 @@ define half @fneg_fptrunc(float %a) {
   ret half %c
 }
 
+; FIXME: This combine isn't working.
+define half @unary_fneg_fptrunc(float %a) {
+; CHECK-LABEL: @unary_fneg_fptrunc(
+; CHECK-NEXT:    [[B:%.*]] = fneg float [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc float [[B]] to half
+; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fneg float %a
+  %c = fptrunc float %b to half
+  ret half %c
+}
+
 define <2 x half> @fneg_fptrunc_vec_undef(<2 x float> %a) {
 ; CHECK-LABEL: @fneg_fptrunc_vec_undef(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc <2 x float> [[A:%.*]] to <2 x half>
@@ -51,6 +63,18 @@ define <2 x half> @fneg_fptrunc_vec_unde
   ret <2 x half> %c
 }
 
+; FIXME: This combine isn't working.
+define <2 x half> @unary_fneg_fptrunc_vec(<2 x float> %a) {
+; CHECK-LABEL: @unary_fneg_fptrunc_vec(
+; CHECK-NEXT:    [[B:%.*]] = fneg <2 x float> [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc <2 x float> [[B]] to <2 x half>
+; CHECK-NEXT:    ret <2 x half> [[C]]
+;
+  %b = fneg <2 x float> %a
+  %c = fptrunc <2 x float> %b to <2 x half>
+  ret <2 x half> %c
+}
+
 define half @test4-fast(float %a) {
 ; CHECK-LABEL: @test4-fast(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
@@ -61,6 +85,18 @@ define half @test4-fast(float %a) {
   %c = fptrunc float %b to half
   ret half %c
 }
+
+; FIXME: This combine isn't working.
+define half @test4_unary_fneg-fast(float %a) {
+; CHECK-LABEL: @test4_unary_fneg-fast(
+; CHECK-NEXT:    [[B:%.*]] = fneg fast float [[A:%.*]]
+; CHECK-NEXT:    [[C:%.*]] = fptrunc float [[B]] to half
+; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fneg fast float %a
+  %c = fptrunc float %b to half
+  ret half %c
+}
 
 define half @test5(float %a, float %b, float %c) {
 ; CHECK-LABEL: @test5(

Modified: llvm/trunk/test/Transforms/InstCombine/fpextend.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fpextend.ll?rev=361973&r1=361972&r2=361973&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fpextend.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fpextend.ll Wed May 29 08:29:35 2019
@@ -55,6 +55,22 @@ entry:
   ret float %tmp34
 }
 
+; FIXME: This combine isn't working.
+define float @test4_unary_fneg(float %x) nounwind  {
+; CHECK-LABEL: @test4_unary_fneg(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[TMP1:%.*]] = fpext float [[X:%.*]] to double
+; CHECK-NEXT:    [[TMP2:%.*]] = fneg double [[TMP1]]
+; CHECK-NEXT:    [[TMP34:%.*]] = fptrunc double [[TMP2]] to float
+; CHECK-NEXT:    ret float [[TMP34]]
+;
+entry:
+  %tmp1 = fpext float %x to double
+  %tmp2 = fneg double %tmp1
+  %tmp34 = fptrunc double %tmp2 to float
+  ret float %tmp34
+}
+
 ; Test with vector splat constant
 define <2 x float> @test5(<2 x float> %x) nounwind  {
 ; CHECK-LABEL: @test5(




More information about the llvm-commits mailing list