From patchwork Wed Dec 7 07:25:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hurugalawadi, Naveen" X-Patchwork-Id: 86980 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp182685qgi; Tue, 6 Dec 2016 23:26:45 -0800 (PST) X-Received: by 10.98.204.138 with SMTP id j10mr66429632pfk.83.1481095605552; Tue, 06 Dec 2016 23:26:45 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e1si23046669pfb.241.2016.12.06.23.26.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 23:26:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443657-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443657-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443657-patch=linaro.org@gcc.gnu.org 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:references:in-reply-to :content-type:mime-version; q=dns; s=default; b=c2qFIAJCjd2j7sTv ekc6lyi8Uv/3Vt7WRXXMb3xa7HYEJRXzyQ68K+xpbIcw7HqNRXtgL3rmGVsmPPNr 8U96xo9DnvFxgCizzgiVMa+j4tYwQyi9zUY5c7rWPfI2CwuybkS4RGIhR59gAjpW 7fNdawjL4Hxi2XUX3KCX/Nqtwy8= 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:references:in-reply-to :content-type:mime-version; s=default; bh=EbTOdEF3FiNLxJ2ty7c8Hk H2ays=; b=E3gy56cHnjuQLpElbF0PZ/1/NO5Sk8fES30vR1Q3leyIQjKwCCPUCW 9t3+0jM5KdoSezDSmrQpRkrYwlRR3+38QIAxY2SGGzZmnaO/JMeI68peGTl0Tgmj LDBb3dtspD0uMxbfyDU+VCvzWvu7yCmT0bAmxK/f7f9MZHKupr9jE= Received: (qmail 27716 invoked by alias); 7 Dec 2016 07:25:46 -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 27696 invoked by uid 89); 7 Dec 2016 07:25:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=sk:SYMBOL_, Hx-languages-length:2616, HX-MS-Has-Attach:yes, H*RU:15.01.0747.021 X-HELO: NAM01-BY2-obe.outbound.protection.outlook.com Received: from mail-by2nam01on0060.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) (104.47.34.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Dec 2016 07:25:33 +0000 Received: from CO2PR07MB2694.namprd07.prod.outlook.com (10.166.214.7) by CO2PR07MB2694.namprd07.prod.outlook.com (10.166.214.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Wed, 7 Dec 2016 07:25:29 +0000 Received: from CO2PR07MB2694.namprd07.prod.outlook.com ([10.166.214.7]) by CO2PR07MB2694.namprd07.prod.outlook.com ([10.166.214.7]) with mapi id 15.01.0747.021; Wed, 7 Dec 2016 07:25:29 +0000 From: "Hurugalawadi, Naveen" To: James Greenhalgh CC: Marcus Shawcroft , Richard Earnshaw , Kyrill Tkachov , "gcc-patches@gcc.gnu.org" , kugan , "nd@arm.com" Subject: Re: [PATCH] [AArch64] Fix PR78382 Date: Wed, 7 Dec 2016 07:25:29 +0000 Message-ID: References: , <8c62c0b9-93e0-2f47-0975-c80cecb76480@linaro.org>, In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Naveen.Hurugalawadi@cavium.com; x-ms-office365-filtering-correlation-id: 0a988a6b-59cc-4105-b4af-08d41e7238e9 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CO2PR07MB2694; x-microsoft-exchange-diagnostics: 1; CO2PR07MB2694; 7:J2BO9/JDS+CfqMC2dKavCcvFMEpIijpMdNmYrHCsx1jc8WTt5R/RTJCgaXXoObLla5ze1J1S/rlw8nR+MCvr3WpcK+ZGuZi0XXsfg+fLkqA6c7hYfXZGGJ/eKU9Sbl5eCfC390R7ltP6802o7Le3zEVEnEAJd9/BJtcHVQtiwE7YxXUU+gV7GmgnPR56z+9sOaU0u9unE7y7myPXAhRHVgg9LpP9duFVT50VjswMmBnl3KpKWA9pTsZPgtHYDU35MISv5qb6xP0XnRLtJV0inluy9w70heoFrWIZqFjOTrXLkauJldNLVyRNfEyj5IdcDi/OhgzxvvA30reQoOUFn4eYxqPnG6PXs4ov9O10b6cYWEyzF/+Fy1Rg2ElgS0uXGQ95BL3SK8UPyIAsAt2gMVpod4eym9F2XZkjXHWtm93SwtZbowDv3rx4wJbte8I3R1NoKYEfKyeoIlEbiB0jWg== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(20161123558021)(6072148); SRVR:CO2PR07MB2694; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2694; x-forefront-prvs: 01494FA7F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(51914003)(199003)(189002)(7696004)(106356001)(99936001)(54356999)(76176999)(76576001)(38730400001)(50986999)(305945005)(6916009)(9686002)(33656002)(2950100002)(66066001)(74316002)(3280700002)(92566002)(2906002)(101416001)(4326007)(110136003)(3846002)(39410400001)(3660700001)(229853002)(7846002)(2900100001)(97736004)(5660300001)(99286002)(68736007)(6506006)(7736002)(39840400001)(39850400001)(122556002)(102836003)(8936002)(39450400002)(189998001)(6116002)(77096006)(8676002)(86362001)(5890100001)(105586002)(106116001)(81166006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB2694; H:CO2PR07MB2694.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2016 07:25:29.2414 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2694 Hi James, Thanks for the review and suggestions regarding the testcase. >> Why limit the ABI and endianness here Extra options have been dropped and the testcase will check across all variants and endianness. Please find attached the modified patch as per the comments and let me know if its okay? Thanks, Naveen diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index dab46b5..2b61897 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1378,10 +1378,14 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, case SYMBOL_SMALL_TLSGD: { rtx_insn *insns; - rtx result = gen_rtx_REG (Pmode, R0_REGNUM); + machine_mode mode = GET_MODE (dest); + rtx result = gen_rtx_REG (mode, R0_REGNUM); start_sequence (); - aarch64_emit_call_insn (gen_tlsgd_small (result, imm)); + if (TARGET_ILP32) + aarch64_emit_call_insn (gen_tlsgd_small_si (result, imm)); + else + aarch64_emit_call_insn (gen_tlsgd_small_di (result, imm)); insns = get_insns (); end_sequence (); diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 1e6b6f5..9d89ee8 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5173,20 +5173,20 @@ ;; The TLS ABI specifically requires that the compiler does not schedule ;; instructions in the TLS stubs, in order to enable linker relaxation. ;; Therefore we treat the stubs as an atomic sequence. -(define_expand "tlsgd_small" +(define_expand "tlsgd_small_" [(parallel [(set (match_operand 0 "register_operand" "") (call (mem:DI (match_dup 2)) (const_int 1))) - (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS) + (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS) (clobber (reg:DI LR_REGNUM))])] "" { operands[2] = aarch64_tls_get_addr (); }) -(define_insn "*tlsgd_small" +(define_insn "*tlsgd_small_" [(set (match_operand 0 "register_operand" "") (call (mem:DI (match_operand:DI 2 "" "")) (const_int 1))) - (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS) + (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS) (clobber (reg:DI LR_REGNUM)) ] "" diff --git a/gcc/testsuite/gcc.target/aarch64/pr78382.c b/gcc/testsuite/gcc.target/aarch64/pr78382.c new file mode 100644 index 0000000..febe7bc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr78382.c @@ -0,0 +1,10 @@ +/* { dg-require-effective-target fpic } */ +/* { dg-options "-mtls-dialect=trad -fpic" } */ + +__thread int abc; +void +foo () +{ + int *p; + p = &abc; +}