Add a vect_element_align_preferred target selector
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 9 Nov 2017 15:16:55 +0000 (15:16 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 9 Nov 2017 15:16:55 +0000 (15:16 +0000)
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  <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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254593

18 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c
gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c
gcc/testsuite/gcc.dg/vect/pr65310.c
gcc/testsuite/gcc.dg/vect/vect-26.c
gcc/testsuite/gcc.dg/vect/vect-54.c
gcc/testsuite/gcc.dg/vect/vect-56.c
gcc/testsuite/gcc.dg/vect/vect-58.c
gcc/testsuite/gcc.dg/vect/vect-60.c
gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
gcc/testsuite/gcc.dg/vect/vect-89.c
gcc/testsuite/gcc.dg/vect/vect-92.c
gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
gcc/testsuite/gcc.dg/vect/vect-peel-1.c
gcc/testsuite/lib/target-supports.exp

index 9bb6826365c8e7ee7e62ffd6decc7115ba3417e8..9c62a2fc1defe8902efca645ee09c9a98aee4152 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-09  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * doc/sourcebuild.texi (vect_element_align_preferred): Document.
+
 2017-11-09  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index b36c8129690a94a0cf05f5521815285273de2322..82c1d802893b2dca31556651ff061cb0c14a58ba 100644 (file)
@@ -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}.
 
index fcefc7903b88de7bd4daf576a43167c412133779..ceb4a19fc9720ee92d94d7e1460200ea3284503e 100644 (file)
@@ -1,3 +1,27 @@
+2017-11-09  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * 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  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index 629f908d4c854229fd36427d7f4fa33eb5fe2aac..c3b242157ce782f0b84975c65fcdc4a36eb08fc4 100644 (file)
@@ -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 8ff84b5ab5812cf9718fd80dbe65fe3db23939ea..470bbfb5537226e25d87b5bfbe84f281a42d986d 100644 (file)
@@ -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 14053800ab8ce903ebeda3440caad026f5eace41..57e90d45c9fa3c0899f078d8d81cebbc72e04fff 100644 (file)
@@ -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 c13dbd2bb5566795039e570d1c8ee0e44ec375f5..f8074e6ee84cdacbd0387af6ce74b376e0a412ef 100644 (file)
@@ -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 e21792df9c0fd1659c0d92dfd380c7191717227d..1998d4a1de2440292366b273961c292d737a2945 100644 (file)
@@ -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 6a650f7c4eed7181dfa0b24d20715782d60a3661..5a76adadd7067d9f747783f4c834cb93925eb999 100644 (file)
@@ -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 a243ca9edf91785192fc7a8f450ec4a376f44924..441af51860ea4b60da244d2c26113a977eb85ced 100644 (file)
@@ -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 980c8f67801a8525543b699561805173ba4f6fdd..918ec5b40c1ebdd9f8ca56dc72a8f98a68f9ff08 100644 (file)
@@ -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 42355ff72812d196753c792e90146cda5cdce086..409c7c960060fa8008fcc797f084b792cfa574cb 100644 (file)
@@ -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 dd0405508c09928c1097b2e970ba486b3bbe38d5..65fc8dbc33abfa7e9507532f8f91d7c472755d53 100644 (file)
@@ -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 ba108f78e9136fcca4ee7bd7e2926e20c57a1c94..b9a1ce23d0206dba28318b9c77c13492b45b5f3e 100644 (file)
@@ -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 b84f5afa0e2cc84798509c46c63cfdb12267831d..fd841b182e3c81eed43a249fe401c6213814ea36 100644 (file)
@@ -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 d3ba837c95de678c4b4a6a9d722bcc08cb333e9a..d26440d1a64e887aa2cd6ccf1330cb34d244ef12 100644 (file)
@@ -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 0a4e732a08bfa6db6c795928a3e122ae2dcb42a6..abd12859927b722e8933ac8dccd627b8e1cdee16 100644 (file)
@@ -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 8043d24976493fa1f481c9a8d6ddb9a85c2828a5..38548ee516113712eeb40b2be55f6264212c3608 100644 (file)
@@ -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 { } {