On 4/11/25 12:57 PM, Alexandre Oliva wrote:
> diff --git a/gcc/testsuite/g++.dg/pr112822.C b/gcc/testsuite/g++.dg/pr112822.C
> index a8557522467d7..9ec5707eb4c4d 100644
> --- a/gcc/testsuite/g++.dg/pr112822.C
> +++ b/gcc/testsuite/g++.dg/pr112822.C
> @@ -1,6 +1,8 @@
> /* PR tree-optimization/112822 */
> /* { dg-do compile { target c++17 } } */
> /* { dg-options "-w -O2" } */
> +/* Required for altivec double vectors. */
> +/* { dg-additional-options "-mvsx" { target powerpc*-*-* } } */
>
> /* Verify we do not ICE on the following noisy creduced test case. */
This will still have problems after Mike's patch goes in:
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/669106.html
It fixes the -mvsx option so that it does not silently promote the -mcpu=
option on you, so I don't think this is the correct fix. The problem is
currently, if you compile with -mcpu=power4 (or any cpu without vector hw)
and then add -mvsx, we silently (and I'd say erroneously) promote your
compile to -mcpu=power7. Mike's patch will instead give an error saying
you need a newer -mcpu= to use -mvsx.
The test case was creduced from preprocessed source, so how about we
remove the altivec attribute and instead use a more generic attribute
which should also compile into simple scalar code for old cpus that don't
have vectors? Then we don't need -mvsx at all. Like the below.
Does that work for you?
This is an architecture independent test case, so I'm surprised this
doesn't FAIL on non-powerpc targets since they don't know anything
about altivec. I'd think the following fix should help them too.
Peter
diff --git a/gcc/testsuite/g++.dg/pr112822.C b/gcc/testsuite/g++.dg/pr112822.C
index a8557522467..f88bd833c92 100644
--- a/gcc/testsuite/g++.dg/pr112822.C
+++ b/gcc/testsuite/g++.dg/pr112822.C
@@ -89,7 +89,7 @@ template <typename aj, typename cm> struct cg<aj, cm> {
typedef aj cn; };
namespace ai {
template <typename cj, int> cj cp;
template <typename bu, typename cj, int> void cl(bu *cr, cj cs) { ct(cr, cs); }
-typedef __attribute__((altivec(vector__))) double co;
+typedef double co __attribute__ ((vector_size (16)));
void ct(double *cr, co cs) { *(co *)cr = cs; }
struct cq {
co q;