Hi! On Wed, Apr 15, 2020 at 09:37:32PM -0400, Michael Meissner wrote: > Fix regression caused by PR target/93932 backport. > > When I back ported the fix for PR target/93932 to the GCC 9 branch, I put in > an > unintended regression when the GCC compiler is optimizing the vec_extract > built-in function, and the vector element is in memory, and the index is > variable. This patch masks the vector index so that it does not go out of > bounds. > > 2020-04-15 Michael Meissner <meiss...@linux.ibm.com> > > PR target/94557 > * config/rs6000/rs6000.c (rs6000_adjust_vec_address): Fix > regression caused by PR target/93932 backport. Mask variable > vector extract index so it does not go beyond the vector when > extracting a vector element from memory.
Much better, thanks! > --- /tmp/4XFFqK_rs6000.c 2020-04-13 15:28:33.514011024 -0500 > +++ gcc/config/rs6000/rs6000.c 2020-04-13 14:24:01.296932921 -0500 > @@ -7047,18 +7047,25 @@ rs6000_adjust_vec_address (rtx scalar_re > element_offset = GEN_INT (INTVAL (element) * scalar_size); > else > { > + /* Mask the element to make sure the element number is between 0 and > the > + maximum number of elements - 1 so that we don't generate an address > + outside the vector. */ Hrm, so why do you need to do this here? It is part of the semantics of vec_extract, so shouldn't the RTL already have this masking somewhere when we get here? Nevertheless, the patch is okay for 9, it certainly won't hurt. Thanks! Segher