From: Richard Sandiford Date: Fri, 24 Aug 2018 13:06:56 +0000 (+0000) Subject: Define vect_perm for variable-length SVE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5cd4f8ceb89596be02801cd11e8dbf78fb10014;p=gcc.git Define vect_perm for variable-length SVE Variable-length SVE now supports enough permutes to define vect_perm. The change to vect_perm_supported is currently a no-op because the function is only called with a count of 3. 2018-08-24 Richard Sandiford gcc/testsuite/ * lib/target-supports.exp (vect_perm_supported): Only return false for variable-length vectors if the permute size is not a power of 2. (check_effective_target_vect_perm) (check_effective_target_vect_perm_byte) (check_effective_target_vect_perm_short): Remove check for variable-length vectors. * gcc.dg/vect/slp-23.c: Add an XFAIL for variable-length SVE. * gcc.dg/vect/slp-perm-10.c: Likewise. * gcc.dg/vect/slp-perm-9.c: Add an XFAIL for variable-length vectors. From-SVN: r263834 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6520f46362a..c6b61981c3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2018-08-24 Richard Sandiford + + * lib/target-supports.exp (vect_perm_supported): Only return + false for variable-length vectors if the permute size is not + a power of 2. + (check_effective_target_vect_perm) + (check_effective_target_vect_perm_byte) + (check_effective_target_vect_perm_short): Remove check for + variable-length vectors. + * gcc.dg/vect/slp-23.c: Add an XFAIL for variable-length SVE. + * gcc.dg/vect/slp-perm-10.c: Likewise. + * gcc.dg/vect/slp-perm-9.c: Add an XFAIL for variable-length vectors. + 2018-08-24 Richard Sandiford * gcc.target/aarch64/sve/bswap_1.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/slp-23.c b/gcc/testsuite/gcc.dg/vect/slp-23.c index 3cda497db0c..7d330c787d1 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-23.c +++ b/gcc/testsuite/gcc.dg/vect/slp-23.c @@ -107,8 +107,8 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_strided8 && { ! { vect_no_align} } } } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided8 || vect_no_align } } } } } */ -/* We fail to vectorize the second loop with variable-length SVE but - fall back to 128-bit vectors, which does use SLP. */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect_perm } } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm } } } */ +/* SLP fails for the second loop with variable-length SVE because + the load size is greater than the minimum vector size. */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm xfail { aarch64_sve && vect_variable_length } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-10.c b/gcc/testsuite/gcc.dg/vect/slp-perm-10.c index 1c2a8580d3c..678152ba416 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-10.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-10.c @@ -50,4 +50,6 @@ int main () } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* SLP fails for variable-length SVE because the load size is greater + than the minimum vector size. */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm xfail { aarch64_sve && vect_variable_length } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c index b01d493b6e7..c54420abd9d 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c @@ -59,7 +59,9 @@ int main (int argc, const char* argv[]) /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { target { ! { vect_perm_short || vect_load_lanes } } } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm_short || vect_load_lanes } } } } */ -/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { ! vect_perm3_short } } } } } */ +/* We don't try permutes with a group size of 3 for variable-length + vectors. */ +/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { ! vect_perm3_short } } xfail vect_variable_length } } } */ /* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! vect_perm3_short } || vect_load_lanes } } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_perm3_short && { ! vect_load_lanes } } } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index b04ceb6508e..b51e8f0a5e9 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -5758,8 +5758,7 @@ proc check_effective_target_vect_perm { } { } else { set et_vect_perm_saved($et_index) 0 if { [is-effective-target arm_neon] - || ([istarget aarch64*-*-*] - && ![check_effective_target_vect_variable_length]) + || [istarget aarch64*-*-*] || [istarget powerpc*-*-*] || [istarget spu-*-*] || [istarget i?86-*-*] || [istarget x86_64-*-*] @@ -5824,7 +5823,9 @@ proc check_effective_target_vect_perm { } { proc vect_perm_supported { count element_bits } { set vector_bits [lindex [available_vector_sizes] 0] - if { $vector_bits <= 0 } { + # The number of vectors has to be a power of 2 when permuting + # variable-length vectors. + if { $vector_bits <= 0 && ($count & -$count) != $count } { return 0 } set vf [expr { $vector_bits / $element_bits }] @@ -5864,8 +5865,7 @@ proc check_effective_target_vect_perm_byte { } { if { ([is-effective-target arm_neon] && [is-effective-target arm_little_endian]) || ([istarget aarch64*-*-*] - && [is-effective-target aarch64_little_endian] - && ![check_effective_target_vect_variable_length]) + && [is-effective-target aarch64_little_endian]) || [istarget powerpc*-*-*] || [istarget spu-*-*] || ([istarget mips-*.*] @@ -5904,8 +5904,7 @@ proc check_effective_target_vect_perm_short { } { if { ([is-effective-target arm_neon] && [is-effective-target arm_little_endian]) || ([istarget aarch64*-*-*] - && [is-effective-target aarch64_little_endian] - && ![check_effective_target_vect_variable_length]) + && [is-effective-target aarch64_little_endian]) || [istarget powerpc*-*-*] || [istarget spu-*-*] || (([istarget i?86-*-*] || [istarget x86_64-*-*])