From patchwork Mon Jun 18 10:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 138866 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3753010lji; Mon, 18 Jun 2018 03:01:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJSKjYeDsr3U3qRK0FiLd/X+ojKp31TWT/FluT+4fON8j1QV58FWh0itfaWcsSECod7O5BJ X-Received: by 2002:a62:10c2:: with SMTP id 63-v6mr12770742pfq.229.1529316081592; Mon, 18 Jun 2018 03:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529316081; cv=none; d=google.com; s=arc-20160816; b=G5dFQDw+10tM68CIP0j1YAHsVF63zJCyGea+yhZFxKJZMYDyiVe/fQtKIEAPjUbkQT CtbuvlsgFvRW34pFLY64Dc9p/jBaMt4T3iNxPh6S8okZeo3hByqd3QZIdFvh875d76FR 6DhdPfVCQcnjP4fRclyqWXvIpCX7CaXag9Okzjky7eQzyImckau3q+BtzeO6X5VhobVL avDTadfrDH85l5oP+yxnCUooeI1EJ8bsm6FljQEZ8zO5kWknnmmizGDz8gIsCk/dIFpC MF7ybCLD2GAVfWpriolMbOgDLn7ewD9U8a1C/ofc90KnxHtg7WJAYBb+ndkjQHbA9sFA Ozgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:nodisclaimer :mime-version:user-agent:date:message-id:subject:from:cc:to :delivered-to:sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=nOw1hKVvqY0zfjy7y3WF2E45XrnWqnG4hxv+q3dSlEw=; b=qVA9ITytYd7At8d93C5akSwijpWemgIaCQOBcEF5cECoNFDqa5dsbAxfV7HShhT3Sc u+EfulBV0t2+q3IJBZ1EFDovzZKfeCDb7ueMrPL803K6HcBtiHAzitxyGnxrRMnkvWbZ J13wx3GO4nkNIQ7UQSEIQXH/qKWdxcPoIAIYTyE5QC/ga6o4JMxdCU038Iaeve+aSTjl dTXw0L9367cJDE1/yy+pOabxUgD8uEc1GhrfJp87lO6we/y5Yo+HHXuizpuA29tnjTDy xwFzQP7tKhY1OY0z9/slQB79XRtXRj0g7HkEuuVu3teNwc8z13M8dSunoqCrGryRVoGN jQPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Quyfip43; spf=pass (google.com: domain of binutils-return-102124-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-102124-patch=linaro.org@sourceware.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k185-v6si11840251pgd.22.2018.06.18.03.01.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 03:01:21 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-102124-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Quyfip43; spf=pass (google.com: domain of binutils-return-102124-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-102124-patch=linaro.org@sourceware.org" DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:message-id:date :mime-version:content-type; q=dns; s=default; b=BuM/GzW/i2RYMXrD 0nB0V1fOxDWhln0xN5fJf3NYg2yvWp+0KY7vTw7zcH7wo42dBKWulNYKzMY5tQny pJ8+RQ67fi0mZALcAt6GOVop+Lr2O8dIpqjH44c3WLBjDeTsIxrG1xMWmCP4stB6 pln+Vp42Rh3MuxEYlOxPuOWkbj0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:message-id:date :mime-version:content-type; s=default; bh=jCiI+Lb6Ie1lv4E8uAH+IN quW4w=; b=Quyfip43Z60tObQ6UoiYL0AvXrQG356jix3uqQN6vGKr+U8AIzkVzp Qzav5gxErLRstbWcQjJyosqyGIJGLbcjyt8fEL5lz/rW8B/pNv/obr78T6YKgH5K z1MuD17Tb2bGglNpcQlDKxyDUQW5pqsLrIFMicByliVPDTLBRU9tE= Received: (qmail 67973 invoked by alias); 18 Jun 2018 10:01:08 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 67652 invoked by uid 89); 18 Jun 2018 10:00:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=3003, x26, sk:warn_un, Warn X-HELO: EUR04-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr70082.outbound.protection.outlook.com (HELO EUR04-HE1-obe.outbound.protection.outlook.com) (40.107.7.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Jun 2018 10:00:23 +0000 Received: from [10.2.206.71] (217.140.96.140) by DB6PR08MB2791.eurprd08.prod.outlook.com (2603:10a6:6:1d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 10:00:12 +0000 To: binutils Cc: nd From: Ramana Radhakrishnan Subject: [Patch AArch64] Warn on unpredictable stlxrb , stlxrh and stlxr cases. Message-ID: Date: Mon, 18 Jun 2018 11:00:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Thunderbird/57.0 MIME-Version: 1.0 X-ClientProxiedBy: LO2P265CA0117.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::33) To DB6PR08MB2791.eurprd08.prod.outlook.com (2603:10a6:6:1d::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83a23c84-db71-4e39-f5f0-08d5d5024888 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: DB6PR08MB2791: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ramana.Radhakrishnan@arm.com; NoDisclaimer: True X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Forefront-PRVS: 0707248B64 Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 10:00:12.5508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83a23c84-db71-4e39-f5f0-08d5d5024888 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2791 A recent case in golang highlighted that gas wasn't warning on these unpredictable cases in the architecture. Fixed thusly. Tested aarch64-none-elf. Ok ? regards Ramana 2018-06-17 Ramana Radhakrishnan * config/tc-aarch64.c (warn_unpredictable_ldst): Add unpredictable cases for ldxp, stlxrb, stlxrh, stlxr. * testsuite/gas/aarch64/diagnostic.s: New tests. * testsuite/gas/aarch64/diagnostic.l: Adjust. diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 660fa7c..e5d819a 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -6703,6 +6703,22 @@ warn_unpredictable_ldst (aarch64_instruction *instr, char *str) && opnds[0].reg.regno == opnds[1].reg.regno) as_warn (_("unpredictable load of register pair -- `%s'"), str); break; + + case ldstexcl: + /* It is unpredictable if the destination and status registers are the + same. */ + if ((aarch64_get_operand_class (opnds[0].type) + == AARCH64_OPND_CLASS_INT_REG) + && (aarch64_get_operand_class (opnds[1].type) + == AARCH64_OPND_CLASS_INT_REG) + && (opnds[0].reg.regno == opnds[1].reg.regno + || opnds[0].reg.regno == opnds[2].reg.regno)) + as_warn (_("unpredictable: identical transfer and status registers" + " --`%s'"), + str); + + break; + default: break; } diff --git a/gas/testsuite/gas/aarch64/diagnostic.l b/gas/testsuite/gas/aarch64/diagnostic.l index 00bb512..6aae306 100644 --- a/gas/testsuite/gas/aarch64/diagnostic.l +++ b/gas/testsuite/gas/aarch64/diagnostic.l @@ -172,3 +172,13 @@ [^:]*:300: Warning: ignoring redefinition of register alias 'ip1' [^:]*:301: Warning: ignoring redefinition of register alias 'lr' [^:]*:302: Warning: ignoring redefinition of register alias 'fp' +[^:]*:304: Warning: unpredictable: identical transfer and status registers --`stlxrb w26,w26,\[x0\]' +[^:]*:305: Warning: unpredictable: identical transfer and status registers --`stlxrh w26,w26,\[x1\]' +[^:]*:306: Warning: unpredictable: identical transfer and status registers --`stlxr w26,w26,\[x2\]' +[^:]*:307: Warning: unpredictable: identical transfer and status registers --`stlxrb w26,w27,\[x26\]' +[^:]*:308: Warning: unpredictable: identical transfer and status registers --`stlxrh w26,w27,\[x26\]' +[^:]*:309: Warning: unpredictable: identical transfer and status registers --`stlxr w26,w27,\[x26\]' +[^:]*:310: Warning: unpredictable: identical transfer and status registers --`stlxr w26,x27,\[x26\]' +[^:]*:311: Warning: unpredictable: identical transfer and status registers --`stlxr w26,x26,\[x3\]' +[^:]*:312: Warning: unpredictable: identical transfer and status registers --`ldxp x26,x26,\[x5\]' +[^:]*:313: Warning: unpredictable: identical transfer and status registers --`ldxp x26,x1,\[x26\]' diff --git a/gas/testsuite/gas/aarch64/diagnostic.s b/gas/testsuite/gas/aarch64/diagnostic.s index a62327d..c18c48e 100644 --- a/gas/testsuite/gas/aarch64/diagnostic.s +++ b/gas/testsuite/gas/aarch64/diagnostic.s @@ -300,3 +300,14 @@ ip1 .req x1 lr .req x2 fp .req x3 + + stlxrb w26, w26, [x0] + stlxrh w26, w26, [x1] + stlxr w26, w26, [x2] + stlxrb w26, w27, [x26] + stlxrh w26, w27, [x26] + stlxr w26, w27, [x26] + stlxr w26, x27, [x26] + stlxr w26, x26, [x3] + ldxp x26, x26, [x5] + ldxp x26, x1, [x26]