From patchwork Fri Dec 17 10:04:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 49046 Return-Path: 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 75F2C3858005 for ; Fri, 17 Dec 2021 10:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75F2C3858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639735626; bh=dKis5F3p7XberoigHnztivFpxbWIEFCxqniwB1NTsIM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=TgtwoUy5IXJl0pBqLeKZTs/eVQ2u60iZ6S202PkavhqwK9IvqyQhmli+cW62aQmP4 gbn8Pxjd9Rq/ZzTjODcSDJPfZBgvutY7M6eM+ScXo8i5TG4sqb5CbMu0mA/v/7Zi48 /llb7TFwkzjAIpB7CJc6+9OvnUl8wGJDhth3vVgs= 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-eopbgr70082.outbound.protection.outlook.com [40.107.7.82]) by sourceware.org (Postfix) with ESMTPS id AB58B385801D for ; Fri, 17 Dec 2021 10:04:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AB58B385801D Received: from AM7PR04CA0005.eurprd04.prod.outlook.com (2603:10a6:20b:110::15) by DB6PR08MB2647.eurprd08.prod.outlook.com (2603:10a6:6:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.19; Fri, 17 Dec 2021 10:04:47 +0000 Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::c1) by AM7PR04CA0005.outlook.office365.com (2603:10a6:20b:110::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 10:04:47 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT006.mail.protection.outlook.com (10.152.16.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Fri, 17 Dec 2021 10:04:47 +0000 Received: ("Tessian outbound a33f292be81b:v110"); Fri, 17 Dec 2021 10:04:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7dfa94209b558d24 X-CR-MTA-TID: 64aa7808 Received: from 25ec50cbf904.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9094F49A-1644-4123-9FFC-1EF7ACBEE122.1; Fri, 17 Dec 2021 10:04:28 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 25ec50cbf904.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 17 Dec 2021 10:04:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M9Tb7of+qd868Kuy+en7At3LFJPYy5v/APCfW5xzWGk/qQxgq2Xf9GFg9rCvc8X3Yp53eAWYEHTddgg82SRob579iqSH5eTUKdvWb/W61cfclsjAHOhuK5Z9YzWdDbc/wfcTDCQqRKyHRKzASbP2mu/9eZmgFczWpiINJQCoBXROujpUoeiKl6sRPmnLXhZWsFO9vlrZJm9KIjSnFx4D91pLz8UGiEmSIdAnMEdHGu/6exJmh8weaHaFOfHTsedXAC7bCsDPpUEpx0M+mMuTKRrbP/7V2POy3LCk0/5KLWwRsECmUyZQODtpRKr7ViXQ9pfMXXYJGS5pUc0VVcpIpQ== 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=dKis5F3p7XberoigHnztivFpxbWIEFCxqniwB1NTsIM=; b=IEeY39CzXSGokpI+GOcIh18Gb+vIaAXNLftuJkYZrt/zjHX5f1jK2F3KxRwGelaq/mgREZhy7vBiw500vb2TCszi+atCBuY8nH8mECEjUqwmtAwmgObo+XGqSsugwwpbJYnWHVGrYPViJ/08iMowWu/I1qds0XskuR7BhDCUUGDCrV60+GgEjez59vdgM5F0V2UqYd95AmZl3Q2npC0w2LucSJr+oXXOdUDPoStycRM5FKhsKRSG/Yun3R07aovX0VVlSnLsb9paH3xvaGYaizzlbFKq49oI1yl5HBkAfgRa6M8fR/yn+7OVi0L7sIbktjQMQSoCiWOt2Vscj1gdxg== 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 VE1PR08MB4862.eurprd08.prod.outlook.com (2603:10a6:802:a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Fri, 17 Dec 2021 10:04:25 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::12a:3d2c:81ff:8fcc%8]) with mapi id 15.20.4778.018; Fri, 17 Dec 2021 10:04:24 +0000 Date: Fri, 17 Dec 2021 10:04:22 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH]middle-end slp: check that the operation we're combing is a boolean operation [PR103741] Message-ID: Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO4P123CA0368.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::13) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9d51e658-6d6f-4feb-1ebf-08d9c144a878 X-MS-TrafficTypeDiagnostic: VE1PR08MB4862:EE_|AM5EUR03FT006:EE_|DB6PR08MB2647:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: OnROFQW3Jkq+H75Wc2/YfNOcwk4c54B2Ir8w4TeDb7W+WxpBkRAwsoB2o6ZTdEBmoadZDbXZPKXi345DUv5kfdoPx5DI0gsWyphbYez5m6mwrE85Fg+Py984iVsx2WQLCwCW7ODYUEt0OhbSR7HfoSajkIGp4aEm6jYcAm2mz/3+hwLInMWLhLvigvbLOpTrBB+r8OUsJsBFcHHZw53oa36OkzyCZAo+EEYtAZGhuITS7Rq2oAKchchl+W+Ok43jS0b2ptG55SttxvqdrLgw/VIhGIdndqooXF/AbZPI7v6vo3CTqS+lCAU9b5slsaYrSS/90F6FXpX1Y/p7QaxOorHWabiSe9Kuw5mWOm9/R0kn88KKPUcsx8B1ZE4QJF6duVACE9dcm/22M09FG9hoGjPvd8qh3pA6YsNaVdk8oMcOX2Gz7Firw/kObojcVBTCdwlZDSEuS1pIsi0zwyS8/aDElS56dIkt4o4BxatIXJ63rIrxapMoSgi9i131e7JgsQxjTyJS/+cHhdy//q0/HGs7TA1QvoluYg978pMr3oDIBTAM/Kr5CxB/3e9wNfr4N41a69znBcGTvmn+a7316w8CwsszZLi0ASYEMcHz1Y31L2J58VSD7S3h954YUHyANYJTvbApXSNqFhYNou7bYiLK8qvpiP/Oid4gwC0cU7B7r0U+3RLt64K1RLKia8MOwaaDcvSj56UJ+Sfz8YcpnzqUtZ6skwmIiW7AEZDyFf/BhlMMpleO7H1waz6Uo/2512MTa9OmO28p9dUvuFgM+A6VB8/T046oJs7H/2mhB0FldBVdbPDfZqTLf6tgjzYXipaADwKWC6MDsIvd1a2xfHnMBcEwsZndvRLjpxmRZkc= 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:(4636009)(366004)(508600001)(6486002)(38100700002)(44144004)(36756003)(186003)(5660300002)(6512007)(235185007)(6506007)(2616005)(38350700002)(4326008)(26005)(66476007)(8936002)(66946007)(33964004)(66556008)(44832011)(8676002)(6916009)(84970400001)(52116002)(86362001)(316002)(2906002)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4862 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: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 17213a47-62db-4e5a-b5ae-08d9c1449ab7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WSPhBe9b5jkngAJd06cM67EB1gE4CSE77BqHzKXLaqBS0NsGKCTINB3UknSnkc7kfHxVjFCUu4SKKcDftbMeL/u3RZ8Nij9XkuEqbR7GKhNW1kAdY6dBwIzCjS5MSA+Fd0Cv6XFxo7AVNdlxG8x7YlNfd6GniSHSLuwJbnshJjZ63yYMhlGEJV2wpicxPhtWxF8r1dySFoUf/459P4hylRp+v+4f1lDbxQLxA6hrbnDwyJY61vto8N6cj/SIqE6EBjslXbh9/oz5FPr908EdVgikOl6+X0rh9kEc5n5MBribUuJbg7/1DBtGINFKk889S87/MX5zmpxNWYuGIeDegKMrnsTH1udsPTZSm632ltrnFLzzkM+KOeH/sKLFqgIhB8QlFBcKx0DM7Bhi2mmD6iotvHAj3y/WHLOPzbEbfxF3TJu5j57zNL3NtqHyu+4QRmS5mCU930IA8wHWVi2d8IKB6S0etLRItv5+Tf6ZnLCvWs1Mff67TuUx5UkFf0iZUuRmU6SBDwK83/Gm2XEKkzxPlqk6YCK8wTLRTkca5vNOjeZiSMWinCiNET0AEfJjxIIkiAq+S46b0gFbHvgpFUa2cGUpOWSC9VPR1fXrlzhCLsMMI8xl+/fJwo3s+rYgNglaTZL0gTeJRO6f+hUfA8kRBqb6aq4lBMAIJ7OZHZxrQL79wMDen1zs/MC/OUQVSq+L+2B9TgZPQ+2pxo1MN43KGPh68Z1NcFjdseWBF57+k3qTsdrG3K5nKRh4IOQbKpkBUgD7nUf+aUqeNAeWDfc//6lLdSzTOqHNL0zu46cdhn1DkjlraTRB9qSnLvjquGPJ95aEnVoxURhlJvEZHfmhxE5AH6UFRMoZAS9LLJH/gv1LTzpX8pUNX3CHuL44d7IWf+mtManyQEeKI1SW5g== 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:(4636009)(46966006)(36840700001)(40470700001)(8676002)(84970400001)(40460700001)(8936002)(5660300002)(2616005)(235185007)(82310400004)(70206006)(86362001)(336012)(44832011)(2906002)(4326008)(36860700001)(70586007)(186003)(81166007)(316002)(356005)(6486002)(26005)(44144004)(33964004)(6512007)(47076005)(6506007)(36756003)(6916009)(508600001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 10:04:47.7392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d51e658-6d6f-4feb-1ebf-08d9c144a878 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: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2647 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 Cc: richard.sandiford@arm.com, nd@arm.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, It seems I forgot to check that the operation we're combing when masking the predicated together are actually predicates types. Without it we end up accidentally trying to combine a value and a mask. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: PR tree-optimization/103741 * tree-vect-stmts.c (vectorizable_operation): Check for boolean. gcc/testsuite/ChangeLog: PR tree-optimization/103741 * gcc.target/aarch64/pr103741.c: New test. --- inline copy of patch -- diff --git a/gcc/testsuite/gcc.target/aarch64/pr103741.c b/gcc/testsuite/gcc.target/aarch64/pr103741.c new file mode 100644 index 0000000000000000000000000000000000000000..ef3ae66ebe5e5a44e7bea7be22b6378bc23cc538 diff --git a/gcc/testsuite/gcc.target/aarch64/pr103741.c b/gcc/testsuite/gcc.target/aarch64/pr103741.c new file mode 100644 index 0000000000000000000000000000000000000000..ef3ae66ebe5e5a44e7bea7be22b6378bc23cc538 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr103741.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=armv8-a+sve -O1" } */ + +long int m, n; + +int +qux (int z) +{ + return 4 >> z ? z : 0; +} + +int +bar (long int y) +{ + return y ? 3 : 2; +} + +__attribute__ ((simd)) int +foo (int x) +{ + long int a = x & m; + int b = bar (x) / n; + + return qux (b) == a; +} + diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8c427174b37e6c03c2f914c90332bcc4eac54130..ad90cdb0473a337207d6ba54c1dd0a2ecc50ab8d 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -6361,7 +6361,9 @@ vectorizable_operation (vec_info *vinfo, /* When combining two masks check if either of them is elsewhere combined with a loop mask, if that's the case we can mark that the new combined mask doesn't need to be combined with a loop mask. */ - if (masked_loop_p && code == BIT_AND_EXPR) + if (masked_loop_p + && code == BIT_AND_EXPR + && VECTOR_BOOLEAN_TYPE_P (vectype)) { if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, ncopies}))