From: Richard Sandiford Date: Thu, 9 Nov 2017 15:16:55 +0000 (+0000) Subject: Add a vect_element_align_preferred target selector X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d83db5d73ce3e355f9ac166e04d72ce41decfb5;p=gcc.git Add a vect_element_align_preferred target selector This patch adds a target selector for targets whose preferred_vector_alignment is the alignment of one element. We'll never peel in that case, and the step of a loop that operates on normal (as opposed to packed) elements will always divide the preferred alignment. 2017-11-09 Richard Sandiford Alan Hayward David Sherwood gcc/ * doc/sourcebuild.texi (vect_element_align_preferred): Document. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_vect_element_align_preferred): New proc. (check_effective_target_vect_peeling_profitable): Test it. * gcc.dg/vect/no-section-anchors-vect-31.c: Don't expect peeling if vect_element_align_preferred. * gcc.dg/vect/no-section-anchors-vect-64.c: Likewise. * gcc.dg/vect/pr65310.c: Likewise. * gcc.dg/vect/vect-26.c: Likewise. * gcc.dg/vect/vect-54.c: Likewise. * gcc.dg/vect/vect-56.c: Likewise. * gcc.dg/vect/vect-58.c: Likewise. * gcc.dg/vect/vect-60.c: Likewise. * gcc.dg/vect/vect-89-big-array.c: Likewise. * gcc.dg/vect/vect-89.c: Likewise. * gcc.dg/vect/vect-92.c: Likewise. * gcc.dg/vect/vect-peel-1.c: Likewise. * gcc.dg/vect/vect-outer-3a-big-array.c: Expect the step to divide the alignment if vect_element_align_preferred. * gcc.dg/vect/vect-outer-3a.c: Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r254593 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9bb6826365c..9c62a2fc1de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-11-09 Richard Sandiford + Alan Hayward + David Sherwood + + * doc/sourcebuild.texi (vect_element_align_preferred): Document. + 2017-11-09 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index b36c8129690..82c1d802893 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1383,6 +1383,10 @@ have different type from the value operands. @item vect_double Target supports hardware vectors of @code{double}. +@item vect_element_align_preferred +The target's preferred vector alignment is the same as the element +alignment. + @item vect_float Target supports hardware vectors of @code{float}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fcefc7903b8..ceb4a19fc97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,27 @@ +2017-11-09 Richard Sandiford + Alan Hayward + David Sherwood + + * lib/target-supports.exp + (check_effective_target_vect_element_align_preferred): New proc. + (check_effective_target_vect_peeling_profitable): Test it. + * gcc.dg/vect/no-section-anchors-vect-31.c: Don't expect peeling + if vect_element_align_preferred. + * gcc.dg/vect/no-section-anchors-vect-64.c: Likewise. + * gcc.dg/vect/pr65310.c: Likewise. + * gcc.dg/vect/vect-26.c: Likewise. + * gcc.dg/vect/vect-54.c: Likewise. + * gcc.dg/vect/vect-56.c: Likewise. + * gcc.dg/vect/vect-58.c: Likewise. + * gcc.dg/vect/vect-60.c: Likewise. + * gcc.dg/vect/vect-89-big-array.c: Likewise. + * gcc.dg/vect/vect-89.c: Likewise. + * gcc.dg/vect/vect-92.c: Likewise. + * gcc.dg/vect/vect-peel-1.c: Likewise. + * gcc.dg/vect/vect-outer-3a-big-array.c: Expect the step to + divide the alignment if vect_element_align_preferred. + * gcc.dg/vect/vect-outer-3a.c: Likewise. + 2017-11-09 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c index 629f908d4c8..c3b242157ce 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c @@ -94,4 +94,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c index 8ff84b5ab58..470bbfb5537 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c @@ -91,4 +91,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr65310.c b/gcc/testsuite/gcc.dg/vect/pr65310.c index 14053800ab8..57e90d45c9f 100644 --- a/gcc/testsuite/gcc.dg/vect/pr65310.c +++ b/gcc/testsuite/gcc.dg/vect/pr65310.c @@ -18,5 +18,5 @@ int t(b *a) /* The memory access is through a pointer of type c which means *ptr is not aligned. */ -/* { dg-final { scan-tree-dump "can't force alignment" "vect" } } */ -/* { dg-final { scan-tree-dump-not "misalign = 0" "vect" } } */ +/* { dg-final { scan-tree-dump "can't force alignment" "vect" { xfail vect_element_align_preferred } } } */ +/* { dg-final { scan-tree-dump-not "misalign = 0" "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-26.c b/gcc/testsuite/gcc.dg/vect/vect-26.c index c13dbd2bb55..f8074e6ee84 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-26.c +++ b/gcc/testsuite/gcc.dg/vect/vect-26.c @@ -37,4 +37,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-54.c b/gcc/testsuite/gcc.dg/vect/vect-54.c index e21792df9c0..1998d4a1de2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-54.c +++ b/gcc/testsuite/gcc.dg/vect/vect-54.c @@ -61,4 +61,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-56.c b/gcc/testsuite/gcc.dg/vect/vect-56.c index 6a650f7c4ee..5a76adadd70 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-56.c +++ b/gcc/testsuite/gcc.dg/vect/vect-56.c @@ -70,5 +70,5 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred} } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-58.c b/gcc/testsuite/gcc.dg/vect/vect-58.c index a243ca9edf9..441af51860e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-58.c +++ b/gcc/testsuite/gcc.dg/vect/vect-58.c @@ -59,4 +59,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-60.c b/gcc/testsuite/gcc.dg/vect/vect-60.c index 980c8f67801..918ec5b40c1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-60.c +++ b/gcc/testsuite/gcc.dg/vect/vect-60.c @@ -71,5 +71,5 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { { ! vect_element_align } || vect_element_align_preferred } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align && { ! vect_element_align_preferred } } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c index 42355ff7281..409c7c96006 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c @@ -46,4 +46,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-89.c b/gcc/testsuite/gcc.dg/vect/vect-89.c index dd0405508c0..65fc8dbc33a 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-89.c +++ b/gcc/testsuite/gcc.dg/vect/vect-89.c @@ -50,4 +50,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-92.c b/gcc/testsuite/gcc.dg/vect/vect-92.c index ba108f78e91..b9a1ce23d02 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-92.c +++ b/gcc/testsuite/gcc.dg/vect/vect-92.c @@ -98,4 +98,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c index b84f5afa0e2..fd841b182e3 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c @@ -49,4 +49,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ -/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c index d3ba837c95d..d26440d1a64 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c @@ -49,4 +49,4 @@ int main (void) } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */ -/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c index 0a4e732a08b..abd12859927 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c @@ -49,4 +49,4 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 8043d249764..38548ee5161 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3290,7 +3290,8 @@ proc check_effective_target_vect_peeling_profitable { } { } else { set et_vect_peeling_profitable_saved($et_index) 1 if { ([istarget s390*-*-*] - && [check_effective_target_s390_vx]) } { + && [check_effective_target_s390_vx]) + || [check_effective_target_vect_element_align_preferred] } { set et_vect_peeling_profitable_saved($et_index) 0 } } @@ -6342,6 +6343,13 @@ proc check_effective_target_vect_natural_alignment { } { return $et_vect_natural_alignment } +# Return 1 if the target doesn't prefer any alignment beyond element +# alignment during vectorization. + +proc check_effective_target_vect_element_align_preferred { } { + return [check_effective_target_vect_variable_length] +} + # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise. proc check_effective_target_vector_alignment_reachable { } {