oops, just pushed a different fix for the test
r16-6812-g591e22d91eb0b27d9c54f4df939e28fb81d08093.

Thanks,
Pengxuan

On Thu, Jan 15, 2026 at 12:01 PM Jeffrey Law <[email protected]>
wrote:

>
>
> On 1/14/2026 1:30 AM, Jakub Jelinek wrote:
> > On Fri, Jan 09, 2026 at 11:26:51AM -0800, Pengxuan Zheng wrote:
> >>      PR tree-optimization/123109
> >>      * gcc.dg/pr123109.c: New test.
> >> --- /dev/null
> >> +++ b/gcc/testsuite/gcc.dg/pr123109.c
> >> @@ -0,0 +1,25 @@
> >> +/* { dg-do compile } */
> >> +/* { dg-options "-O2 -fdump-tree-optimized" } */
> >> +
> >> +typedef int v4si __attribute__((vector_size(4 * sizeof(int))));
> >> +typedef unsigned int v4usi __attribute__((vector_size(4 *
> sizeof(unsigned int))));
> >> +
> >> +#define TEST_NE(type)                                         \
> >> +  type test_ne_##type (type a) { return (a >> 31) != 0; }
> >> +
> >> +#define TEST_EQ(type)                                         \
> >> +  type test_eq_##type (type a) { return (a >> 31) == 0; }
> >> +
> >> +TEST_NE(int)
> >> +TEST_NE(unsigned)
> >> +TEST_NE(v4si)
> >> +TEST_NE(v4usi)
> >> +TEST_EQ(int)
> >> +TEST_EQ(unsigned)
> >> +TEST_EQ(v4si)
> >> +TEST_EQ(v4usi)
> >> +
> >> +/* { dg-final { scan-tree-dump-times ">= 0" 2 optimized } } */
> >> +/* { dg-final { scan-tree-dump-times "< 0" 2 optimized } } */
> >> +/* { dg-final { scan-tree-dump-times ">= { 0, 0, 0, 0 }" 2 optimized }
> } */
> >> +/* { dg-final { scan-tree-dump-times ">> 31" 2 optimized } } */
> > This test FAILs on i686-linux and I bet lots of other targets.
> > There are 2 problems.  One is -Wpsabi warnings are emitted on
> > some targets and the more important one, as this is scanning the
> > optimized dump, if the selected ISA doesn't support V4SImode
> > (or V4HImode for 16-bit int targets) vectors natively, vector
> > lowering will lower it to something that will certainly not
> > match the scan-tree-dump-times counts.
> > So, either add -Wpsabi to dg-options and scan some dump before
> > veclower, or the test should be limited to targets with 4x int vector
> > hw support.  Though e.g. vect_int effective target is I think only
> > usable within vect.exp guarded tests because it relies on extra
> > options added for vect.exp tests.  I think you can't
> > invoke check_vect_support_and_set_flags in other tests.
> > Another option is to enable the test on selected targets which
> > are known to include that support by default or dg-additional-options
> > add whatever is needed on the selected targets, e.g.
> > /* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } }
> */
> > would do for ia32.
> > And/or split the test to test scalar stuff separately from vector stuff,
> > and do whatever solution you use for the vector stuff only on the
> > vector test and keep the scalar one on all targets.
> I think the way to go here, if at all possible, is to use -Wno-psabi in
> the options and scan an earlier dump (or dumps).
>
> Pengxuan, can you look and see the first point where each of the
> dg-final artifacts you're looking for actually shows up and adjust the
> test accordingy?
>
>
> Thanks,
> jeff
>
> ps.  It looks like this was picked up by my tester in the overnight runs
> without fallout.  So the problems may in fact be limited to 32bit x86.
>
>

Reply via email to