This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix A < 0 ? <sign bit of A> : 0 optimization (PR middle-end/29695)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 3 Nov 2006 18:22:49 -0700 (MST)
- Subject: Re: [PATCH] Fix A < 0 ? <sign bit of A> : 0 optimization (PR middle-end/29695)
On Fri, 3 Nov 2006, Jakub Jelinek wrote:
> 2006-11-03 Jakub Jelinek <email@example.com>
> PR middle-end/29695
> * fold-const.c (fold_ternary): Fix A < 0 ? <sign bit of A> : 0
> * gcc.c-torture/execute/pr29695-1.c: New test.
> * gcc.c-torture/execute/pr29695-2.c: New test.
This is OK for mainline, and affected branches. Thanks.
I do appreciate the extra effort you've gone to, identifing and
implementing the situations where this transformation is valid based
upon sign or zero extension. A lesser fix would have been to simply
limit this transformation to the case where A and <sign bit of A>
have the same size/type. Thanks again for going the extra mile,
and generalizing this optimization.