This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Auto-set ARM -mimplicit-it option
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Andrew Stubbs <ams at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Jul 2010 14:11:06 +0100
- Subject: Re: [patch] Auto-set ARM -mimplicit-it option
- References: <4C402E89.firstname.lastname@example.org> <email@example.com> <4C4058C7.firstname.lastname@example.org>
On Fri, 2010-07-16 at 14:04 +0100, Andrew Stubbs wrote:
> On 16/07/10 13:46, Richard Earnshaw wrote:
> > Are you sure? The gas docs say:
> > The -mimplicit-it option controls the behavior of the assembler
> > when conditional instructions are not enclosed in IT blocks.
> > There are four possible behaviors. If never is specified, such
> > constructs cause a warning in ARM code and an error in Thumb-2
> > code. If always is specified, such constructs are accepted in
> > both ARM and Thumb-2 code, where the IT instruction is added
> > implicitly. If arm is specified, such constructs are accepted in
> > ARM code and cause an error in Thumb-2 code. If thumb is
> > specified, such constructs cause a warning in ARM code and are
> > accepted in Thumb-2 code. If you omit this option, the behavior
> > is equivalent to -mimplicit-it=arm.
> Right, "never" and "always" mods are irrelevant here - I'm not proposing
> that the compiler ever pass either automatically.
> So, the choice is between -mimplicit-it=arm (the gas default) or
> -mimplicit-it=thumb. I'm proposing the latter, but only in the case that
> the compiler is running in thumb mode.
> > Based on this, I think:
> > If arm is specified, such constructs [ie. implicit insertion of
> > IT instructions] are accepted in ARM code and cause an error in
> > Thumb-2 code.
> > Is the behaviour that we *do* want. Ie, accept implicit IT blocks in
> > ARM code, but cause an error if they're implicit in Thumb code. The
> > compiler should never generate conditional Thumb-2 instructions without
> > emitting an IT instruction first.
> The problem is not generated code. I believe the problem is inline
> > I must admit that the docs are not particularly clearly written, but
> > based on what I think they say, I think the default is the correct
> > choice for the compiler.
> The default is the right choice in ARM mode, but the complaint is that
> in thumb mode you suddenly need to be explicit.
> I'm not sure exactly where this issue comes from, but ARM Ubuntu (which
> is almost exclusively thumb, I think) has had a patch like this for some
> time, and found it solves some problems.
> Whatever, it seems to me quite reasonable that if the assembler has
> smarts in one mode, then probably it should do in the other, but then, I
> don't claim to be an ARM expert.
I think implicit generation of instructions in compiler generated code
is just wrong, even in inline assembler. If the assembler can't work
out how much code an assembler block will generate (which it can only do
by counting statements in the block) then it can't do literal pool
placement accurately; in some cases it might even get it wrong and put a
literal pool out of range.
Inline assembly code needs to be fixed. Papering over this problem
isn't going to help get that done.