This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help for arm avr bfin cris frv h8300 m68k mcore mmix pdp11 rs6000 sh vax
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: Bernd Schmidt <bernds_cb1 at t-online dot de>, Paolo Bonzini <bonzini at gnu dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, richard dot earnshaw at arm dot com, hp at axis dot com, aldyh at redhat dot com, aoliva at redhat dot com, law at redhat dot com, nickc at redhat dot com, kazu at codesourcery dot com, ni1d at arrl dot net, kkojima at gcc dot gnu dot org, matt at 3am-software dot com
- Date: Fri, 13 Mar 2009 18:26:45 +0000 (UTC)
- Subject: Re: help for arm avr bfin cris frv h8300 m68k mcore mmix pdp11 rs6000 sh vax
- References: <f865508f0903130434i795ab1ck7c6d4e840951279@mail.gmail.com> <49BA5C4A.7030609@t-online.de> <84fc9c000903130716p74970b65sb071ad2ed090ee9d@mail.gmail.com> <Pine.LNX.4.64.0903131758420.3511@digraph.polyomino.org.uk> <84fc9c000903131118xfd9eddao75573e906418c9e@mail.gmail.com>
On Fri, 13 Mar 2009, Richard Guenther wrote:
> Last time I sent a patch to remove the SHIFT_COUNT_TRUNCATED check
> from fold-const.c the reason that this was rejected was that we want to
> be consistend with target behavior...
I would disagree with such a rejection. If we want to provide any sort of
consistency I think it should be optional (an option like -fwrapv) and
define the semantics at the language level rather than depending on the
target.
> > As I understand it, SHIFT_COUNT_TRUNCATED is about the semantics of RTL,
> > and has no bearing on the implemented semantics of any source language or
> > of GENERIC or GIMPLE; GENERIC and GIMPLE both follow the rule that
> > out-of-range shifts (or rotates?), including those by negative amounts,
> > are undefined.
>
> "Undefined" is a bad semantic for GIMPLE. If the frontends want the middle-end
> to take advantage of undefinedness it needs to translate it to a useful defined
> state.
By undefined I mean that the middle-end may assume that the value is
within range [0, number of value and sign bits in type) and transform on
the basis of that assumption (including value range propagation).
--
Joseph S. Myers
joseph@codesourcery.com