diff mbox series

[6/10] Add a vect_element_align_preferred target selector

Message ID 87r2tfpc5o.fsf@linaro.org
State New
Headers show
Series Vectoriser testsuite tweaks | expand

Commit Message

Richard Sandiford Nov. 3, 2017, 4:20 p.m. UTC
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-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

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.

Comments

Jeff Law Nov. 8, 2017, 10:28 p.m. UTC | #1
On 11/03/2017 10:20 AM, Richard Sandiford wrote:
> 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-03  Richard Sandiford  <richard.sandiford@linaro.org>

> 	    Alan Hayward  <alan.hayward@arm.com>

> 	    David Sherwood  <david.sherwood@arm.com>

> 

> 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.

OK.
jeff
diff mbox series

Patch

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2017-11-03 16:06:19.377029536 +0000
+++ gcc/doc/sourcebuild.texi	2017-11-03 16:06:22.561036988 +0000
@@ -1383,6 +1383,10 @@  have different type from the value opera
 @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}.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:19.378029224 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:22.564036053 +0000
@@ -3290,7 +3290,8 @@  proc check_effective_target_vect_peeling
     } 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
     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 { } {
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2017-11-03 16:06:08.010089752 +0000
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c	2017-11-03 16:06:22.561036988 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2017-11-03 16:06:08.010089752 +0000
+++ gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/pr65310.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr65310.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/pr65310.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-26.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-26.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-26.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-54.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-54.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-54.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-56.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-56.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-56.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-58.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-58.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-58.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-60.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-60.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-60.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-89-big-array.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-89.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-89.c	2017-11-03 16:06:22.562036677 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-92.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-92.c	2017-11-03 16:06:08.013090240 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-92.c	2017-11-03 16:06:22.563036365 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-peel-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2015-06-02 23:53:38.000000000 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-peel-1.c	2017-11-03 16:06:22.563036365 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c	2017-09-22 17:44:23.043135080 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c	2017-11-03 16:06:22.563036365 +0000
@@ -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 } } } */
Index: gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-outer-3a.c	2017-09-22 17:44:23.043135080 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-outer-3a.c	2017-11-03 16:06:22.563036365 +0000
@@ -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 } } } */