+2019-10-24 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * config/s390/s390.c (s390_get_thread_pointer): Use
+ gen_get_thread_pointer.
+ (s390_expand_split_stack_prologue): Likewise.
+ * config/s390/s390.md (UNSPEC_GET_TP): New UNSPEC.
+ (*get_tp_31): New 31-bit splitter for UNSPEC_GET_TP.
+ (*get_tp_64): New 64-bit splitter for UNSPEC_GET_TP.
+ (get_thread_pointer<mode>): Use UNSPEC_GET_TP, use
+ parameterized name.
+
2019-10-24 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_analyze_slp): When reduction group
{
rtx tp = gen_reg_rtx (Pmode);
- emit_move_insn (tp, gen_rtx_REG (Pmode, TP_REGNUM));
+ emit_insn (gen_get_thread_pointer (Pmode, tp));
+
mark_reg_pointer (tp, BITS_PER_WORD);
return tp;
/* Get thread pointer. r1 is the only register we can always destroy - r0
could contain a static chain (and cannot be used to address memory
anyway), r2-r6 can contain parameters, and r6-r15 are callee-saved. */
- emit_move_insn (r1, gen_rtx_REG (Pmode, TP_REGNUM));
+ emit_insn (gen_get_thread_pointer (Pmode, r1));
/* Aim at __private_ss. */
guard = gen_rtx_MEM (Pmode, plus_constant (Pmode, r1, psso));
; TLS support
UNSPEC_TLSLDM_NTPOFF
UNSPEC_TLS_LOAD
+ UNSPEC_GET_TP
; String Functions
UNSPEC_SRST
*,*,yes")
])
-; Splitters for loading/storing TLS pointers from/to %a0:DI.
-; Do this only during split2, which runs after reload. At the point when split1
-; runs, some of %a0:DI occurrences might be nested inside other rtxes and thus
-; not matched. As a result, only some occurrences will be split, which will
-; prevent CSE. At the point when split2 runs, reload will have ensured that no
-; nested references exist.
+; Splitters for loading TLS pointer from UNSPEC_GET_TP.
+; UNSPEC_GET_TP is used instead of %a0:P, since the latter is a hard register,
+; and those are not handled by Partial Redundancy Elimination (gcse.c), which
+; results in generation of redundant thread pointer loads.
-(define_split
- [(set (match_operand:DI 0 "register_operand" "")
- (match_operand:DI 1 "register_operand" ""))]
- "TARGET_ZARCH && ACCESS_REG_P (operands[1]) && reload_completed"
+(define_insn_and_split "*get_tp_31"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec:SI [(match_operand:SI 1 "register_operand" "t")]
+ UNSPEC_GET_TP))]
+ ""
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0) (match_dup 1))])
+
+(define_insn_and_split "*get_tp_64"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (unspec:DI [(match_operand:DI 1 "register_operand" "t")]
+ UNSPEC_GET_TP))]
+ "TARGET_ZARCH"
+ "#"
+ "&& reload_completed"
[(set (match_dup 2) (match_dup 3))
(set (match_dup 0) (ashift:DI (match_dup 0) (const_int 32)))
(set (strict_low_part (match_dup 2)) (match_dup 4))]
"operands[2] = gen_lowpart (SImode, operands[0]);
s390_split_access_reg (operands[1], &operands[4], &operands[3]);")
+; Splitters for storing TLS pointer to %a0:DI.
+
(define_split
[(set (match_operand:DI 0 "register_operand" "")
(match_operand:DI 1 "register_operand" ""))]
;;- Thread-local storage support.
;;
-(define_expand "get_thread_pointer<mode>"
- [(set (match_operand:P 0 "nonimmediate_operand" "") (reg:P TP_REGNUM))]
+(define_expand "@get_thread_pointer<mode>"
+ [(set (match_operand:P 0 "nonimmediate_operand" "")
+ (unspec:P [(reg:P TP_REGNUM)] UNSPEC_GET_TP))]
""
"")