This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix (neg (lt X 0)) optimization (PR rtl-optimization/33148)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Aug 2007 13:59:22 +0200
- Subject: Re: [PATCH] Fix (neg (lt X 0)) optimization (PR rtl-optimization/33148)
- References: <20070827112244.GO2063@devserv.devel.redhat.com>
On 8/27/07, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> PR25600 change introduced an optimization of (neg (lt x 0)) to
> (ashirtrt x C), but it is not checking whether x's mode is suitable
> for it. As it checks that op1 is const0_rtx, I believe MODE_FLOAT
> or VECTOR_MODE_P modes are not a problem, CC modes can certainly appear
> in LT's first operand with second operand const0_rtx.
> So, when we optimize
> (neg:DI (lt:DI (reg:CC ...) (const_int 0)))
> we create something like
> (sign_extend:DI (ashirtrt:CC (reg:CC ...) (const_int 31)))
> which is IMHO invalid RTL, ashirtrt is documented on fixed point modes
> only (guess vector modes aren't listed just by omission) and so is
> sign_extend.
>
> Ok for 4.2/trunk?
This is ok.
Thanks,
Richard.
> 2007-08-27 Jakub Jelinek <jakub@redhat.com>
>
> PR rtl-optimization/33148
> * simplify-rtx.c (simplify_unary_operation_1): Only optimize
> (neg (lt X 0)) if X has scalar int mode.
>
> * gcc.c-torture/compile/20070827-1.c: New test.