This is target-dependant part of a two patch series.
Scheduler is free to move stack adjustment throughs
tls_global_dynamic_64 and tls_local_dynamic_base_64 patterns,
misaligning the stack for embedded call to __tls_get_addr.
The patch makes these patterns dependent on SP_REG.
Patch was bootstrapped and regression tested on x86_64-linux-gnu
{,-m32} for all default languages, obj-c++ and go.
Patch will be committed to mainline after patch 1/2 from the series.
Uros.
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 225727)
+++ config/i386/i386.md (working copy)
@@ -13158,7 +13158,8 @@
(call:P
(mem:QI (match_operand 2 "constant_call_address_operand" "Bz"))
(match_operand 3)))
- (unspec:P [(match_operand 1 "tls_symbolic_operand")]
+ (unspec:P [(match_operand 1 "tls_symbolic_operand")
+ (reg:P SP_REG)]
UNSPEC_TLS_GD)]
"TARGET_64BIT"
{
@@ -13182,8 +13183,9 @@
(mem:QI (plus:DI (match_operand:DI 2 "register_operand" "b")
(match_operand:DI 3 "immediate_operand" "i")))
(match_operand 4)))
- (unspec:DI [(match_operand 1 "tls_symbolic_operand")]
- UNSPEC_TLS_GD)]
+ (unspec:DI [(match_operand 1 "tls_symbolic_operand")
+ (reg:DI SP_REG)]
+ UNSPEC_TLS_GD)]
"TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
&& GET_CODE (operands[3]) == CONST
&& GET_CODE (XEXP (operands[3], 0)) == UNSPEC
@@ -13204,7 +13206,8 @@
(call:P
(mem:QI (match_operand 2))
(const_int 0)))
- (unspec:P [(match_operand 1 "tls_symbolic_operand")]
+ (unspec:P [(match_operand 1 "tls_symbolic_operand")
+ (reg:P SP_REG)]
UNSPEC_TLS_GD)])]
"TARGET_64BIT"
"ix86_tls_descriptor_calls_expanded_in_cfun = true;")
@@ -13254,7 +13257,7 @@
(call:P
(mem:QI (match_operand 1 "constant_call_address_operand" "Bz"))
(match_operand 2)))
- (unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)]
+ (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)]
"TARGET_64BIT"
{
output_asm_insn
@@ -13272,7 +13275,7 @@
(mem:QI (plus:DI (match_operand:DI 1 "register_operand" "b")
(match_operand:DI 2 "immediate_operand" "i")))
(match_operand 3)))
- (unspec:DI [(const_int 0)] UNSPEC_TLS_LD_BASE)]
+ (unspec:DI [(reg:DI SP_REG)] UNSPEC_TLS_LD_BASE)]
"TARGET_64BIT && ix86_cmodel == CM_LARGE_PIC && !TARGET_PECOFF
&& GET_CODE (operands[2]) == CONST
&& GET_CODE (XEXP (operands[2], 0)) == UNSPEC
@@ -13293,7 +13296,7 @@
(call:P
(mem:QI (match_operand 1))
(const_int 0)))
- (unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])]
+ (unspec:P [(reg:P SP_REG)] UNSPEC_TLS_LD_BASE)])]
"TARGET_64BIT"
"ix86_tls_descriptor_calls_expanded_in_cfun = true;")