http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50315
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-09-07 14:40:07 UTC --- On Wed, 7 Sep 2011, sergos.gnu at gmail dot com wrote: > Will it be a good idea to have a twos-complement architecture hook? In case of All architectures supported by GCC are twos-complement. > x86 we can reassociate since the architecture itself always behave as > twos-complement. So introducing such a flag can help with this particular > reassociation and another one that Ilya Enkovich implemented recently. The ability to reassociate does not depend on architecture features. C is a high-level language whose defined semantics are that signed integer overflow is undefined, independent of any target architecture. GENERIC and GIMPLE are internal representations in GCC that follow the same semantics for signed integer overflow as C does, independent of target architecture. RTL is an internal representation in GCC where signedness is a property of operations rather than operands and overflow generally has modulo semantics (division by 0, signed division and modulo of INT_MAX by -1 are still undefined on RTL). So you can reassociate on RTL but not GENERIC and GIMPLE.