PowerPC PIC code addressibility tweak

Segher Boessenkool segher@koffie.nl
Thu Oct 31 18:30:00 GMT 2002


David Edelsohn wrote:
> 
>         The PowerPC architecture recommends a preferred form for a
> branch-and-link instruction that will not return, but used to obtain
> addressibility for PIC code.  This form does not corrupt the link register
> history stack.

	What document did you take this from?  I could only find this in the
Book E and in the 7450 UM, but both specifically say this is special
cased only for

	bcl	20,31,$+4

so your second patch won't help (as it uses $+8 instead).


Segher


> Darwin already uses this form.  This patch converts SVR4
> PIC code to use this form as well, as pointed out by Tege.
> 
> David
> 
>         * config/rs6000/rs6000.md (load_toc_v4_PIC_1): Use preferred form
>         for addressibility.
>         (load_toc_v4_PIC_1b): Same.
> 
> Index: rs6000.md
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
> retrieving revision 1.218
> diff -c -p -r1.218 rs6000.md
> *** rs6000.md   19 Oct 2002 04:36:30 -0000      1.218
> --- rs6000.md   30 Oct 2002 15:52:10 -0000
> ***************
> *** 10272,10278 ****
>         (match_operand:SI 1 "immediate_operand" "s"))
>      (unspec [(match_dup 1)] 7)]
>     "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
> !   "bl %1\\n%1:"
>     [(set_attr "type" "branch")
>      (set_attr "length" "4")])
> 
> --- 10272,10278 ----
>         (match_operand:SI 1 "immediate_operand" "s"))
>      (unspec [(match_dup 1)] 7)]
>     "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
> !   "bcl 20,31,%1\\n%1:"
>     [(set_attr "type" "branch")
>      (set_attr "length" "4")])
> 
> ***************
> *** 10281,10287 ****
>         (match_operand:SI 1 "immediate_operand" "s"))
>      (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
>     "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
> !   "bl %1\\n\\t.long %2-%1+4\\n%1:"
>     [(set_attr "type" "branch")
>      (set_attr "length" "8")])
> 
> --- 10281,10287 ----
>         (match_operand:SI 1 "immediate_operand" "s"))
>      (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
>     "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
> !   "bcl 20,31,%1\\n\\t.long %2-%1+4\\n%1:"
>     [(set_attr "type" "branch")
>      (set_attr "length" "8")])
>




More information about the Gcc-patches mailing list