From patchwork Thu May 25 10:23:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu Ianculescu X-Patchwork-Id: 98941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp256129vqr; Thu, 25 May 2023 03:24:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZXhqySgMlWmexaiu89NLke40nlDxgpg3bP6UAEDsUVJYyMJzy/fVsKYy6D/Z43rqd8c4L X-Received: by 2002:a17:907:940c:b0:958:514f:d88a with SMTP id dk12-20020a170907940c00b00958514fd88amr1030163ejc.34.1685010262621; Thu, 25 May 2023 03:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685010262; cv=none; d=google.com; s=arc-20160816; b=wAGlq3tXiRXk1stAuGPlrV2qcj7zNFvaCdaeX+v+UiE0/S3pfJL71kR8nDhc51RIV9 SHOwYfjpU1L+yXf+Z0GI9iq2UIUvMYXRuGh19aX43+RfFtcDB957aZTbox6Z2FIlVV+7 EdR1btXTnUNV5xnA8xb6HneWGXQNmLVrbN0W3/oLBA2/dFi0Ehn7Zdp+GwaGA2yQfhs7 PG7szclLdtbsVpZmVFIEXKFdJ94RlRAE3IGZo1RvZ/hnoKTFXkj82AUEvCmbwnxhkKe2 +wrhxqeFHo/t2Q201kfcxZxznyeH+4FEMBmg5wzy4wSjdUKDMkQiCIYjZkziz0D4XhJH adQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Dmh2Dd7f7AswddWaKoQCz8DWAqU69fWgg76s2cxKh+0=; b=DyEeM+LQbqbuVdHilX++GGv8hfifB3M0aOlSmbY9UjPh+Poyb9LUCzQIuOgSIbEimF Bw6X+7gXPQWcxr2CpDrmliEhReRR7eIzEbfVuTb7T079q03QLLRMBwIbcJemn2HAyeHj COddJf8loRSpb5cQfKD96K27W8oNkAl7Elxw+gheyAzQoIGbvl2iezQJOyz1MNjOMicG CUDOjAgbY/f1Zq67H88DHy75uBY+UETd2bk37ZOw7wZbiclNqqqPC3pN0G3pN319Rehb VeoopV4CWChuo+H5k/vUV6IP92mpimi9Kv1+C7eYFGYNE/csln4QMJ3sVaWazlB7jxXv 6TQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oCT+iht9; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o23-20020a1709064f9700b00965ab02c96fsi858459eju.894.2023.05.25.03.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 03:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=oCT+iht9; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3DAE83857703 for ; Thu, 25 May 2023 10:24:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DAE83857703 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685010261; bh=Dmh2Dd7f7AswddWaKoQCz8DWAqU69fWgg76s2cxKh+0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=oCT+iht92jPMCYobsNJTRe6LGsTmhE3cgGv01KTeaYgX+9esezVhP5idBFCsEso+K gpDifHMJ+Qa/LiAekISwoMM5Da8zRpHo8ezc+vXV9fgak2j4xXKK81JJYeeL/3s/3n agL51LISc728wJBIxHr2+8Qv3wj76L5yQayhJA0E= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 4C6053858D32 for ; Thu, 25 May 2023 10:23:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4C6053858D32 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-30950eecc1eso1909427f8f.0 for ; Thu, 25 May 2023 03:23:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685010212; x=1687602212; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dmh2Dd7f7AswddWaKoQCz8DWAqU69fWgg76s2cxKh+0=; b=A3+OOQiFGM7No6kHxr3oOMMGfNjHlCnothg0Q2CbszBZ5pHrE7SqJdQv8WbTlNZqO1 vEHk5uCa4zx7TO4cTZ70HcoXhXCuAESZguUkncxQb3CRp94Jmhq/fkOXJGop52RBel1h 1h1/ZZNhyrk+mX/o71zGxk6JbA3doGhGXNU802Xd+GqqkI8iicx+PsFVQoR8Zvx25b2D ZOc39AdgKywX5z8E4jHCvXHe0WnR7J1mtmQ37dNoKwwCdian/bnYihDInxNUmAXz0QIr 2IjMW3mo1JLC28K8s6qh2knH1vYQ/jcje9zpB50SC2SRKTrDY0/h9qAMQjhxf1yudgl5 +IWQ== X-Gm-Message-State: AC+VfDxIeIVLCmWMAnqvZqmdBPzBTl6YcewMLRI69QUpscTcCk1ilpG4 ahUVa4Q3or1wxgVWgYxVyXyb8GcodqTNxw== X-Received: by 2002:a5d:53cb:0:b0:309:3bb5:7968 with SMTP id a11-20020a5d53cb000000b003093bb57968mr2017295wrw.16.1685010212132; Thu, 25 May 2023 03:23:32 -0700 (PDT) Received: from fatty.nomansland ([193.187.151.25]) by smtp.gmail.com with ESMTPSA id a18-20020adfe5d2000000b003079c402762sm1306203wrn.19.2023.05.25.03.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 03:23:31 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com Subject: [committed] arc: Make TLS Local Dynamic work like Global Dynamic model Date: Thu, 25 May 2023 13:23:30 +0300 Message-Id: <20230525102330.3637874-1-claziss@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Claudiu Zissulescu via Gcc-patches From: Claudiu Zissulescu Ianculescu Reply-To: Claudiu Zissulescu Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766861321445974172?= X-GMAIL-MSGID: =?utf-8?q?1766861321445974172?= Current ARC's TLS Local Dynamic model is using two anchors to access data, namely `.tdata` and `.tbss`. This implementation is unnecessary complicated. However, the TLS Local Dynamic model has better results using Global Dynamic model and anchors. gcc/ChangeLog; * config/arc/arc.cc (arc_call_tls_get_addr): Simplify access using TLS Local Dynamic. Signed-off-by: Claudiu Zissulescu --- gcc/config/arc/arc.cc | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index dd012ffa975..fef8a504f77 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -6257,8 +6257,6 @@ arc_call_tls_get_addr (rtx ti) return ret; } -#define DTPOFF_ZERO_SYM ".tdata" - /* Return a legitimized address for ADDR, which is a SYMBOL_REF with tls_model MODEL. */ @@ -6267,37 +6265,17 @@ arc_legitimize_tls_address (rtx addr, enum tls_model model) { rtx tmp; - if (!flag_pic && model == TLS_MODEL_LOCAL_DYNAMIC) - model = TLS_MODEL_LOCAL_EXEC; - - /* The TP pointer needs to be set. */ gcc_assert (arc_tp_regno != -1); switch (model) { case TLS_MODEL_GLOBAL_DYNAMIC: + case TLS_MODEL_LOCAL_DYNAMIC: tmp = gen_reg_rtx (Pmode); emit_move_insn (tmp, arc_unspec_offset (addr, UNSPEC_TLS_GD)); return arc_call_tls_get_addr (tmp); - case TLS_MODEL_LOCAL_DYNAMIC: - rtx base; - tree decl; - const char *base_name; - - decl = SYMBOL_REF_DECL (addr); - base_name = DTPOFF_ZERO_SYM; - if (decl && bss_initializer_p (decl)) - base_name = ".tbss"; - - base = gen_rtx_SYMBOL_REF (Pmode, base_name); - tmp = gen_reg_rtx (Pmode); - emit_move_insn (tmp, arc_unspec_offset (base, UNSPEC_TLS_GD)); - base = arc_call_tls_get_addr (tmp); - return gen_rtx_PLUS (Pmode, force_reg (Pmode, base), - arc_unspec_offset (addr, UNSPEC_TLS_OFF)); - case TLS_MODEL_INITIAL_EXEC: addr = arc_unspec_offset (addr, UNSPEC_TLS_IE); addr = copy_to_mode_reg (Pmode, gen_const_mem (Pmode, addr));