2015-09-15 Max Filippov <jcmvb...@gmail.com> gcc/ * 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. --- gcc/config/xtensa/xtensa.c | 12 ++++++------ gcc/config/xtensa/xtensa.md | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index eb039ba..0aa6a0a 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 6d84384..e3c517d 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")]) -- 1.8.1.4