On Mon, Aug 10, 2026 at 10:06 AM H.J. Lu <[email protected]> wrote:
>
> On Sun, Aug 9, 2026 at 6:26 PM <[email protected]> wrote:
> >
> > From: Kyrylo Tkachov <[email protected]>
> >
> > The positive test only folds when the wide and narrow vector MIN operations
> > are available. Default x86_64 lowers the V2DI MIN before the narrowing rule
> > can see it, so the dump still contains the wide type.
> >
> > Enable AVX512VL and AVX512DQ for x86 targets to enable the type.
> >
> > Tested on x86_64-pc-linux-gnu.
> > Pushed to trunk.
> >
> > gcc/testsuite/ChangeLog:
> >
> > * g++.dg/tree-ssa/vec-narrow-1.C: Enable AVX512VL and AVX512DQ on
> > x86 targets.
> >
> > Signed-off-by: Kyrylo Tkachov <[email protected]>
> > ---
> > gcc/testsuite/g++.dg/tree-ssa/vec-narrow-1.C | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/gcc/testsuite/g++.dg/tree-ssa/vec-narrow-1.C
> > b/gcc/testsuite/g++.dg/tree-ssa/vec-narrow-1.C
> > index de738e33c30..cec5b0ba345 100644
> > --- a/gcc/testsuite/g++.dg/tree-ssa/vec-narrow-1.C
> > +++ b/gcc/testsuite/g++.dg/tree-ssa/vec-narrow-1.C
> > @@ -1,5 +1,6 @@
> > // { dg-do compile }
> > // { dg-options "-O2 -fdump-tree-optimized" }
> > +// { dg-additional-options "-mavx512vl -mavx512dq" { target { i?86-*-*
> > x86_64-*-* } } }
Also -msse4 is sufficient.
> > // Extension is monotone, so it commutes with the comparison and the outer
> > // truncation is exact. The argument is lanewise, so a widened vector
> > // MIN/MAX feeding a truncating conversion narrows.
> > --
> > 2.50.1 (Apple Git-155)
> >
>
> This failed with
>
> $ make check-c++ RUNTESTFLAGS="--target_board='unix{-m32}'
> dg.exp=vec-narrow-1.C"
>
> on Linux/x86-64.
>
> --
> H.J.
--
H.J.