diff options
author | Richard Biener <rguenther@suse.de> | 2022-02-10 10:01:20 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-02-10 10:54:43 +0100 |
commit | 4a8083285c3edf50088a095870b217ab0881dff0 (patch) | |
tree | 0d9e7fb081110611a5802296362af21a1af1693c | |
parent | 1b72d456b2a88218ed440655ef0b9e29b4ef63a9 (diff) | |
download | gcc-4a8083285c3edf50088a095870b217ab0881dff0.zip gcc-4a8083285c3edf50088a095870b217ab0881dff0.tar.gz gcc-4a8083285c3edf50088a095870b217ab0881dff0.tar.bz2 |
middle-end/104467 - fix vector extract simplification
This fixes a bogus vector type used for a CTOR build as part of
vector extract simplification. The code failed to consider a
CTOR of vector elements.
2022-02-10 Richard Biener <rguenther@suse.de>
PR middle-end/104467
* match.pd (vector extract simplification): Multiply the
number of CTOR elements with the number of element elements.
* gcc.dg/torture/pr104467.c: New testcase.
-rw-r--r-- | gcc/match.pd | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr104467.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 4fe5909..d9d8359 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -6943,7 +6943,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) TREE_TYPE (TREE_TYPE (ctor))) ? type : build_vector_type (TREE_TYPE (TREE_TYPE (ctor)), - count)); + count * k)); res = (constant_p ? build_vector_from_ctor (evtype, vals) : build_constructor (evtype, vals)); } diff --git a/gcc/testsuite/gcc.dg/torture/pr104467.c b/gcc/testsuite/gcc.dg/torture/pr104467.c new file mode 100644 index 0000000..c3bfb60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr104467.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } } */ + +unsigned long __attribute__((__vector_size__ (8 * sizeof (long)))) u; +signed long __attribute__((__vector_size__ (8 * sizeof (long)))) s; + +void +foo (void) +{ + s &= u + (0, 0); +} |