From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36354 invoked by alias); 28 Jun 2019 13:39:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 36256 invoked by uid 89); 28 Jun 2019 13:39:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=force_reg, xxxxxxxx, sk:arc_leg, xxxx-xx-xx X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Jun 2019 13:39:56 +0000 Received: by mail-wm1-f66.google.com with SMTP id a15so9165407wmj.5 for ; Fri, 28 Jun 2019 06:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+PFFdQmE5E6i7GrJeM4KmTftJw3L0uVaxZ5LBJ2/J0A=; b=DGbXpKPqTvwYF4IdYkRDRAIkcSl7L2p/nezc2WrlOqAS02pvnJH3K779n3y7WZc6Rt gm3+HCEHeYFbsAyUfVMuukabP4b/25j2miD9569xj7ZXLG1aeQEfd/pa/INyOyMBi5nG xQ5PqPnrLPROBp2nRd66qeUtBfDxgWF1AT4ejp78wlHIfrSNGQwdlpWpZSVtv5FM8oAE NBXXBHHNryELHgolLeCP4A+G6Jwigx2ZT3vKNPJGVw3OVlHo0TXhAe1/NFma99Pvoi1T H4EJgc+vpb5cMUA7Mr9Tdq5h4UUvPAwKGqlNBGKDZwQy2WKlDi3riZl+yqWQjws54cj1 so6Q== Return-Path: Received: from localhost.localdomain ([188.26.132.2]) by smtp.gmail.com with ESMTPSA id n14sm5413003wra.75.2019.06.28.06.39.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 06:39:54 -0700 (PDT) From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com, andrew.burgess@embecosm.com Subject: [PATCH 2/2] [ARC] Fix emitting TLS symbols. Date: Fri, 28 Jun 2019 13:39:00 -0000 Message-Id: <20190628133926.29980-2-claziss@gmail.com> In-Reply-To: <20190628133926.29980-1-claziss@gmail.com> References: <20190628133926.29980-1-claziss@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg01850.txt.bz2 This is another issue found during smoke testing glibc. When storing a TLS symbol to memory, always use an intermediate register to load it. Ok to apply? Claudiu gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.c (prepare_move_operands): Always use an intermediate register when storing a TLS symbols. gcc/ xxxx-xx-xx Claudiu Zissulescu * gcc/testsuite/gcc.target/arc/tls-2.c: New test. * gcc/testsuite/gcc.target/arc/tls-3.c: Likewise. --- gcc/config/arc/arc.c | 2 +- gcc/testsuite/gcc.target/arc/tls-2.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/arc/tls-3.c | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/arc/tls-2.c create mode 100644 gcc/testsuite/gcc.target/arc/tls-3.c diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 910c8d2ad30..66a69628980 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -9272,7 +9272,7 @@ prepare_move_operands (rtx *operands, machine_mode mode) if (GET_CODE (operands[1]) == SYMBOL_REF) { enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]); - if (MEM_P (operands[0]) && flag_pic) + if (MEM_P (operands[0])) operands[1] = force_reg (mode, operands[1]); else if (model) operands[1] = arc_legitimize_tls_address (operands[1], model); diff --git a/gcc/testsuite/gcc.target/arc/tls-2.c b/gcc/testsuite/gcc.target/arc/tls-2.c new file mode 100644 index 00000000000..3cec309a0b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/tls-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls } */ +/* { dg-skip-if "" { arc*-*-elf* } } */ +/* { dg-options "-O2" } */ + +typedef int type_a; +__thread int b; +int c; + +extern int bar (char *, int, int *, int, int *, char, type_a, int *, int *); +int foo (int *f, char buffer, type_a buflen, int *g) +{ + bar("", c, (int *)foo, 1, (int *)f, buffer, buflen, (int *)g, &b); +} diff --git a/gcc/testsuite/gcc.target/arc/tls-3.c b/gcc/testsuite/gcc.target/arc/tls-3.c new file mode 100644 index 00000000000..e78b5a22742 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/tls-3.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls } */ +/* { dg-skip-if "" { arc*-*-elf* } } */ +/* { dg-options "-Os -fPIC" } */ + + +typedef struct +{ + int(a); + char b[]; +} type_c; + + +extern int bar (char *, int, char *); +static _Thread_local type_c d; +int foo(void) +{ + bar(d.b, 0, d.b); +} -- 2.21.0