Update vector_all_ones_operand to return true for const all 1s float
vectors.

gcc/

        PR target/101804
        * config/i386/predicates.md (vector_all_ones_operand): Return
        true for const all 1s float vectors.

gcc/testsuite/

        PR target/101804
        * gcc.target/i386/avx2-gather-2.c: Pass -march=skylake instead
        of "-mavx2 -mtune=skylake".  Scan vpcmpeqd.
---
 gcc/config/i386/predicates.md                 | 7 ++++---
 gcc/testsuite/gcc.target/i386/avx2-gather-2.c | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 6aa1ea32627..9637e64ea58 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1126,9 +1126,10 @@ (define_predicate "float_vector_all_ones_operand"
 
 /* Return true if operand is a vector constant that is all ones. */
 (define_predicate "vector_all_ones_operand"
-  (and (match_code "const_vector")
-       (match_test "INTEGRAL_MODE_P (GET_MODE (op))")
-       (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
+  (ior (and (match_code "const_vector")
+           (match_test "INTEGRAL_MODE_P (GET_MODE (op))")
+           (match_test "op == CONSTM1_RTX (GET_MODE (op))"))
+       (match_operand 0 "float_vector_all_ones_operand")))
 
 ; Return true when OP is operand acceptable for vector memory operand.
 ; Only AVX can have misaligned memory operand.
diff --git a/gcc/testsuite/gcc.target/i386/avx2-gather-2.c 
b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
index 1a704afd834..ad5ef73107c 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-gather-2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O3 -mavx2 -fdump-tree-vect-details -mtune=skylake" } */
+/* { dg-options "-O3 -fdump-tree-vect-details -march=skylake" } */
 
 #include "avx2-gather-1.c"
 
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 16 
"vect" } } */
+/* { dg-final { scan-assembler "vpcmpeqd" } } */
-- 
2.31.1

Reply via email to