This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Call gen_tls_global_dynamic_64_<mode> and en_tls_local_dynamic_base_64_<mode>


On Mon, Mar 12, 2012 at 9:50 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Mar 12, 2012 at 12:46 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> On Mon, Mar 12, 2012 at 12:26 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>
>>> Pmode may be DImode for x32. ?This patch calls
>>> gen_tls_global_dynamic_64_<mode> and gen_tls_local_dynamic_base_64_<mode>,
>>> depending on Pmode. ?Tested on Linux/x86-64. ?OK for trunk?
>>>
>>> 2012-03-11 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>>
>>> ? ? ? ?* config/i386/i386.c (legitimize_tls_address): Call
>>> ? ? ? ?gen_tls_global_dynamic_64_<mode> and
>>> ? ? ? ?gen_tls_local_dynamic_base_64_<mode>, depending on Pmode.
>>>
>>> ? ? ? ?* config/i386/i386.md (*tls_global_dynamic_64): Renamed to ...
>>> ? ? ? ?(*tls_global_dynamic_64_<mode>): This.
>>> ? ? ? ?(tls_global_dynamic_64): Renamed to ...
>>> ? ? ? ?(tls_global_dynamic_64_<mode>): This.
>>> ? ? ? ?(*tls_local_dynamic_base_64): Renamed to ...
>>> ? ? ? ?(*tls_local_dynamic_base_64<mode>): This.
>>> ? ? ? ?(tls_local_dynamic_base_64): Renamed to ...
>>> ? ? ? ?(tls_local_dynamic_base_64<mode>): This.
>>>
>>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
>>> index d673101..fc8fa12 100644
>>> --- a/gcc/config/i386/i386.c
>>> +++ b/gcc/config/i386/i386.c
>>> @@ -12533,7 +12543,12 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
>>> ? ? ? ? ? ? ?rtx rax = gen_rtx_REG (Pmode, AX_REG), insns;
>>>
>>> ? ? ? ? ? ? ?start_sequence ();
>>> - ? ? ? ? ? ? emit_call_insn (gen_tls_global_dynamic_64 (rax, x, caddr));
>>> + ? ? ? ? ? ? if (Pmode == DImode)
>>> + ? ? ? ? ? ? ? emit_call_insn (gen_tls_global_dynamic_64_di (rax, x,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? caddr));
>>> + ? ? ? ? ? ? else
>>> + ? ? ? ? ? ? ? emit_call_insn (gen_tls_global_dynamic_64_si (rax, x,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? caddr));
>>> ? ? ? ? ? ? ?insns = get_insns ();
>>> ? ? ? ? ? ? ?end_sequence ();
>>>
>>> @@ -12581,7 +12596,12 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
>>> ? ? ? ? ? ? ?rtx rax = gen_rtx_REG (Pmode, AX_REG), insns, eqv;
>>>
>>> ? ? ? ? ? ? ?start_sequence ();
>>> - ? ? ? ? ? ? emit_call_insn (gen_tls_local_dynamic_base_64 (rax, caddr));
>>> + ? ? ? ? ? ? if (Pmode == DImode)
>>> + ? ? ? ? ? ? ? emit_call_insn (gen_tls_local_dynamic_base_64_di (rax,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? caddr));
>>> + ? ? ? ? ? ? else
>>> + ? ? ? ? ? ? ? emit_call_insn (gen_tls_local_dynamic_base_64_si (rax,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? caddr));
>>> ? ? ? ? ? ? ?insns = get_insns ();
>>> ? ? ? ? ? ? ?end_sequence ();
>>
>> Please use indirect functions here, see many examples in the code.
>>
>> OK with this change.
>>
>> Thanks,
>> Uros.
>
> This is the patch I checked in.
>
> Thanks.
>
>
> --
> H.J.
> ---
> 2012-03-12 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?* config/i386/i386.c (ix86_gen_tls_global_dynamic_64): New.
> ? ? ? ?(ix86_gen_tls_local_dynamic_base_64): Likewise.
> ? ? ? ?(ix86_option_override_internal): Set ix86_gen_tls_global_dynamic_64
> ? ? ? ?and ix86_gen_tls_local_dynamic_base_64.
> ? ? ? ?(legitimize_tls_address): Use ix86_gen_tls_global_dynamic_64 and
> ? ? ? ?ix86_gen_tls_local_dynamic_base_64.
>
> ? ? ? ?* config/i386/i386.md (*tls_global_dynamic_64): Renamed to ...
> ? ? ? ?(*tls_global_dynamic_64_<mode>): This.
> ? ? ? ?(tls_global_dynamic_64): Renamed to ...
> ? ? ? ?(tls_global_dynamic_64_<mode>): This.
> ? ? ? ?(*tls_local_dynamic_base_64): Renamed to ...
> ? ? ? ?(*tls_local_dynamic_base_64_<mode>): This.
> ? ? ? ?(tls_local_dynamic_base_64): Renamed to ...
> ? ? ? ?(tls_local_dynamic_base_64_<mode>): This.

This patch caused x32 libgcc build failure:

../../../../src-trunk/libgcc/generic-morestack-thread.c: In function
'stack_split_initialize_thread':
../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1: error:
unrecognizable insn:
(call_insn/u 8 7 9 3 (parallel [
            (set (reg:DI 0 ax)
                (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0 S1 A8])
                    (const_int 0 [0])))
            (unspec:DI [
                    (symbol_ref:SI ("__morestack_segments") [flags
0x50] <var_decl 0x7ffff7725780 __morestack_segments>)
                ] UNSPEC_TLS_GD)
        ]) ../../../../src-trunk/libgcc/generic-morestack-thread.c:117 -1
     (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000])
        (nil))
    (nil))
../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1:
internal compiler error: in extract_insn, at recog.c:2123
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[8]: *** [generic-morestack-thread.o] Error 1
make[8]: *** Waiting for unfinished jobs....

__morestack_segments is always in SImode for x32.  Adding
:P to

 (unspec:P [(match_operand 1 "tls_symbolic_operand" "")]

causes it to fail when Pmode == DImode  I checked in this patch
to revert the part of that change.

Sorry for that.


-- 
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 185259)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2012-03-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/i386/i386.md (*tls_global_dynamic_64_<mode>): Remove :P
+	on tls_symbolic_operand.
+	(tls_global_dynamic_64_<mode>): Likewise.
+
 2012-03-12  Georg-Johann Lay  <avr@gjlay.de>

 	PR other/52545
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 185259)
+++ config/i386/i386.md	(working copy)
@@ -12628,7 +12628,7 @@
 	(call:P
 	 (mem:QI (match_operand:P 2 "constant_call_address_operand" "z"))
 	 (match_operand:P 3 "" "")))
-   (unspec:P [(match_operand:P 1 "tls_symbolic_operand" "")]
+   (unspec:P [(match_operand 1 "tls_symbolic_operand" "")]
 	     UNSPEC_TLS_GD)]
   "TARGET_64BIT"
 {
@@ -12652,7 +12652,7 @@
 	  (call:P
 	   (mem:QI (match_operand:P 2 "constant_call_address_operand" ""))
 	   (const_int 0)))
-     (unspec:P [(match_operand:P 1 "tls_symbolic_operand" "")]
+     (unspec:P [(match_operand 1 "tls_symbolic_operand" "")]
 	       UNSPEC_TLS_GD)])]
   "TARGET_64BIT")


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]