From e1b8828bc8c162f376cd2ede28de3064673519e9 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 15 Sep 2015 19:24:26 +0000 Subject: [PATCH] xtensa: fix TLS calls for call0 ABI 2015-09-15 Max Filippov 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. From-SVN: r227808 --- gcc/ChangeLog | 7 +++++++ gcc/config/xtensa/xtensa.c | 12 ++++++------ gcc/config/xtensa/xtensa.md | 7 ++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ec1419..bb317cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2015-09-15 Eric Botcazou * tree-eh.c (lower_try_finally_dup_block): Clear location information diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 1910061..1e1ac6b 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -1874,23 +1874,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 3a3a902..a4228da 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1883,7 +1883,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")]) -- 2.7.4