This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug target/43129] Simplify global variable's address loading with option -fpic
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- To: "stephen.clarke at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 14 Oct 2010 17:39:02 +0100
- Subject: Re: [Bug target/43129] Simplify global variable's address loading with option -fpic
- References: <bug-43129-4@http.gcc.gnu.org/bugzilla/> <201010141633.o9EGXcYL022132@rly04e.srv.mailcontrol.com>
- Reply-to: ramana dot radhakrishnan at arm dot com
On Thu, 2010-10-14 at 16:33 +0000, stephen.clarke at st dot com wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43129
>
> Stephen Clarke <stephen.clarke at st dot com> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |stephen.clarke at st dot
> | |com
>
> --- Comment #8 from Stephen Clarke <stephen.clarke at st dot com> 2010-10-14 16:32:56 UTC ---
> For arm instruction set, could you fold pc into the indexing
> to save an instruction?
>
> foo:
> ldr r3, .L2 // C
> .LPIC0:
> ldr r3, [r3,pc] // C
You'll find that the ARM-ARM thinks that PC in any of the 3 locations in this instruction form is *unpredictable*. Thus this form of the instruction should not be used.
cheers
Ramana