https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122793

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #13)
> (In reply to Richard Biener from comment #12)
> > I'm testing the patch, it looks reasonable.  I'll note the initial support
> > was for very limited cases of lowpart or concat but as written the checks
> > would cover more cases, so it's somewhat a bad design.
> 
> The patch causes
> 
> +FAIL: gcc.dg/vect/bb-slp-pr101668.c -flto -ffat-lto-objects execution test
> +FAIL: gcc.dg/vect/bb-slp-pr101668.c execution test
> +FAIL: gcc.dg/vect/slp-28.c -flto -ffat-lto-objects execution test
> +FAIL: gcc.dg/vect/slp-28.c execution test
> +FAIL: gcc.dg/vect/slp-45.c execution test
> 
> (and a few more), will investigate another day.

OK, so this miscompiles

void __attribute__((noipa)) test_hi (v4si *dst, v8si src)
{
  (*dst)[0] = src[4];
  (*dst)[1] = src[5];
  (*dst)[2] = src[6];
  (*dst)[3] = src[7];
}

because for highpart/lowpart extraction we pass first_def == second_def
but the can_div_trunc computes to use the seconmd_def and thinks the offset
is accounted for - it divides 4 (the offset) by 4 (nunits of the result).
In this case it should divide by 8 (nunits of first_def) I think.

Adjusting accordingly and re-testing.

Reply via email to