From patchwork Tue Sep 15 10:00:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 517784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 443DD140082 for ; Tue, 15 Sep 2015 20:01:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=nLYoT9tc; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=IQQmajduWptwD5goBRQK+w2EoBKwk0QoGTlVrFBtXWxhR+AVmjFaP +xMrq54V8fyouQqOXkQu98ec0MuTL8dkQvjjniSE7fCUI+fdTPYgcQp4NVoy796T hCep6vvQX0Dor6dE8xiXGrfEOkpVwE0LwBDCAeh0W6IN0+AgUDBQ/Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=Ajm33rnv3XIIp8RIi53hdp9JdNk=; b=nLYoT9tcpc5z3o3hULUQ vcyF3pzdxdwthVPa5fJFZOz49j69RH8UGY3W2pCRwufLi0IjWrOMKw2ZsJZx/Bde dk0Zrw5fd78RSv1rRdRmOHL5/RTTogyRmIsu9OOQtVjjyqCBDCbiu4kfsM+Cj6KM xbwrf4/RmqVphsD9TCYOkxc= Received: (qmail 8125 invoked by alias); 15 Sep 2015 10:01:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8107 invoked by uid 89); 15 Sep 2015 10:01:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_40, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-la0-f48.google.com Received: from mail-la0-f48.google.com (HELO mail-la0-f48.google.com) (209.85.215.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 15 Sep 2015 10:01:24 +0000 Received: by lamp12 with SMTP id p12so102685923lam.0 for ; Tue, 15 Sep 2015 03:01:20 -0700 (PDT) X-Received: by 10.112.11.163 with SMTP id r3mr19642346lbb.45.1442311280784; Tue, 15 Sep 2015 03:01:20 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by smtp.gmail.com with ESMTPSA id h5sm3156376lab.32.2015.09.15.03.01.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 03:01:20 -0700 (PDT) From: Max Filippov To: gcc-patches@gcc.gnu.org Cc: linux-xtensa@linux-xtensa.org, Sterling Augustine , Max Filippov Subject: [PATCH 1/2] xtensa: fix TLS calls for call0 ABI Date: Tue, 15 Sep 2015 13:00:50 +0300 Message-Id: <1442311251-28016-2-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1442311251-28016-1-git-send-email-jcmvbkbc@gmail.com> References: <1442311251-28016-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes 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. --- 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")])