@@ -1,3 +1,13 @@
+2011-05-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/47715
+ * config/i386/i386.md (PTR64): New.
+ (*tls_global_dynamic_64): Rename to ...
+ (*tls_global_dynamic_64_<mode>): This. Put PTR64 on operand 1.
+ (tls_global_dynamic_64): Rename to ...
+ (tls_global_dynamic_64_<mode>): This. Put PTR64 on operand 1.
+ * config/i386/i386.c (legitimize_tls_address): Updated.
+
2011-05-06 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (ix86_promote_function_mode): Handle NULL
@@ -12909,9 +12909,22 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
if (TARGET_64BIT)
{
rtx rax = gen_rtx_REG (Pmode, AX_REG), insns;
+ rtx (*tls_global_dynamic) (rtx, rtx, rtx);
+
+ switch (GET_MODE (x))
+ {
+ case SImode:
+ tls_global_dynamic = gen_tls_global_dynamic_64_si;
+ break;
+ case DImode:
+ tls_global_dynamic = gen_tls_global_dynamic_64_di;
+ break;
+ default:
+ gcc_unreachable ();
+ }
start_sequence ();
- emit_call_insn (gen_tls_global_dynamic_64 (rax, x, caddr));
+ emit_call_insn (tls_global_dynamic (rax, x, caddr));
insns = get_insns ();
end_sequence ();
@@ -967,7 +967,9 @@
;; ptr_mode sized quantities.
(define_mode_iterator PTR
[(SI "ptr_mode == SImode") (DI "ptr_mode == DImode")])
-
+
+;; Pointer modes in 64bit.
+(define_mode_iterator PTR64 [(SI "TARGET_X32") DI])
;; Scheduling descriptions
@@ -12603,11 +12605,11 @@
(clobber (match_scratch:SI 5 ""))
(clobber (reg:CC FLAGS_REG))])])
-(define_insn "*tls_global_dynamic_64"
+(define_insn "*tls_global_dynamic_64_<mode>"
[(set (match_operand:DI 0 "register_operand" "=a")
(call:DI (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
(match_operand:DI 3 "" "")))
- (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
+ (unspec:DI [(match_operand:PTR64 1 "tls_symbolic_operand" "")]
UNSPEC_TLS_GD)]
"TARGET_64BIT"
{
@@ -12620,12 +12622,12 @@
(set (attr "length")
(symbol_ref "TARGET_X32 ? 15 : 16"))])
-(define_expand "tls_global_dynamic_64"
+(define_expand "tls_global_dynamic_64_<mode>"
[(parallel [(set (match_operand:DI 0 "register_operand" "")
(call:DI
(mem:QI (match_operand:DI 2 "call_insn_operand" ""))
(const_int 0)))
- (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
+ (unspec:DI [(match_operand:PTR64 1 "tls_symbolic_operand" "")]
UNSPEC_TLS_GD)])])
(define_insn "*tls_local_dynamic_base_32_gnu"