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]

Re: PATCH: simplify ~x + 1 into -x



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>


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