Hello Richard:
On 14/02/24 10:45 pm, Richard Sandiford wrote: > Ajit Agarwal <aagar...@linux.ibm.com> writes: >>>> diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc >>>> index 1856fa4884f..ffc47a6eaa0 100644 >>>> --- a/gcc/emit-rtl.cc >>>> +++ b/gcc/emit-rtl.cc >>>> @@ -921,7 +921,7 @@ validate_subreg (machine_mode omode, machine_mode >>>> imode, >>>> return false; >>>> >>>> /* The subreg offset cannot be outside the inner object. */ >>>> - if (maybe_ge (offset, isize)) >>>> + if (maybe_gt (offset, isize)) >>>> return false; >>> >>> Can you explain why this change is needed? >>> >> >> This is required in rs6000 target where we generate the subreg >> with offset 16 from OO mode (256 bit) to 128 bit vector modes. >> Otherwise it segfaults. > > Could you go into more detail? Why does that subreg lead to a segfault? > > In itself, a 16-byte subreg at byte offset 16 into a 32-byte pair is pretty > standard. AArch64 uses this too for its vector load/store pairs (and for > structure pairs more generally). > If we want to create subreg V16QI (reg OO R) 16) imode is V16QI (isize = 16) and offset is 16. maybe_ge (offset, isize) return true and validate_subreg returns false; Hence above subreg is not generated and we generate incorrect code. Thats why I have modified to maybe_gt (offset, isize). Thanks & Regards Ajit > Thanks, > Richard