This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix X | ~X and X ^ ~X optimizations for vectors (PR middle-end/32912)
On 8/20/07, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Aug 20, 2007 at 03:19:36PM +0200, Richard Guenther wrote:
> > Hm, for the similar problem with ones we introduced build_one_cst (which
> > avoids the check for VECTOR_TYPE all over the place). So can you instead
> > create a new build_all_ones_cst () function for this? I don't have a
> > very strong
> > opinion about this though. Another alternative would be a build_zero_cst which
> > we could convert to all ones via constant folding and a unary not...
>
> I have done the latter (though I had to add support for folding
> BIT_NOT_EXPR of VECTOR_CST in fold_unary, which is IMHO a good thing
> anyway).
> If these are the only places which would use build_all_ones_cst, introducing
> that would be IMHO unnecessary, but I don't have strong opinion about it
> either.
This one is ok for mainline and 4.2 (if you prefer).
Thanks,
Richard.
> 2007-08-20 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/32912
> * fold-const.c (fold_unary): Optimize BIT_NOT_EXPR of VECTOR_CST.
> (fold_binary): Handle vectors in X | ~X and X ^ ~X optimizations.
>
> * gcc.dg/pr32912-1.c: New test.
> * gcc.dg/pr32912-2.c: New test.
> * gcc.dg/pr32912-3.c: New test.