On Wed, May 7, 2025 at 11:29 AM Richard Sandiford <richard.sandif...@arm.com> wrote: > > Konstantinos Eleftheriou <konstantinos.elefther...@vrull.eu> writes: > > Hi Richard, > > > > Thanks for the feedback! We have sent a new version that uses > > lowpart_subreg > > (https://gcc.gnu.org/pipermail/gcc-patches/2025-May/682835.html). > > We had tried that before, but we were mishandling the case where there > > are multiple stores with the same offset as the load. > > Thanks, I'll have a look. > > > As for `it->offset`, that's actually the offset difference between the > > store and the load (we're trying to find the store with the same > > offset as the load), so the endianness should be irrelevant in that > > case. > > But I thought the code was allowing multiple stores to be forwarded to > a single (wider) load. E.g. 4 individual byte stores at address X, X+1, > X+2 and X+3 could be forwarded to a 4-byte load at address X. And the code > I mentioned is handling the least significant byte by zero-extending it. > > For big-endian targets, the least significant byte should come from > address X+3 rather than address X. The byte at address X (i.e. the > byte with the equal offset) should instead go in the most significant > byte, typically using a shift left.
You are right about that. We will submit a fix for this in a separate patch. Thanks, Konstantinos