This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix (neg (lt X 0)) optimization (PR rtl-optimization/33148)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]