This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: simplify ~x + 1 into -x
- To: Lars Brinkhoff <lars at nocrew dot org>
- Subject: Re: PATCH: simplify ~x + 1 into -x
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 23 Apr 2001 07:43:02 -0700
- CC: gcc-patches at gcc dot gnu dot org
- References: <85ae58hvw1.fsf@junk.nocrew.org>
Lars Brinkhoff <lars@nocrew.org> writes:
> This patch simlifies ~x + 1 into -x on two's complement machines
> (probably all machines supported by GCC). It also adds a new target
> macro to indicate the integer format, in case anyone would like to
> port GCC to a machine without two's complement integers.
>
> Bootstrapped on powerpc-unknown-linux-gnu and checked without
> regressions.
The TARGET_INT_FORMAT part is not OK, because there are lots of other
places where GCC assumes two's-complement, and so it just adds clutter
without adding any new features. (It would be different if you
actually planned to port GCC to a non-twos-complement machine.)
The optimisation part might be OK, please submit it separately.
> 2001-04-23 Lars Brinkhoff <lars@nocrew.org>
>
> * defaults.h (TARGET_INT_FORMAT): New macro.
> * expr.h (enum int_format): New enum.
> * tm.texi (TARGET_INT_FORMAT): Document.
> * simplify-rtx.c (simplify_binary_operation): Simplify
> ~a + 1 into -a on two's complement machines.
--
- Geoffrey Keating <geoffk@geoffk.org>