From patchwork Tue May 19 16:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1293553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=tAtOfiLi; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=tAtOfiLi; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49RLpw2ffgz9sT4 for ; Wed, 20 May 2020 02:25:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3AC03953C09; Tue, 19 May 2020 16:25:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70045.outbound.protection.outlook.com [40.107.7.45]) by sourceware.org (Postfix) with ESMTPS id 4F9683951C68 for ; Tue, 19 May 2020 16:25:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F9683951C68 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Alex.Coplan@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=01QMelcjebz98jA0ud0sJ9U2Yp3O7eSjgRvQ5xesVhA=; b=tAtOfiLiB52Yc2DNPjqcyNSa+39e9dJqcGZi6rlpOSIaGqlerEKE5776iYBr7pNmEBwNCijVHXSUhAYQey/ogIc5iXL7TyzgIEEyz97eZdPTA40Dl/140PDkFXUD+xPtSkThhDYWF6/5+O53TLY2o1a3YzVBTmAQnOPxXxGr7XI= Received: from AM3PR03CA0066.eurprd03.prod.outlook.com (2603:10a6:207:5::24) by DB7PR08MB3132.eurprd08.prod.outlook.com (2603:10a6:5:1c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Tue, 19 May 2020 16:25:52 +0000 Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:5:cafe::9f) by AM3PR03CA0066.outlook.office365.com (2603:10a6:207:5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Tue, 19 May 2020 16:25:52 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Tue, 19 May 2020 16:25:51 +0000 Received: ("Tessian outbound cff7dd4de28a:v57"); Tue, 19 May 2020 16:25:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 891c74aca8f19393 X-CR-MTA-TID: 64aa7808 Received: from cfe58b4cbefb.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E162015F-0904-412F-A5AF-6602D1E0C28C.1; Tue, 19 May 2020 16:25:46 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cfe58b4cbefb.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 19 May 2020 16:25:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYe62sbMadwAeIrun/sCqJDxnX3q4+bOM2pfT4D8iF0+mMgKmSifPklbgvso+cnaW3ww8wvmB4UUKE7W4G/9HsoOhXeIG0nDLEB2UWe4XKZz6P2tBuefo5GuavAeyChmYD/20D9T7VX4cbaWHg8x7tgcrV1L1guPNfaYpa6ZrxI/n8X6ki90qPQOJrD6A2T09k4qJtlDlarW6+j9dKiurJVzYRLcflsNvvYGHvSrtN1nS+EZrq/5ABQqb6AHiBJASLmJR3VHX1sfjK+qd4uN8Eofud1CNVJG/uBYGapeWI9V7kVuGZ72M/JQGUrQZy855C3p8WVgWv2kx99EOreYSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=01QMelcjebz98jA0ud0sJ9U2Yp3O7eSjgRvQ5xesVhA=; b=TjW1yaKOf3LdEhSfUbFX+lgUcxyS2wtuhV06C10EgJNCihTmeXulicZ9EOZl4X919tTZjFMDkZa77FuU9cVzoqOl5kmDbw1IETVMidIHywhYpyYlff3nP+CDpNqF9NHgDhqdvcndGNYxVQneyy8vNm873Qq2d4dfxpk7M2DQ8fI5TYPW+zQ2gPehaqxL3g9Kq6YvkbXx0hA/hRZ9cJnZSrheOJyzGwLSf/L4DbR6X/TqpssTa8feBv/uUy50eMV0ADoTUeZq9z3EXh36A8k9vEIkRd7thnEL8JdDGpHJJFZxi72Y0+vwAbSBXRJHqW4mdT48y08Er2rYTX4vsoGoXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=01QMelcjebz98jA0ud0sJ9U2Yp3O7eSjgRvQ5xesVhA=; b=tAtOfiLiB52Yc2DNPjqcyNSa+39e9dJqcGZi6rlpOSIaGqlerEKE5776iYBr7pNmEBwNCijVHXSUhAYQey/ogIc5iXL7TyzgIEEyz97eZdPTA40Dl/140PDkFXUD+xPtSkThhDYWF6/5+O53TLY2o1a3YzVBTmAQnOPxXxGr7XI= Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) by VI1PR08MB3773.eurprd08.prod.outlook.com (2603:10a6:803:bb::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.31; Tue, 19 May 2020 16:25:44 +0000 Received: from VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::88b4:476f:5960:5ae4]) by VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::88b4:476f:5960:5ae4%6]) with mapi id 15.20.3000.034; Tue, 19 May 2020 16:25:44 +0000 Date: Tue, 19 May 2020 17:25:36 +0100 From: Alex Coplan To: gcc-patches@gcc.gnu.org Subject: [PATCH] [aarch64] Fix PR94591: GCC generates invalid rev64 insns Message-ID: <20200519162536.7e7dwfklqkh5almm@arm.com> Content-Disposition: inline User-Agent: NeoMutt/20171215 X-ClientProxiedBy: DM5PR16CA0023.namprd16.prod.outlook.com (2603:10b6:3:c0::33) To VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.54) by DM5PR16CA0023.namprd16.prod.outlook.com (2603:10b6:3:c0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Tue, 19 May 2020 16:25:42 +0000 X-Originating-IP: [217.140.106.54] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e34944e5-c96e-4297-2eaa-08d7fc114c18 X-MS-TrafficTypeDiagnostic: VI1PR08MB3773:|DB7PR08MB3132: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2803;OLM:2803; X-Forefront-PRVS: 040866B734 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: M0q82u0esRlWIRUbWH2CzBxm1lc+XLNDZlq6WF02MgGi3D21ifTgFW2w44RS8GwwWiSMT2jHF5evixetZoFBWOjnhi3TRM0HaCFi3d+vvmzJMhGk6xNojDq+lCUjMooUlih3WIazhqyuwN2NiZA94gvF59HBiY1fp9//xPhfCaJy/lffN8SjJI1ateiGQXNGzTnshqMPDFQZT4aRWAz37JkzS+Lc03Skg4qftFohxi9xoVakoQhU6h1ztV/OVZQNsMba//GV8OIaWKOwV0zjZv5mhD9Np+bdFUfO0a7/h7bY6eaZta1RT19Hvb4ksZGCRXhUQiPI42bdakwLVt+HQqUBMG9m3JlWts7zFrq1gWUyz3raxLqhaMutykieo0oXxdOfX5S+15YZXjFc11+4DW1v1Qj3UMTgrpsPR3TrwXx4V0UCV5G5DXOB+ILBuuXT4qtMS9+3MN0ubURPaxVAtwjxySpiH1wUuhhkACM+G94DmHeaaZdmaHbc2CIQ/0br X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB4029.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(44832011)(8936002)(66556008)(8676002)(2616005)(66946007)(66616009)(66476007)(956004)(4326008)(33964004)(316002)(186003)(6916009)(55016002)(44144004)(36756003)(16526019)(26005)(2906002)(86362001)(478600001)(8886007)(52116002)(7696005)(235185007)(21490400003)(6666004)(1076003)(5660300002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2fof8LgmhlRlAYtQ+L1BkebkYEYDYaPVBhE6N1D3hEEBUoa4F4rs0AjhqrFhWnt1xddxfCcwTnu9JiCQswKiYIXEPiO4zfVa5zxhfvVdUMW56mLX8JFAb2buqDHbwy/qAkyS/U3hkkxFKt2n93O4YSUzfbg1OiZdvSFhueKsK/TR80NK7QsVdXJOoa0OTvvFhuAc7mPcmLOWwd5qoiKsbM/LZxiGQCP2aVkzlDhc9rW6PCzt1KLrhX0ut1brgRERha8MvLTEZjbMEZ1jRdsBD7uJqnAdKBSKFUTaNqN//GYLyQ7VwrwBTizpcP5hJaoQG9SfmHFRmlAEffIdO37ZIiTN/YmZqQjcOdKqt3TKwDWvap7GONZx7rAUvYK7RuqBe1Jv2cayiY4ciwoiTxR/+PSk884IrVxd1CYO2AUJf9FCI65/H+QpAs+wV6hwsXtzdhFsg59Itj6IBhnnek0c/cbXsMkLryZgISyirTQXsf4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3773 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(346002)(376002)(39860400002)(136003)(46966005)(6666004)(8676002)(956004)(2616005)(86362001)(5660300002)(47076004)(336012)(33964004)(44144004)(235185007)(8886007)(7696005)(6916009)(1076003)(8936002)(82740400003)(44832011)(16526019)(186003)(4326008)(55016002)(70586007)(66616009)(21490400003)(70206006)(478600001)(82310400002)(36756003)(316002)(2906002)(36906005)(26005)(81166007)(356005)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: ac8d89f3-0700-49e4-4d9b-08d7fc1147bd X-Forefront-PRVS: 040866B734 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qRhY/G0j/rf32+o17r8eHrQvxX83dtyZ7KBWFrWJnEU19h0y/RYEzcM+Tv003NXI9+5yHCQCbl7mGbGi2KG+rrh7H+e/exrNBTjtoQ1t4pioHLSy4eVA1OLZkVtHcgtsuAEO1cCrHv0lnwWIrTNGitPqK0q/leoIq9NEaCyRLTuwrqsnvFL1n2Hfv3BB4Cf5n7MkDLNX+rbXbL+vfOjcigP7KD19J0RpU8x7ubD0sFCbmtGfau3zR4SlJBhNwlmlg5RMv+oekehOYbEV/lJ8xx/3rdXBmtIFAbpUVrNsIYUB9OE+8b2iodDy5MueU/jh6+nc2MGEdZY01FMVIb68kKqr34f2tFuyqkzAjGXVezKx+qk1JvezPTfD4oFiewisJ5wRGlqRWogsK31OtgqdRAmHdf3bdZmlNfhxQRhBNe5rIYxqFWLdmEPMNOUTzZ1Ca/jwsctur8e6pqbXQ8MCXVCe1OMh9Pz4ihuO3hWiNN64rYIshww4ZqAs4DNiQLZ8ITmV6LS3J7A+13lkyzxmNf3Z1RyGGg1C2pQs9Es0Odw= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2020 16:25:51.6911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e34944e5-c96e-4297-2eaa-08d7fc114c18 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3132 X-Spam-Status: No, score=-20.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Cc: richard.earnshaw@arm.com, nd@arm.com, marcus.shawcroft@arm.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hello, This patch fixes PR94591. The problem was the function aarch64_evpc_rev_local() matching vector permutations that were not reversals. In particular, prior to this patch, this function matched the identity permutation which led to generating bogus REV64 insns which were rejected by the assembler. Testing: - New regression test which passes after applying the patch. - New test passes on an x64 -> aarch64-none-elf cross. - Bootstrap and regtest on aarch64-linux-gnu. OK to install? Thanks, Alex --- gcc/ChangeLog: 2020-05-19 Alex Coplan PR target/94591 * config/aarch64/aarch64.c (aarch64_evpc_rev_local): Don't match identity permutation. gcc/testsuite/ChangeLog: 2020-05-19 Alex Coplan PR target/94591 * gcc.c-torture/execute/pr94591.c: New test. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 70aa2f752b5..79c016f4dc3 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -20191,7 +20191,8 @@ aarch64_evpc_rev_local (struct expand_vec_perm_d *d) if (d->vec_flags == VEC_SVE_PRED || !d->one_vector_p - || !d->perm[0].is_constant (&diff)) + || !d->perm[0].is_constant (&diff) + || !diff) return false; size = (diff + 1) * GET_MODE_UNIT_SIZE (d->vmode); diff --git a/gcc/testsuite/gcc.c-torture/execute/pr94591.c b/gcc/testsuite/gcc.c-torture/execute/pr94591.c new file mode 100644 index 00000000000..42271ad8bce --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr94591.c @@ -0,0 +1,32 @@ +typedef unsigned __attribute__((__vector_size__(8))) V2SI_u; +typedef int __attribute__((__vector_size__(8))) V2SI_d; + +typedef unsigned long __attribute__((__vector_size__(16))) V2DI_u; +typedef long __attribute__((__vector_size__(16))) V2DI_d; + +void id_V2SI(V2SI_d *v) +{ + *v = __builtin_shuffle(*v, (V2SI_d)(V2SI_u) { 0, 1 }); +} + +void id_V2DI(V2DI_d *v) +{ + *v = __builtin_shuffle(*v, (V2DI_d)(V2DI_u) { 0, 1 }); +} + +extern void abort(void); + +int main(void) +{ + V2SI_d si = { 35, 42 }; + id_V2SI(&si); + + if (si[0] != 35 || si[1] != 42) + abort(); + + V2DI_d di = { 63, 38 }; + id_V2DI(&di); + + if (di[0] != 63 || di[1] != 38) + abort(); +}