From: Max Filippov Date: Tue, 30 May 2017 23:37:42 +0000 (+0000) Subject: xtensa: fix TLS calls for call0 ABI X-Git-Tag: releases/gcc-5.5.0~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5385af9b463a7b26e9857744f259ac7574b52770;p=thirdparty%2Fgcc.git xtensa: fix TLS calls for call0 ABI 2017-05-30 Max Filippov gcc/ Backport from mainline 2015-09-15 Max Filippov * config/xtensa/xtensa.c (xtensa_call_tls_desc): Use a10 or a2 to pass TLS call argument, according to current ABI. * config/xtensa/xtensa.md (tls_call pattern): Use callx8 or callx0 for TLS call, according to current ABI. From-SVN: r248704 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f556b18e2bda..4e53b9fd6565 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-05-30 Max Filippov + + Backport from mainline + 2015-09-15 Max Filippov + + * config/xtensa/xtensa.c (xtensa_call_tls_desc): Use a10 or a2 + to pass TLS call argument, according to current ABI. + * config/xtensa/xtensa.md (tls_call pattern): Use callx8 or + callx0 for TLS call, according to current ABI. + 2017-05-30 Jakub Jelinek Backported from mainline diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index eb039bac56a2..0aa6a0a81752 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -1891,23 +1891,23 @@ xtensa_tls_module_base (void) static rtx_insn * xtensa_call_tls_desc (rtx sym, rtx *retp) { - rtx fn, arg, a10; + rtx fn, arg, a_io; rtx_insn *call_insn, *insns; start_sequence (); fn = gen_reg_rtx (Pmode); arg = gen_reg_rtx (Pmode); - a10 = gen_rtx_REG (Pmode, 10); + a_io = gen_rtx_REG (Pmode, WINDOW_SIZE + 2); emit_insn (gen_tls_func (fn, sym)); emit_insn (gen_tls_arg (arg, sym)); - emit_move_insn (a10, arg); - call_insn = emit_call_insn (gen_tls_call (a10, fn, sym, const1_rtx)); - use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a10); + emit_move_insn (a_io, arg); + call_insn = emit_call_insn (gen_tls_call (a_io, fn, sym, const1_rtx)); + use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a_io); insns = get_insns (); end_sequence (); - *retp = a10; + *retp = a_io; return insns; } diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 6d84384c9502..e3c517d0e8f8 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1867,7 +1867,12 @@ UNSPEC_TLS_CALL)) (match_operand 3 "" "i")))] "TARGET_THREADPTR && HAVE_AS_TLS" - "callx8.tls %1, %2@TLSCALL" +{ + if (TARGET_WINDOWED_ABI) + return "callx8.tls %1, %2@TLSCALL"; + else + return "callx0.tls %1, %2@TLSCALL"; +} [(set_attr "type" "call") (set_attr "mode" "none") (set_attr "length" "3")])