[Bug middle-end/89765] [9 Regression] Multiple problems with vec-insert implementation on PowerPC

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 25 14:54:00 GMT 2019


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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, the C notation

typedef unsigned __int128 V __attribute__((vector_size (sizeof (__int128))));

V
foo (unsigned __int128 x, V y, int z)
{
  y[0] = x;
}

on x86_64 prouces

{
  VIEW_CONVERT_EXPR<__int128 unsigned[1]>(y)[0] = x;
}

the array-ref prevents the gimplification into SSA.  That also works
for variable indices btw.  It is eventually turns into

  BIT_FIELD_REF <y, 128, 0> = x_2(D);

by gimplification first and then

  y_5 = BIT_INSERT_EXPR <y_4(D), x_2(D), 0 (128 bits)>;

by update-address-taken.  Not sure why the folding doesn't trigger here
but does for ppc64.  The BIT_FIELD_REF is produced by
maybe_canonicalize_mem_ref_addr which uses build3 instead of fold_build3
to build the BIT_FIELD_REF (probably not expecting simplification or
avoding constant folding on the LHS).  Indeed using fold_build3 there
gets us

  VIEW_CONVERT_EXPR<__int128 unsigned>(y) = x;


More information about the Gcc-bugs mailing list