From 4f15b6a282bc4c11ee8b32dac4f05aab10ce3e10 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 4 Oct 2017 12:00:34 +0000 Subject: [PATCH] New target check: vect_peeling_profitable gcc/ChangeLog: 2017-10-04 Andreas Krebbel * doc/sourcebuild.texi: Document vect_peeling_profitable. gcc/testsuite/ChangeLog: 2017-10-04 Andreas Krebbel * g++.dg/vect/slp-pr56812.cc: xfail for targets which don't want vector loop peeling. * lib/target-supports.exp (check_effective_target_vect_peeling_profitable): New proc. From-SVN: r253407 --- gcc/ChangeLog | 4 ++++ gcc/doc/sourcebuild.texi | 3 +++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/vect/slp-pr56812.cc | 4 +++- gcc/testsuite/lib/target-supports.exp | 22 ++++++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb76db2ec4a..7ad2fe0ba9b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-10-04 Andreas Krebbel + + * doc/sourcebuild.texi: Document vect_peeling_profitable. + 2017-10-04 Andreas Krebbel * doc/sourcebuild.texi: Document vect_intdouble_cvt and diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index e09bca102f0..1646d0a9991 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1404,6 +1404,9 @@ Target supports a vector misalign access. @item vect_no_align Target does not support a vector alignment mechanism. +@item vect_peeling_profitable +Target might require to peel loops for alignment purposes. + @item vect_no_int_min_max Target does not support a vector min and max instruction on @code{int}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f06b7b2e74f..62991d5583e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-10-04 Andreas Krebbel + + * g++.dg/vect/slp-pr56812.cc: xfail for targets which don't want + vector loop peeling. + * lib/target-supports.exp (check_effective_target_vect_peeling_profitable): + New proc. + 2017-10-04 Andreas Krebbel * gcc.dg/vect/pr66251.c: Replace vect_floatint_cvt with diff --git a/gcc/testsuite/g++.dg/vect/slp-pr56812.cc b/gcc/testsuite/g++.dg/vect/slp-pr56812.cc index 80bdcddd11e..8b24b337efa 100644 --- a/gcc/testsuite/g++.dg/vect/slp-pr56812.cc +++ b/gcc/testsuite/g++.dg/vect/slp-pr56812.cc @@ -17,4 +17,6 @@ void mydata::Set (float x) data[i] = x; } -/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" } } */ +/* For targets without vector loop peeling the loop becomes cheap + enough to be vectorized. */ +/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { xfail { ! vect_peeling_profitable } } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 4f752ec2529..b6f9e51c481 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3277,6 +3277,28 @@ proc check_effective_target_vect_floatuint_cvt { } { return $et_vect_floatuint_cvt_saved($et_index) } +# Return 1 if peeling for alignment might be profitable on the target +# + +proc check_effective_target_vect_peeling_profitable { } { + global et_vect_peeling_profitable_saved + global et_index + + if [info exists et_vect_peeling_profitable_saved($et_index)] { + verbose "check_effective_target_vect_peeling_profitable: using cached result" 2 + } else { + set et_vect_peeling_profitable_saved($et_index) 1 + if { ([istarget s390*-*-*] + && [check_effective_target_s390_vx]) } { + set et_vect_peeling_profitable_saved($et_index) 0 + } + } + + verbose "check_effective_target_vect_peeling_profitable:\ + returning $et_vect_peeling_profitable_saved($et_index)" 2 + return $et_vect_peeling_profitable_saved($et_index) +} + # Return 1 if the target supports #pragma omp declare simd, 0 otherwise. # # This won't change for different subtargets so cache the result. -- 2.30.2