From patchwork Wed Jun 28 13:48:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 113912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8944092vqr; Wed, 28 Jun 2023 06:56:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sZUNRZNU/niOFuA5qYrPucXmb5z2y3ZqRr+UwFPVD4e/ZxylgJXVvQdJaHc5oO8mlqayO X-Received: by 2002:a17:907:3e16:b0:978:a186:464f with SMTP id hp22-20020a1709073e1600b00978a186464fmr34967064ejc.39.1687960592154; Wed, 28 Jun 2023 06:56:32 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y16-20020a1709064b1000b009920ac3783asi2337816eju.538.2023.06.28.06.56.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 06:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ddypw26w; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90E973857016 for ; Wed, 28 Jun 2023 13:52:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90E973857016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687960369; bh=qmXXgwqISllIw+ZdmmdrMmMzSrFzYmmD11M/Fwh+C34=; h=Date:To:Cc:Subject:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ddypw26wNVmot+PwP03H0aJl0ZOG9uGw1v+6/ATJC2eiQim1/lqDBMkqcYiF9FqyF m6KLQjJsGnNyXFocd7bAg3MqiIBJyXEa2iRAyb5I1Rvjeqc4fpwhyOE5BvP85bLgNK HvJzRD61kAMpNDbspoRYhzBZCyoSahHS4UZHd2uA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2082.outbound.protection.outlook.com [40.107.14.82]) by sourceware.org (Postfix) with ESMTPS id 7CA29385C6F7 for ; Wed, 28 Jun 2023 13:48:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CA29385C6F7 Received: from AM0PR10CA0087.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::40) by AS8PR08MB7744.eurprd08.prod.outlook.com (2603:10a6:20b:508::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 13:48:46 +0000 Received: from AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:15:cafe::29) by AM0PR10CA0087.outlook.office365.com (2603:10a6:208:15::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.34 via Frontend Transport; Wed, 28 Jun 2023 13:48:46 +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 AM7EUR03FT031.mail.protection.outlook.com (100.127.140.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.18 via Frontend Transport; Wed, 28 Jun 2023 13:48:46 +0000 Received: ("Tessian outbound 52217515e112:v142"); Wed, 28 Jun 2023 13:48:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1ab77b1de9879ba4 X-CR-MTA-TID: 64aa7808 Received: from acbc0cdf4396.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5E1281A8-8CB0-451D-A7FB-44982C5BEC9C.1; Wed, 28 Jun 2023 13:48:39 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id acbc0cdf4396.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 28 Jun 2023 13:48:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gqk8KPI/Z4p43a0utj204atgFkFMUaSQYQEXqrDPR7+jhPKsfiGgekPB0ffjG4QfGlkcIa8tyKQArc7E9wY5afv3zPnhpzMrKwr2FpoujQjka0EIs9zxL/lMIO+1MIrg4MTg7FjG7kFu70TQcaYXi1bGFLIFJ9ROy4DyPbkAsRv6pvNd/g+6+rOLK0iBi4xziFVpW2KiY9ghwhmIWXuVDXEjTZJLh0fotZGAM5jgfun2DUEcnD5gjXwnkWxaabhvL8v2hj2I8UTo4+0jIDNAQeZUIQABo9U8ek+yvZ0RSJ/F2VUXso63jHjc9LPidH8OTqOUv4iMsYWKLinlxQzDSA== 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=qmXXgwqISllIw+ZdmmdrMmMzSrFzYmmD11M/Fwh+C34=; b=nwZTJTo/zguxGvHGwOxP9Q/wQFVjN4lyDj3eeAsPWtus5FvX0OvXZ3MEDE7CYRiZRu0aZTp4jbrtfRJBRbpiiu5ffY0ML1q54OlJON9inPVzZUXWLSssXRYeHVQNjb3meKmNnRvrwqdhwDlgmsJAscqiw0WTgKeeTLGHnLXpfN3CONssusy3H0Gkvd/FySJ9w/3ozpfsIi6ugN0wxmjGXiWGiyft6DiYk3R6Oi8qmXsehZUnGxcx9iNos9S7et1u3wRFHtQb2zD9V68o8FX8fAhjzBrpkJx3IBnuHtylzqMMFeHXqBW8VWnWxRZJc9vRtdUM3LiuwYa7h6R7XGIXyA== 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 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by AM7PR08MB5398.eurprd08.prod.outlook.com (2603:10a6:20b:103::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Wed, 28 Jun 2023 13:48:37 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::2301:1cde:cfe7:eaf0]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::2301:1cde:cfe7:eaf0%6]) with mapi id 15.20.6521.026; Wed, 28 Jun 2023 13:48:37 +0000 Date: Wed, 28 Jun 2023 14:48:30 +0100 To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, Richard.Earnshaw@arm.com, Marcus.Shawcroft@arm.com, Kyrylo.Tkachov@arm.com, richard.sandiford@arm.com Subject: [PATCH 16/19]AArch64 Add optimization for vector != cbranch fed into compare with 0 for Advanced SIMD Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SA1P222CA0067.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2c1::17) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AM7PR08MB5398:EE_|AM7EUR03FT031:EE_|AS8PR08MB7744:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d16ae57-6802-475b-edce-08db77de64d2 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: XBK6HxEQDWFQOSFDOXXly0VRqaHJmMlQ1RCglaanALoAJr1G2yxqmdVRxTWybW8KPQcqhplFXo0AZgbaFAoyc9KTKliyaTvJoetUwzLoIhm5wT8iOzX56kBZJivz+d904pUMs9BIKiccZzq1poZC0NgiXEHYoY2exLWQestlICjW+XcB7SXLpRQQmk/z9dbmaQr73W7wK/FwzNYNcqUgGFcVnDsQzj706dssXitmMFGrmdp8CgXaq7WR6d6nZ6TiTiPlvV66KOmegXqmZi6uVDJaTOoPAayuMs552zcyUmmeG0AbScJhskbWkyHncrfhaEjEg3A8qTugn/NgAbi0GxZLGRmHw4lFiSvemtbnd2c94cSjS4R2W6xZXGJsAayMmapYM80Sx5im6HHseWitGi8cflXXcAi9tY7ckumgkiXK9vA8b8QxTW8GnuegRsEs2uEVe3Y+xhxU9TIx18zyaKvaVc+61j3x/4GzvotTCuDzkyGMJ0FejKuiuLbtD2O58+lMVr9+U2mwi0o5q/Mf8lZ1Z1p4Ujll8QTzbPNv4lIExtsz2q8eo0uxhr9VLsaFidsV7icda9i3KNmiyhXLll6+kn/51hwSFkQkhF+glj8= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(39860400002)(366004)(396003)(451199021)(6486002)(4743002)(33964004)(26005)(2616005)(478600001)(6666004)(186003)(2906002)(6506007)(44144004)(5660300002)(44832011)(36756003)(316002)(235185007)(8676002)(66946007)(41300700001)(38100700002)(4326008)(86362001)(6916009)(66476007)(66556008)(8936002)(6512007)(84970400001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5398 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 97e6e130-736c-4568-72d9-08db77de5f9f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CzX4A9iZGNfJ61ZzaeiRGwNt+0GAEtt4Unsg+4fTlVYQAlaI995BdedvF69IjcBeRsanJJ35ozDQqX4jynbsGN1G4ocJGrr5YNpIFBjNqudOHJeQ+HBa81NntljGS3EgK+KSt2zs/7Df2Unc5MR4LHlBmT0gkIVQKG5qnPSv1zBBDXzzbcTG0Me8MLXthHcQGPAps36AEBoDiotyFrS+/m710kpTxmj7zt1296t4cowXJjDeU40wtwWPJVJNTfSnRbtQzvoAuOc/zpfy7YiJzkvvbl7UnJSmhX7S3a+uyTUfkf+LtlAlbCEKIJ5jWPBjlSnfquHo2SNW6TrB4hsFUnh426ryKOg931G0u+ipVf5t26oAe8h2hPc5Nxtyf3gmb+RwsPpj7vnGgwYszlwwZQDnxKke2RZhXibWCV7FYJjjNq+n7dvEroYCeVbuWerT0oUpDDv8YWOe6LfjJ4OARUBr1zt0KXb7KGBItorv9XXtd8Wt1IPN0o3Pd7vqY1NUagth1NTEvmhLYwG6N9KcnnM0XrAm+SGQXrtE3AR09063sR5feXazMieCjuYqXDMv5Q+sPvBYJMytfalyr8+W3PaqHWxalnNgcbvUwOo+aBqdx1ky/uHyxN+lMwj2aPJp8aTdjN32LaiS/1rCMPWucHw7JMNo7kaEwq8w4pwS8+ZZ/TnOl19JI+yIAbs8Optg1sedGj+6o6ZSIq7tB4ZAPDZi9FLx1oxRrc1ptYLm/4ziwYPPAgk6nWcHCSnURK9w 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)(39860400002)(136003)(346002)(396003)(376002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(2906002)(6486002)(82310400005)(33964004)(2616005)(4743002)(44144004)(6666004)(356005)(186003)(6512007)(82740400003)(86362001)(81166007)(26005)(47076005)(36860700001)(40480700001)(41300700001)(478600001)(36756003)(316002)(70206006)(4326008)(6916009)(70586007)(6506007)(44832011)(336012)(5660300002)(235185007)(84970400001)(8936002)(8676002)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 13:48:46.0422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d16ae57-6802-475b-edce-08db77de64d2 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: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7744 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769954965738488837?= X-GMAIL-MSGID: =?utf-8?q?1769954965738488837?= Hi All, Advanced SIMD lacks a cmpeq for vectors, and unlike compare to 0 we can't rewrite to a cmtst. This operation is however fairly common, especially now that we support early break vectorization. As such this adds a pattern to recognize the negated any comparison and transform it to an all. i.e. any(~x) => all(x) and invert the branches. For e.g. void f1 (int x) { for (int i = 0; i < N; i++) { b[i] += a[i]; if (a[i] != x) break; } } We currently generate: cmeq v31.4s, v30.4s, v29.4s not v31.16b, v31.16b umaxp v31.4s, v31.4s, v31.4s fmov x5, d31 cbnz x5, .L2 and after this patch: cmeq v31.4s, v30.4s, v29.4s uminp v31.4s, v31.4s, v31.4s fmov x5, d31 cbz x5, .L2 Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * config/aarch64/aarch64-simd.md (*cbranchnev4si): New. gcc/testsuite/ChangeLog: * gcc.target/aarch64/vect-early-break-cbranch_2.c: New test. --- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index cd5ec35c3f53028f14828bd70a92924f62524c15..b1a2c617d7d4106ab725d53a5d0b5c2fb61a0c78 100644 --- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index cd5ec35c3f53028f14828bd70a92924f62524c15..b1a2c617d7d4106ab725d53a5d0b5c2fb61a0c78 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -3870,6 +3870,37 @@ (define_expand "cbranch4" DONE; }) +;; Avdanced SIMD lacks a vector != comparison, but this is a quite common +;; operation. To not pay the penalty for inverting == we can map our any +;; comparisons to all i.e. any(~x) => all(x). +(define_insn_and_split "*cbranchnev4si" + [(set (pc) + (if_then_else + (ne (subreg:DI + (unspec:V4SI + [(not:V4SI (match_operand:V4SI 0 "register_operand" "w")) + (not:V4SI (match_dup 0))] + UNSPEC_UMAXV) 0) + (const_int 0)) + (label_ref (match_operand 1 "")) + (pc))) + (clobber (match_scratch:DI 2 "=w"))] + "TARGET_SIMD" + "#" + "&& true" + [(set (match_dup 2) + (unspec:V4SI [(match_dup 0) (match_dup 0)] UNSPEC_UMINV)) + (set (pc) + (if_then_else + (eq (subreg:DI (match_dup 2) 0) + (const_int 0)) + (label_ref (match_dup 1)) + (pc)))] +{ + if (can_create_pseudo_p ()) + operands[2] = gen_reg_rtx (V4SImode); +}) + ;; Patterns comparing two vectors to produce a mask. (define_expand "vec_cmp" diff --git a/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c new file mode 100644 index 0000000000000000000000000000000000000000..e81027bb50138be627f4dfdffb1557893a5a7723 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ + +#pragma GCC target "+nosve" + +#define N 640 +int a[N] = {0}; +int b[N] = {0}; + + +/* +** f1: +** ... + cmeq v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s + uminp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s + fmov x[0-9]+, d[0-9]+ + cbz x[0-9]+, \.L[0-9]+ +** ... +*/ +void f1 (int x) +{ + for (int i = 0; i < N; i++) + { + b[i] += a[i]; + if (a[i] != x) + break; + } +} --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -3870,6 +3870,37 @@ (define_expand "cbranch4" DONE; }) +;; Avdanced SIMD lacks a vector != comparison, but this is a quite common +;; operation. To not pay the penalty for inverting == we can map our any +;; comparisons to all i.e. any(~x) => all(x). +(define_insn_and_split "*cbranchnev4si" + [(set (pc) + (if_then_else + (ne (subreg:DI + (unspec:V4SI + [(not:V4SI (match_operand:V4SI 0 "register_operand" "w")) + (not:V4SI (match_dup 0))] + UNSPEC_UMAXV) 0) + (const_int 0)) + (label_ref (match_operand 1 "")) + (pc))) + (clobber (match_scratch:DI 2 "=w"))] + "TARGET_SIMD" + "#" + "&& true" + [(set (match_dup 2) + (unspec:V4SI [(match_dup 0) (match_dup 0)] UNSPEC_UMINV)) + (set (pc) + (if_then_else + (eq (subreg:DI (match_dup 2) 0) + (const_int 0)) + (label_ref (match_dup 1)) + (pc)))] +{ + if (can_create_pseudo_p ()) + operands[2] = gen_reg_rtx (V4SImode); +}) + ;; Patterns comparing two vectors to produce a mask. (define_expand "vec_cmp" diff --git a/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c new file mode 100644 index 0000000000000000000000000000000000000000..e81027bb50138be627f4dfdffb1557893a5a7723 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch_2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ + +#pragma GCC target "+nosve" + +#define N 640 +int a[N] = {0}; +int b[N] = {0}; + + +/* +** f1: +** ... + cmeq v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s + uminp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s + fmov x[0-9]+, d[0-9]+ + cbz x[0-9]+, \.L[0-9]+ +** ... +*/ +void f1 (int x) +{ + for (int i = 0; i < N; i++) + { + b[i] += a[i]; + if (a[i] != x) + break; + } +}