Hi! On Tue, Jul 13, 2021 at 09:30:43PM +0200, Jakub Jelinek wrote: > PR target/101384 > * config/rs6000/rs6000-protos.h (easy_altivec_constant): Change return > type from bool to int. > * config/rs6000/rs6000.c (vspltis_constant): Fix up handling the > EASY_VECTOR_MSB case if either step or copies is not 1. > (vspltis_shifted): Fix comment typo. > (easy_altivec_constant): Change return type from bool to int, instead > of returning true return byte size of the element mode that should be > used to synthetize the constant. > * config/rs6000/predicates.md (easy_vector_constant_msb): Require > that vspltis_shifted is 0, handle the case where easy_altivec_constant > assumes using different vector mode from CONST_VECTOR's mode. > * config/rs6000/altivec.md (easy_vector_constant_msb splitter): Use > easy_altivec_constant to determine mode in which -1 >> -1 should be > performed, use rs6000_expand_vector_init instead of gen_vec_initv4sisi. > > * gcc.dg/pr101384.c: New test. > * gcc.target/powerpc/pr101384-1.c: New test. > * gcc.target/powerpc/pr101384-2.c: New test.
> - if (mode == V4SFmode) > + switch (easy_altivec_constant (operands[1], <MODE>mode)) > { > - mode = V4SImode; > - dest = gen_lowpart (V4SImode, dest); > + case 1: mode = V16QImode; break; > + case 2: mode = V8HImode; break; > + case 4: mode = V4SImode; break; > + default: gcc_unreachable (); > } case 1: mode = V16QImode; break; etc. (and/or make a convenience function for it). > --- gcc/testsuite/gcc.dg/pr101384.c.jj 2021-07-13 13:45:42.971992584 > +0200 > +++ gcc/testsuite/gcc.dg/pr101384.c 2021-07-13 13:45:32.427135184 +0200 > @@ -0,0 +1,39 @@ > +/* PR target/101384 */ > +/* { dg-do run } */ > +/* { dg-options "-O2 -Wno-psabi -w" } */ If you have -w anyway, do you / why do you still need -Wno-psabi? > --- gcc/testsuite/gcc.target/powerpc/pr101384-1.c.jj 2021-07-13 > 14:02:57.003030314 +0200 > +++ gcc/testsuite/gcc.target/powerpc/pr101384-1.c 2021-07-13 > 14:02:40.868247714 +0200 > @@ -0,0 +1,79 @@ > +/* PR target/101384 */ > +/* { dg-do compile { target le } } */ > +/* { dg-options "-O2 -maltivec" } */ > +/* { dg-require-effective-target powerpc_altivec_ok } */ > +/* { dg-final { scan-assembler-times {\mvspltis[whb] [^\n\r]*,-1\M} 9 } } */ If you put (?p) at the front of your regex it gets "partial newline- sensitive matching", which means that . will not match newlines. See https://www.tcl.tk/man/tcl/TclCmd/re_syntax.html#M95 for details. Here, you could also use /* { dg-final { scan-assembler-times {\mvspltis[whb] [^,]*,-1\M} 9 } } */ (but that (more traditional) approach quickly becomes clumsy). Okay for trunk with or without those improvements (with the switch formatting fix though). Thanks! Segher