Message ID | 20230428113002.482343-4-andrea.corallo@arm.com |
---|---|
State | Committed |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C0A3A3850840 for <patchwork@sourceware.org>; Fri, 28 Apr 2023 11:33:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C0A3A3850840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682681595; bh=dDJSScKFxoQuJ+z9PFPNPoBuB2tdAO15V8xelF4pA+w=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=crC8Iti1GRxBeNxP6CL33rKpge148bTIEIPZhw5opGsEHtLx/J4ZkYcok8SNfiEtV ApnTDD3XSsWRskcClI5Xf2qso/TpyulY98FuPboBhiVfY7tySxjCB9zAn+Abfx814I fUaIDMZvr2P3YogftMcGrueMplnISG7ic7iHFbi4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2053.outbound.protection.outlook.com [40.107.105.53]) by sourceware.org (Postfix) with ESMTPS id C02FF38555B5 for <gcc-patches@gcc.gnu.org>; Fri, 28 Apr 2023 11:32:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C02FF38555B5 Received: from AM6P192CA0053.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::30) by AS8PR08MB9670.eurprd08.prod.outlook.com (2603:10a6:20b:616::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.21; Fri, 28 Apr 2023 11:32:40 +0000 Received: from AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:82:cafe::2e) by AM6P192CA0053.outlook.office365.com (2603:10a6:209:82::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.24 via Frontend Transport; Fri, 28 Apr 2023 11:32:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass 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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT011.mail.protection.outlook.com (100.127.140.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.23 via Frontend Transport; Fri, 28 Apr 2023 11:32:40 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Fri, 28 Apr 2023 11:32:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 24b2d67c85010ceb X-CR-MTA-TID: 64aa7808 Received: from c0ac24e49a8d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A0E9147D-6753-4DDA-A8F8-040FA92944FC.1; Fri, 28 Apr 2023 11:30:49 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c0ac24e49a8d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 28 Apr 2023 11:30:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nDhSPqNjOhGnZiYrZKMkezpMUOqQFOEkxz/hlKk4GrXiF6NgJdR0WOVtO0KGFbWjv34MW1aELwbzsnMLanGMgg5eQx3tpTlsp2Xh/4RO97QsvfjOaqVLLyZvOPjQi/a6yqEDoba8yHM1hAq/qhqlFhTE1kRblMcHRteC7o5eQILaP7MyPkfR9WxdDN/JJ8FFv/pR89+6IKlh9cbs22uHdS0u27Li5GO9w5pCQt+T8fs9T8kmyCEMI/eHyIwdcbEMtu3RdwxpXWaJaP1xkRJP54HGcMVb2WV+sMl/T8A49nT7jCQZyksucdWyFiIMaMlsx2cWCxwookUTNc2qKFsXuQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dDJSScKFxoQuJ+z9PFPNPoBuB2tdAO15V8xelF4pA+w=; b=BJ6W38AQqLEZkjVqYi551cnkkiRQ7xNXlcR1vAOaO2FaPjKJ+BKTQZ1B2E9oHXSJjvmv81xgESEPUy/FpM40TEznN+qCdRps3u5buVL32i703Wu+ODfRHNLIWIzbZGpjVs8NG4BnYAd6CwyIDBxshbYpE1xvk3cODNykC6c8bbniFMxlrlEh47pKEPlibnIxRwXXLIPQ5zegrR7KxShnSeXfCvaqamXNTXJ8xoiFpS6/tcwAsw/82PsIK2VXxaoKFoK5k5gC8debcJz5MJrWSsBd5Hi/jGvjcNITj7BlVwJ+KtOlM37EdMFdJLwCd587T27fItY1sGVrGL4/RXFe+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6P192CA0105.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:8d::46) by PR3PR08MB5642.eurprd08.prod.outlook.com (2603:10a6:102:8b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.23; Fri, 28 Apr 2023 11:30:46 +0000 Received: from AM7EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8d:cafe::92) by AM6P192CA0105.outlook.office365.com (2603:10a6:209:8d::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.24 via Frontend Transport; Fri, 28 Apr 2023 11:30:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT048.mail.protection.outlook.com (100.127.140.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.23 via Frontend Transport; Fri, 28 Apr 2023 11:30:45 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 28 Apr 2023 11:30:33 +0000 Received: from e124257.nice.arm.com (10.34.101.64) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 28 Apr 2023 11:30:32 +0000 To: <gcc-patches@gcc.gnu.org> CC: <kyrylo.tkachov@arm.com>, <Richard.Earnshaw@arm.com>, "Stam Markianos-Wright" <stam.markianos-wright@arm.com> Subject: [PATCH 04/10] arm: Stop vadcq, vsbcq intrinsics from overwriting the FPSCR NZ flags Date: Fri, 28 Apr 2023 13:29:56 +0200 Message-ID: <20230428113002.482343-4-andrea.corallo@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230428113002.482343-1-andrea.corallo@arm.com> References: <20230428113002.482343-1-andrea.corallo@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT048:EE_|PR3PR08MB5642:EE_|AM7EUR03FT011:EE_|AS8PR08MB9670:EE_ X-MS-Office365-Filtering-Correlation-Id: 8854fc1a-d059-4df0-c6d9-08db47dc46a1 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: L6l4DZAxJbJ9UYCc80vFXF2mfpLzT9FZySWXJQv3LG+D8HTvzTaxostfNiT8Y4Cnee1p7Ue+NewwVfoyN7UeF+i0Eccc515Zv7b6wkTwhCR1cGNNvmAWQE9tRIpDDdqyYcA2VPqD/22gz/zZ9lGmH0sHGZocOsNG8urgBU4RctZY3zuslF/9PCod9SD0QoRTXpxM1x+MSyEK6fy6+QVx5Uq9g6LR7C4xX/9mz9XkbCoGabV9Wm0WDw5HXLlsX36TygCPfNOVgIpzmYy7K9+XD1i0mK6qyq+au+CZ803lz6UpSjTDzhYSF+5dyCC4ZHQAa1X0JYaIypTPoKcVkrHPUCILm2La4s0fjRnvtYLjMxJpwpFWQSm8VMH+eLF6Bzm5xjfyoyBvVoX3MKuptxY5cbULhIFMU0yKrjw0H0xuXI2iYw8jh40unvqGULoP4+IUZCqY7Udl0xVL6pP2oH+lzLhaEwf0VlJZxOiPKwwp4dCCinO7Rz+c8k0ikUp//+CT9m9XyRleO6D01KKFeAs/rondRYxv8W37uNfdhStwLNVDSzuQVBI5xnsJOSdrWs+E+WrH7dL2I9RadatW3RxVkZJkK4cOPro8DczCgtOhK/YPlLyNXlp4IhAmPWxaYPxg/Elr4dNnZLYzDESm8+nge+7bFRwdaourqQ6T5sZrN90yFFBTVdVjSSLHgGURkVbUxGFv1eTvuHxrTUN0uafoOQ4ka1DpfAin7NuEwQw5WZA= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199021)(46966006)(36840700001)(426003)(336012)(54906003)(82740400003)(6666004)(34020700004)(316002)(47076005)(83380400001)(2906002)(70206006)(70586007)(2616005)(7696005)(36860700001)(4326008)(6916009)(478600001)(5660300002)(36756003)(186003)(41300700001)(8936002)(81166007)(86362001)(40480700001)(356005)(1076003)(82310400005)(8676002)(26005)(44832011)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5642 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e275270a-a5c1-4ef8-fe72-08db47dc0221 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gcPVF1WAMs70Yve6XxmXq9hUGvbjXwFEKvOgOBTpOtJzjvYUWWk8zFr8i+/T6zX19pODXAFCWIggW6hPZWmEz0sJnUsI8vQUkBrBovBKAqL2/vv66ck+WfkqVffo4a8OaNZC99MTvTpUiboZ3EUO3feR3y+rJpdL7x0Wzc/uZQtbDRGEYn8whmPZkseXbIpVkmg9/2yZozucRW9MMs7aiBRc0aOoo+UkWs5izfsfFtMYy2mszuWhSNJwantOhkb2zwGEoLBODgNrNfCbu7VVNZpkh7ly61WlziXHfytP71ATwd5Va0Qw4jN0yl4UFEZPws9i9YDGdAkxUyQ0EBa9R5iVfXCxNG7S0Meh/gM4ot+m18Jom+QHu47rI45IbuyMRSU/QxeKUMuYUFGb+TjEV1pChFjheTwObYgL/Q3visMHfb8qBrOBmhwiVPgb1I3Q1j76+jBemxjUuSfX/rhgkHYqpOuyV4hN3MbRjden7MXUHmMuR3H2fIc1ZbnZTXymutOIx+95XKb4aIwdX049bHb36ee7Kw/J7NaGvLV/Q5OOdGZS0m3ustNpPHV/gWJA+2PXtEjr4L09ja/an9wwYkrduBbteJZQMY9+HrU+EXLQl9yOiD5S71eX8UatDwiaIn8d5h5r5tgZV88pSvMArB8/iMvved6Mejy6VPOrMhJgHSYcBnx+YU3ASDBtcONEPeX1JSp4BIy0vQTfLWSdsgFiYLKg9jsZjm3lCXymIhY= 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; SFS:(13230028)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199021)(40470700004)(36840700001)(46966006)(44832011)(2906002)(6916009)(70206006)(316002)(70586007)(4326008)(41300700001)(8936002)(5660300002)(8676002)(47076005)(478600001)(83380400001)(54906003)(6666004)(7696005)(26005)(186003)(1076003)(2616005)(40460700003)(426003)(36756003)(36860700001)(336012)(34020700004)(40480700001)(82310400005)(82740400003)(86362001)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2023 11:32:40.5816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8854fc1a-d059-4df0-c6d9-08db47dc46a1 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-AuthSource: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9670 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Andrea Corallo via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Andrea Corallo <andrea.corallo@arm.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[01/10] arm: Mve testsuite improvements
|
|
Commit Message
Andrea Corallo
April 28, 2023, 11:29 a.m. UTC
From: Stam Markianos-Wright <stam.markianos-wright@arm.com>
Hi all,
We noticed that calls to the vadcq and vsbcq intrinsics, both of
which use __builtin_arm_set_fpscr_nzcvqc to set the Carry flag in
the FPSCR, would produce the following code:
```
< r2 is the *carry input >
vmrs r3, FPSCR_nzcvqc
bic r3, r3, #536870912
orr r3, r3, r2, lsl #29
vmsr FPSCR_nzcvqc, r3
```
when the MVE ACLE instead gives a different instruction sequence of:
```
< Rt is the *carry input >
VMRS Rs,FPSCR_nzcvqc
BFI Rs,Rt,#29,#1
VMSR FPSCR_nzcvqc,Rs
```
the bic + orr pair is slower and it's also wrong, because, if the
*carry input is greater than 1, then we risk overwriting the top two
bits of the FPSCR register (the N and Z flags).
This turned out to be a problem in the header file and the solution was
to simply add a `& 1x0u` to the `*carry` input: then the compiler knows
that we only care about the lowest bit and can optimise to a BFI.
Ok for trunk?
Thanks,
Stam Markianos-Wright
gcc/ChangeLog:
* config/arm/arm_mve.h (__arm_vadcq_s32): Fix arithmetic.
(__arm_vadcq_u32): Likewise.
(__arm_vadcq_m_s32): Likewise.
(__arm_vadcq_m_u32): Likewise.
(__arm_vsbcq_s32): Likewise.
(__arm_vsbcq_u32): Likewise.
(__arm_vsbcq_m_s32): Likewise.
(__arm_vsbcq_m_u32): Likewise.
---
gcc/config/arm/arm_mve.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Comments
Hi Andrea, Stam, > -----Original Message----- > From: Andrea Corallo <andrea.corallo@arm.com> > Sent: Friday, April 28, 2023 12:30 PM > To: gcc-patches@gcc.gnu.org > Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw > <Richard.Earnshaw@arm.com>; Stam Markianos-Wright <Stam.Markianos- > Wright@arm.com> > Subject: [PATCH 04/10] arm: Stop vadcq, vsbcq intrinsics from overwriting the > FPSCR NZ flags > > From: Stam Markianos-Wright <stam.markianos-wright@arm.com> > > Hi all, > > We noticed that calls to the vadcq and vsbcq intrinsics, both of > which use __builtin_arm_set_fpscr_nzcvqc to set the Carry flag in > the FPSCR, would produce the following code: > > ``` > < r2 is the *carry input > > vmrs r3, FPSCR_nzcvqc > bic r3, r3, #536870912 > orr r3, r3, r2, lsl #29 > vmsr FPSCR_nzcvqc, r3 > ``` > > when the MVE ACLE instead gives a different instruction sequence of: > ``` > < Rt is the *carry input > > VMRS Rs,FPSCR_nzcvqc > BFI Rs,Rt,#29,#1 > VMSR FPSCR_nzcvqc,Rs > ``` > > the bic + orr pair is slower and it's also wrong, because, if the > *carry input is greater than 1, then we risk overwriting the top two > bits of the FPSCR register (the N and Z flags). > > This turned out to be a problem in the header file and the solution was > to simply add a `& 1x0u` to the `*carry` input: then the compiler knows > that we only care about the lowest bit and can optimise to a BFI. > > Ok for trunk? Ok, but I think this needs testsuite coverage for the bug? Thanks, Kyrill > > Thanks, > Stam Markianos-Wright > > gcc/ChangeLog: > > * config/arm/arm_mve.h (__arm_vadcq_s32): Fix arithmetic. > (__arm_vadcq_u32): Likewise. > (__arm_vadcq_m_s32): Likewise. > (__arm_vadcq_m_u32): Likewise. > (__arm_vsbcq_s32): Likewise. > (__arm_vsbcq_u32): Likewise. > (__arm_vsbcq_m_s32): Likewise. > (__arm_vsbcq_m_u32): Likewise. > --- > gcc/config/arm/arm_mve.h | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h > index 1262d668121..8778216304b 100644 > --- a/gcc/config/arm/arm_mve.h > +++ b/gcc/config/arm/arm_mve.h > @@ -16055,7 +16055,7 @@ __extension__ extern __inline int32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vadcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > int32x4_t __res = __builtin_mve_vadcq_sv4si (__a, __b); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16065,7 +16065,7 @@ __extension__ extern __inline uint32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vadcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > uint32x4_t __res = __builtin_mve_vadcq_uv4si (__a, __b); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16075,7 +16075,7 @@ __extension__ extern __inline int32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vadcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, > unsigned * __carry, mve_pred16_t __p) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > int32x4_t __res = __builtin_mve_vadcq_m_sv4si (__inactive, __a, __b, __p); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16085,7 +16085,7 @@ __extension__ extern __inline uint32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vadcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, > unsigned * __carry, mve_pred16_t __p) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > uint32x4_t __res = __builtin_mve_vadcq_m_uv4si (__inactive, __a, __b, > __p); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16131,7 +16131,7 @@ __extension__ extern __inline int32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16141,7 +16141,7 @@ __extension__ extern __inline uint32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16151,7 +16151,7 @@ __extension__ extern __inline int32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, > unsigned * __carry, mve_pred16_t __p) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, __p); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > @@ -16161,7 +16161,7 @@ __extension__ extern __inline uint32x4_t > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, > unsigned * __carry, mve_pred16_t __p) > { > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | (*__carry << 29)); > + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > ~0x20000000u) | ((*__carry & 0x1u) << 29)); > uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, > __p); > *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > return __res; > -- > 2.25.1
On 28/04/2023 17:45, Kyrylo Tkachov wrote: > Hi Andrea, Stam, > >> -----Original Message----- >> From: Andrea Corallo <andrea.corallo@arm.com> >> Sent: Friday, April 28, 2023 12:30 PM >> To: gcc-patches@gcc.gnu.org >> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw >> <Richard.Earnshaw@arm.com>; Stam Markianos-Wright <Stam.Markianos- >> Wright@arm.com> >> Subject: [PATCH 04/10] arm: Stop vadcq, vsbcq intrinsics from overwriting the >> FPSCR NZ flags >> >> From: Stam Markianos-Wright <stam.markianos-wright@arm.com> >> >> Hi all, >> >> We noticed that calls to the vadcq and vsbcq intrinsics, both of >> which use __builtin_arm_set_fpscr_nzcvqc to set the Carry flag in >> the FPSCR, would produce the following code: >> >> ``` >> < r2 is the *carry input > >> vmrs r3, FPSCR_nzcvqc >> bic r3, r3, #536870912 >> orr r3, r3, r2, lsl #29 >> vmsr FPSCR_nzcvqc, r3 >> ``` >> >> when the MVE ACLE instead gives a different instruction sequence of: >> ``` >> < Rt is the *carry input > >> VMRS Rs,FPSCR_nzcvqc >> BFI Rs,Rt,#29,#1 >> VMSR FPSCR_nzcvqc,Rs >> ``` >> >> the bic + orr pair is slower and it's also wrong, because, if the >> *carry input is greater than 1, then we risk overwriting the top two >> bits of the FPSCR register (the N and Z flags). >> >> This turned out to be a problem in the header file and the solution was >> to simply add a `& 1x0u` to the `*carry` input: then the compiler knows >> that we only care about the lowest bit and can optimise to a BFI. >> >> Ok for trunk? > Ok, but I think this needs testsuite coverage for the bug? > Thanks, > Kyrill So this can be seen in the new vadcq* , vsbcq* tests: ** ... ** vmrs (?:ip|fp|r[0-9]+), FPSCR_nzcvqc(?: @.*|) ** ... ** bfi (?:ip|fp|r[0-9]+), (?:ip|fp|r[0-9]+), #29, #1(?: @.*|) ** ... ** vmsr FPSCR_nzcvqc, (?:ip|fp|r[0-9]+)(?: @.*|) ** ... The fact that there's a BFI there rather than the BIC + ORR shows that this has now been optimised by the compiler and the bug isn't present in those intrinsics any longer... Sorry, I should have linked that in better in our patch series! Added a runtest, also, as it was fairly trivial to write it out :) Thanks, Stam > >> Thanks, >> Stam Markianos-Wright >> >> gcc/ChangeLog: >> >> * config/arm/arm_mve.h (__arm_vadcq_s32): Fix arithmetic. >> (__arm_vadcq_u32): Likewise. >> (__arm_vadcq_m_s32): Likewise. >> (__arm_vadcq_m_u32): Likewise. >> (__arm_vsbcq_s32): Likewise. >> (__arm_vsbcq_u32): Likewise. >> (__arm_vsbcq_m_s32): Likewise. >> (__arm_vsbcq_m_u32): Likewise. >> --- >> gcc/config/arm/arm_mve.h | 16 ++++++++-------- >> 1 file changed, 8 insertions(+), 8 deletions(-) >> >> diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h >> index 1262d668121..8778216304b 100644 >> --- a/gcc/config/arm/arm_mve.h >> +++ b/gcc/config/arm/arm_mve.h >> @@ -16055,7 +16055,7 @@ __extension__ extern __inline int32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vadcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> int32x4_t __res = __builtin_mve_vadcq_sv4si (__a, __b); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16065,7 +16065,7 @@ __extension__ extern __inline uint32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vadcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> uint32x4_t __res = __builtin_mve_vadcq_uv4si (__a, __b); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16075,7 +16075,7 @@ __extension__ extern __inline int32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vadcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, >> unsigned * __carry, mve_pred16_t __p) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> int32x4_t __res = __builtin_mve_vadcq_m_sv4si (__inactive, __a, __b, __p); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16085,7 +16085,7 @@ __extension__ extern __inline uint32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vadcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, >> unsigned * __carry, mve_pred16_t __p) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> uint32x4_t __res = __builtin_mve_vadcq_m_uv4si (__inactive, __a, __b, >> __p); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16131,7 +16131,7 @@ __extension__ extern __inline int32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16141,7 +16141,7 @@ __extension__ extern __inline uint32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16151,7 +16151,7 @@ __extension__ extern __inline int32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, >> unsigned * __carry, mve_pred16_t __p) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, __p); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> @@ -16161,7 +16161,7 @@ __extension__ extern __inline uint32x4_t >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) >> __arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, >> unsigned * __carry, mve_pred16_t __p) >> { >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | (*__carry << 29)); >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); >> uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, >> __p); >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; >> return __res; >> -- >> 2.25.1
> -----Original Message----- > From: Stam Markianos-Wright <Stam.Markianos-Wright@arm.com> > Sent: Wednesday, May 3, 2023 1:19 PM > To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Andrea Corallo > <Andrea.Corallo@arm.com>; gcc-patches@gcc.gnu.org > Cc: Richard Earnshaw <Richard.Earnshaw@arm.com> > Subject: Re: [PATCH 04/10] arm: Stop vadcq, vsbcq intrinsics from overwriting > the FPSCR NZ flags > > > On 28/04/2023 17:45, Kyrylo Tkachov wrote: > > Hi Andrea, Stam, > > > >> -----Original Message----- > >> From: Andrea Corallo <andrea.corallo@arm.com> > >> Sent: Friday, April 28, 2023 12:30 PM > >> To: gcc-patches@gcc.gnu.org > >> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw > >> <Richard.Earnshaw@arm.com>; Stam Markianos-Wright > <Stam.Markianos- > >> Wright@arm.com> > >> Subject: [PATCH 04/10] arm: Stop vadcq, vsbcq intrinsics from overwriting > the > >> FPSCR NZ flags > >> > >> From: Stam Markianos-Wright <stam.markianos-wright@arm.com> > >> > >> Hi all, > >> > >> We noticed that calls to the vadcq and vsbcq intrinsics, both of > >> which use __builtin_arm_set_fpscr_nzcvqc to set the Carry flag in > >> the FPSCR, would produce the following code: > >> > >> ``` > >> < r2 is the *carry input > > >> vmrs r3, FPSCR_nzcvqc > >> bic r3, r3, #536870912 > >> orr r3, r3, r2, lsl #29 > >> vmsr FPSCR_nzcvqc, r3 > >> ``` > >> > >> when the MVE ACLE instead gives a different instruction sequence of: > >> ``` > >> < Rt is the *carry input > > >> VMRS Rs,FPSCR_nzcvqc > >> BFI Rs,Rt,#29,#1 > >> VMSR FPSCR_nzcvqc,Rs > >> ``` > >> > >> the bic + orr pair is slower and it's also wrong, because, if the > >> *carry input is greater than 1, then we risk overwriting the top two > >> bits of the FPSCR register (the N and Z flags). > >> > >> This turned out to be a problem in the header file and the solution was > >> to simply add a `& 1x0u` to the `*carry` input: then the compiler knows > >> that we only care about the lowest bit and can optimise to a BFI. > >> > >> Ok for trunk? > > Ok, but I think this needs testsuite coverage for the bug? > > Thanks, > > Kyrill > > So this can be seen in the new vadcq* , vsbcq* tests: > > ** ... > ** vmrs (?:ip|fp|r[0-9]+), FPSCR_nzcvqc(?: @.*|) > ** ... > ** bfi (?:ip|fp|r[0-9]+), (?:ip|fp|r[0-9]+), #29, #1(?: @.*|) > ** ... > ** vmsr FPSCR_nzcvqc, (?:ip|fp|r[0-9]+)(?: @.*|) > ** ... > > The fact that there's a BFI there rather than the BIC + ORR shows > that this has now been optimised by the compiler and the bug isn't > present in those intrinsics any longer... Sorry, I should have linked > that in better in our patch series! > > Added a runtest, also, as it was fairly trivial to write it out :) Ok. Thanks, Kyrill > > Thanks, > Stam > > > > >> Thanks, > >> Stam Markianos-Wright > >> > >> gcc/ChangeLog: > >> > >> * config/arm/arm_mve.h (__arm_vadcq_s32): Fix arithmetic. > >> (__arm_vadcq_u32): Likewise. > >> (__arm_vadcq_m_s32): Likewise. > >> (__arm_vadcq_m_u32): Likewise. > >> (__arm_vsbcq_s32): Likewise. > >> (__arm_vsbcq_u32): Likewise. > >> (__arm_vsbcq_m_s32): Likewise. > >> (__arm_vsbcq_m_u32): Likewise. > >> --- > >> gcc/config/arm/arm_mve.h | 16 ++++++++-------- > >> 1 file changed, 8 insertions(+), 8 deletions(-) > >> > >> diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h > >> index 1262d668121..8778216304b 100644 > >> --- a/gcc/config/arm/arm_mve.h > >> +++ b/gcc/config/arm/arm_mve.h > >> @@ -16055,7 +16055,7 @@ __extension__ extern __inline int32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vadcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> int32x4_t __res = __builtin_mve_vadcq_sv4si (__a, __b); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16065,7 +16065,7 @@ __extension__ extern __inline uint32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vadcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> uint32x4_t __res = __builtin_mve_vadcq_uv4si (__a, __b); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16075,7 +16075,7 @@ __extension__ extern __inline int32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vadcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, > >> unsigned * __carry, mve_pred16_t __p) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> int32x4_t __res = __builtin_mve_vadcq_m_sv4si (__inactive, __a, __b, > __p); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16085,7 +16085,7 @@ __extension__ extern __inline uint32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vadcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t > __b, > >> unsigned * __carry, mve_pred16_t __p) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> uint32x4_t __res = __builtin_mve_vadcq_m_uv4si (__inactive, __a, __b, > >> __p); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16131,7 +16131,7 @@ __extension__ extern __inline int32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16141,7 +16141,7 @@ __extension__ extern __inline uint32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16151,7 +16151,7 @@ __extension__ extern __inline int32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, > >> unsigned * __carry, mve_pred16_t __p) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, > __p); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> @@ -16161,7 +16161,7 @@ __extension__ extern __inline uint32x4_t > >> __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > >> __arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t > __b, > >> unsigned * __carry, mve_pred16_t __p) > >> { > >> - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | (*__carry << 29)); > >> + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & > >> ~0x20000000u) | ((*__carry & 0x1u) << 29)); > >> uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, > >> __p); > >> *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > >> return __res; > >> -- > >> 2.25.1
diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index 1262d668121..8778216304b 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -16055,7 +16055,7 @@ __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vadcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); int32x4_t __res = __builtin_mve_vadcq_sv4si (__a, __b); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16065,7 +16065,7 @@ __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vadcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); uint32x4_t __res = __builtin_mve_vadcq_uv4si (__a, __b); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16075,7 +16075,7 @@ __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vadcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); int32x4_t __res = __builtin_mve_vadcq_m_sv4si (__inactive, __a, __b, __p); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16085,7 +16085,7 @@ __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vadcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); uint32x4_t __res = __builtin_mve_vadcq_m_uv4si (__inactive, __a, __b, __p); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16131,7 +16131,7 @@ __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16141,7 +16141,7 @@ __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16151,7 +16151,7 @@ __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, __p); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res; @@ -16161,7 +16161,7 @@ __extension__ extern __inline uint32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) { - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | (*__carry << 29)); + __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, __p); *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; return __res;