diff options
author | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 03:11:34 +0000 |
---|---|---|
committer | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 03:11:34 +0000 |
commit | d46ea8788345afc238324a5129b615ac5193d84c (patch) | |
tree | e40cb055451edf78dd0f574e269ceae291ee73bf | |
parent | e32f6d2b6b3ff674b19ed18c244ca3db3784e2e5 (diff) | |
download | gcc-d46ea8788345afc238324a5129b615ac5193d84c.tar.gz |
* doc/invoke.texi (RS/6000 and PowerPC Options):Document mtls-markers.
* configure.ac (HAVE_AS_TLS_MARKERS): New gas feature check.
* configure: Regenerate.
* config.in: Regenerate.
* config/rs6000/rs6000.opt (mtls-markers): Add.
* config/rs6000/rs6000.h (TARGET_TLS_MARKERS): Define.
* config/rs6000/rs6000.md (tls_gd_aix, tls_gd_sysv): Add splitter.
(tls_ld_aix, tls_ld_sysv): Likewise.
(tls_gd, tls_gd_call_aix, tls_gd_call_sysv): New insns.
(tls_ld, tls_ld_call_aix, tls_ld_call_sysv): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145330 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/config.in | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 9 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 129 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.opt | 4 | ||||
-rwxr-xr-x | gcc/configure | 37 | ||||
-rw-r--r-- | gcc/configure.ac | 6 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 10 |
8 files changed, 210 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad93ab2ba92..3cad793ab19 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,18 @@ 2009-03-31 Alan Modra <amodra@bigpond.net.au> + * doc/invoke.texi (RS/6000 and PowerPC Options):Document mtls-markers. + * configure.ac (HAVE_AS_TLS_MARKERS): New gas feature check. + * configure: Regenerate. + * config.in: Regenerate. + * config/rs6000/rs6000.opt (mtls-markers): Add. + * config/rs6000/rs6000.h (TARGET_TLS_MARKERS): Define. + * config/rs6000/rs6000.md (tls_gd_aix, tls_gd_sysv): Add splitter. + (tls_ld_aix, tls_ld_sysv): Likewise. + (tls_gd, tls_gd_call_aix, tls_gd_call_sysv): New insns. + (tls_ld, tls_ld_call_aix, tls_ld_call_sysv): Likewise. + +2009-03-31 Alan Modra <amodra@bigpond.net.au> + * config/spu/spu.c (spu_expand_prologue): Delete redundant code. 2009-03-30 Jan Hubicka <jh@suse.cz> diff --git a/gcc/config.in b/gcc/config.in index 7c34eed3282..ecc85b040fe 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -371,6 +371,12 @@ #endif +/* Define if your assembler supports arg info for __tls_get_addr. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_TLS_MARKERS +#endif + + /* Define if your assembler supports VSX instructions. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_VSX diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 3109e958cd6..8a6fe684695 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -240,6 +240,15 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define TARGET_DFP 0 #endif +/* Define TARGET_TLS_MARKERS if the target assembler does not support + arg markers for __tls_get_addr calls. */ +#ifndef HAVE_AS_TLS_MARKERS +#undef TARGET_TLS_MARKERS +#define TARGET_TLS_MARKERS 0 +#else +#define TARGET_TLS_MARKERS tls_markers +#endif + #ifndef TARGET_SECURE_PLT #define TARGET_SECURE_PLT 0 #endif diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index e7daff15bab..88322fd66dc 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10412,7 +10412,7 @@ (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")]) (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")]) -(define_insn "tls_gd_aix<TLSmode:tls_abi_suffix>" +(define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>" [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s")) (match_operand 4 "" "g"))) @@ -10422,10 +10422,21 @@ (clobber (reg:SI LR_REGNO))] "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX" "addi %0,%1,%2@got@tlsgd\;bl %z3\;%." + "&& TARGET_TLS_MARKERS" + [(set (match_dup 0) + (unspec:TLSmode [(match_dup 1) + (match_dup 2)] + UNSPEC_TLSGD)) + (parallel [(set (match_dup 0) + (call (mem:TLSmode (match_dup 3)) + (match_dup 4))) + (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD) + (clobber (reg:SI LR_REGNO))])] + "" [(set_attr "type" "two") (set_attr "length" "12")]) -(define_insn "tls_gd_sysv<TLSmode:tls_sysv_suffix>" +(define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>" [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s")) (match_operand 4 "" "g"))) @@ -10445,10 +10456,62 @@ else return "addi %0,%1,%2@got@tlsgd\;bl %z3"; } + "&& TARGET_TLS_MARKERS" + [(set (match_dup 0) + (unspec:TLSmode [(match_dup 1) + (match_dup 2)] + UNSPEC_TLSGD)) + (parallel [(set (match_dup 0) + (call (mem:TLSmode (match_dup 3)) + (match_dup 4))) + (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD) + (clobber (reg:SI LR_REGNO))])] + "" [(set_attr "type" "two") (set_attr "length" "8")]) -(define_insn "tls_ld_aix<TLSmode:tls_abi_suffix>" +(define_insn "*tls_gd<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b") + (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")] + UNSPEC_TLSGD))] + "HAVE_AS_TLS && TARGET_TLS_MARKERS" + "addi %0,%1,%2@got@tlsgd" + [(set_attr "length" "4")]) + +(define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s")) + (match_operand 2 "" "g"))) + (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")] + UNSPEC_TLSGD) + (clobber (reg:SI LR_REGNO))] + "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS" + "bl %z1(%3@tlsgd)\;%." + [(set_attr "type" "branch") + (set_attr "length" "8")]) + +(define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s")) + (match_operand 2 "" "g"))) + (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")] + UNSPEC_TLSGD) + (clobber (reg:SI LR_REGNO))] + "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS" +{ + if (flag_pic) + { + if (TARGET_SECURE_PLT && flag_pic == 2) + return "bl %z1+32768(%3@tlsgd)@plt"; + return "bl %z1(%3@tlsgd)@plt"; + } + return "bl %z1(%3@tlsgd)"; +} + [(set_attr "type" "branch") + (set_attr "length" "4")]) + +(define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>" [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s")) (match_operand 3 "" "g"))) @@ -10457,9 +10520,19 @@ (clobber (reg:SI LR_REGNO))] "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX" "addi %0,%1,%&@got@tlsld\;bl %z2\;%." + "&& TARGET_TLS_MARKERS" + [(set (match_dup 0) + (unspec:TLSmode [(match_dup 1)] + UNSPEC_TLSLD)) + (parallel [(set (match_dup 0) + (call (mem:TLSmode (match_dup 2)) + (match_dup 3))) + (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD) + (clobber (reg:SI LR_REGNO))])] + "" [(set_attr "length" "12")]) -(define_insn "tls_ld_sysv<TLSmode:tls_sysv_suffix>" +(define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>" [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s")) (match_operand 3 "" "g"))) @@ -10478,8 +10551,56 @@ else return "addi %0,%1,%&@got@tlsld\;bl %z2"; } + "&& TARGET_TLS_MARKERS" + [(set (match_dup 0) + (unspec:TLSmode [(match_dup 1)] + UNSPEC_TLSLD)) + (parallel [(set (match_dup 0) + (call (mem:TLSmode (match_dup 2)) + (match_dup 3))) + (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD) + (clobber (reg:SI LR_REGNO))])] + "" [(set_attr "length" "8")]) +(define_insn "*tls_ld<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")] + UNSPEC_TLSLD))] + "HAVE_AS_TLS && TARGET_TLS_MARKERS" + "addi %0,%1,%&@got@tlsld" + [(set_attr "length" "4")]) + +(define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s")) + (match_operand 2 "" "g"))) + (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD) + (clobber (reg:SI LR_REGNO))] + "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS" + "bl %z1(%&@tlsld)\;%." + [(set_attr "type" "branch") + (set_attr "length" "8")]) + +(define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>" + [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b") + (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s")) + (match_operand 2 "" "g"))) + (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD) + (clobber (reg:SI LR_REGNO))] + "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS" +{ + if (flag_pic) + { + if (TARGET_SECURE_PLT && flag_pic == 2) + return "bl %z1+32768(%&@tlsld)@plt"; + return "bl %z1(%&@tlsld)@plt"; + } + return "bl %z1(%&@tlsld)"; +} + [(set_attr "type" "branch") + (set_attr "length" "4")]) + (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>" [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r") (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b") diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 8a623527891..3030c59b4d2 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -131,6 +131,10 @@ mfused-madd Target Report RejectNegative InverseMask(NO_FUSED_MADD, FUSED_MADD) Generate fused multiply/add instructions +mtls-markers +Target Report Var(tls_markers) Init(1) +Mark __tls_get_addr calls with argument info + msched-prolog Target Report Var(TARGET_SCHED_PROLOG) Init(1) Schedule the start and end of the procedure diff --git a/gcc/configure b/gcc/configure index e74fdf822ba..914919717ea 100755 --- a/gcc/configure +++ b/gcc/configure @@ -23329,6 +23329,43 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi + + echo "$as_me:$LINENO: checking assembler for tls marker support" >&5 +echo $ECHO_N "checking assembler for tls marker support... $ECHO_C" >&6 +if test "${gcc_cv_as_powerpc_tls_markers+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_as_powerpc_tls_markers=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 9 \* 1000 \) + 99 \) \* 1000 + 0` + then gcc_cv_as_powerpc_tls_markers=yes +fi + elif test x$gcc_cv_as != x; then + echo ' bl __tls_get_addr(x@tlsgd)' > conftest.s + if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + gcc_cv_as_powerpc_tls_markers=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +echo "$as_me:$LINENO: result: $gcc_cv_as_powerpc_tls_markers" >&5 +echo "${ECHO_T}$gcc_cv_as_powerpc_tls_markers" >&6 +if test $gcc_cv_as_powerpc_tls_markers = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_TLS_MARKERS 1 +_ACEOF + +fi ;; mips*-*-*) diff --git a/gcc/configure.ac b/gcc/configure.ac index 99605a147dc..6a6a7d3f326 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3128,6 +3128,12 @@ LCF0: [.gnu_attribute 4,1],, [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) + + gcc_GAS_CHECK_FEATURE([tls marker support], + gcc_cv_as_powerpc_tls_markers, [2,20,0],, + [ bl __tls_get_addr(x@tlsgd)],, + [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1, + [Define if your assembler supports arg info for __tls_get_addr.])]) ;; mips*-*-*) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index ebf14d2081a..980810451f5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -14407,6 +14407,16 @@ to use or discard it. In the future, we may cause GCC to ignore all longcall specifications when the linker is known to generate glue. +@item -mtls-markers +@itemx -mno-tls-markers +@opindex mtls-markers +@opindex mno-tls-markers +Mark (do not mark) calls to @code{__tls_get_addr} with a relocation +specifying the function argument. The relocation allows ld to +reliably associate function call with argument setup instructions for +TLS optimization, which in turn allows gcc to better schedule the +sequence. + @item -pthread @opindex pthread Adds support for multithreading with the @dfn{pthreads} library. |