This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Gimple folding of splat_uX
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: will_schmidt at vnet dot ibm dot com, GCC Patches <gcc-patches at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Thu, 7 Dec 2017 12:26:16 +0100
- Subject: Re: [PATCH, rs6000] Gimple folding of splat_uX
- Authentication-results: sourceware.org; auth=none
- References: <1512578218.11602.59.camel@brimstone.rchland.ibm.com> <CAFiYyc2O7UNVh=BR3F19r7dK9KZNrCxH44=wXr3EZzBFdKuRfA@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 07, 2017 at 12:21:03PM +0100, Richard Biener wrote:
> > + if ( TREE_CODE (arg0) != INTEGER_CST)
Also watch formatting, the space after ( doesn't belong there.
> > + return false;
>
> Is there a reason to not do this for non-constants? (even not for
> float constants?)
> You should probably double-check there is a LHS, folding runs before DCE.
>
> > + tree splat_value = build_int_cst (TREE_TYPE (TREE_TYPE (lhs)),
> > + TREE_INT_CST_LOW (arg0));
tree splat_value = fold_convert (TREE_TYPE (TREE_TYPE (lhs)), arg0);
?
TREE_INT_CST_LOW should not be used unless necessary, e.g. it can throw
the upper bits of large constants, even if the type is wide.
Jakub