Hi Avinash, On 08/09/25 2:54 pm, Avinash Jayakar wrote: > Hi, > > This is the third version of the patch proposed for master aiming to fix > PR119702. Requesting review of this patch. > > The following sequence of assembly in powerpc64le > vspltisw 0,1 > vsld 2,2,0 > is replaced by this > vaddudm 2,2,2 > whenever there is a vector left shift by a constant value 1.
A better commit message is in order here. Something like: Whenever a vector is left shifted by a constant value 1, gcc generates the following code: <code> Instead the following code can be generated which is more efficient: <new code> This patch adds a pattern in altivec.md to recognize a vector left shift by a constant value, and generate add instructions if constant is 1. > Added the pattern in altivec.md to recognize a vector left shift by a constant > value, and generate add instructions if constant is 1. > Changelog should be preceded by date, author name and author email id. Do note that there should be a gap of 2 spaces between date and name, and between name and email id. > PR target/119702 > gcc: > * config/rs6000/altivec.md: Added a define_insn to recognize left shift > by constant 1 for vector instructions. > * config/rs6000/predicates.md(shift_constant_1): Added a predicate for Please change the variable name shift_constant_1. 'shift' can be removed as this predicate is to check for a vector of 1's and is not related to the shift operation. > detecting if all values in a const_vector are 1. > gcc/testsuite: > * gcc.target/powerpc/pr119702-1.c: New test for (check generation of > vadd for different integer types) > > Changes made in v3: Incorporated review comments made for patch v2 The "changes" info should come at the beginning of the mail. > 1. Indentation fixes in the commit message > 2. define_insn has the name *altivec_vsl<VI_char>_const_1 > 3. Iterate starting from 0 for checking vector constant = 1 and fixed > source code formatting for the for loop. > 4. Removed unused macro in pr119702-1.c test file > > --- > diff --git a/gcc/testsuite/gcc.target/powerpc/pr119702-1.c > b/gcc/testsuite/gcc.target/powerpc/pr119702-1.c > new file mode 100644 > index 00000000000..2f23ae20084 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr119702-1.c > @@ -0,0 +1,53 @@ > +/* { dg-do compile } */ > +/* { dg-options "-mdejagnu-cpu=power8 -O2" } */ > + > +#include <inttypes.h> > + > +void lshift1_64(uint64_t *a) { > + a[0] <<= 1; > + a[1] <<= 1; > +} Version 1 of this patch had more tests, can you please add them too (in a separate file)? Regards, Surya