From patchwork Mon Nov 14 20:08:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1703754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=YUUM49bj; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NB0kp3FH9z23lt for ; Tue, 15 Nov 2022 07:09:04 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93A41382D39C for ; Mon, 14 Nov 2022 20:09:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93A41382D39C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668456542; bh=1xDIZ0FJ4RbDwf0W5eLobGDtc6G3Ke67fKlV3xXjU8c=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=YUUM49bjoL5n2HZLl9VwBbpxUKA9LoFNBchemQWFKxxcuybGFsggC/Q+95PAeCA13 xYLxrpK0OBs5Dcx+2uouMFxeX7IS3tTXypViqXkHHw3WuvuOqN26UeAVDfAr9NF8s6 WzhmJ+w17s+5Ey1XteeM8TQ4vbDNP/VCNCfXhYP8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) by sourceware.org (Postfix) with ESMTPS id D72CA3858421 for ; Mon, 14 Nov 2022 20:08:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D72CA3858421 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=LtwFFIWNWc/T8xiqAcv/QtaiSyx5BehFBhQsoGxfhu8fucugdzEViZbr5uJg7UqwHP/1CphFUAIfKNWd0fenstCFZOMM4Gg9vq9vYtn3gDIZM7O2wnw/z3bvdnHdVp7MN0MxhyEbfolwQvYt/GEdkFrgAAmeogo/mqep+MiiWqNX+yg+uvZuLBZ+4p5aiNPBO5BwpocFTuieQ2NQwbT4O+UmJvYI9Nc5mJm3GYvei1ZFfSsgwHnlPN2ZSG6Nla6PRgC0JhuE68qkDRztd2tbGp8G0MU/QTxg3Uu1ZFxA+qCE4jOvaROE5cAGxBDj5QTPViBTtaIBCcIXxUW1TzL2ew== ARC-Message-Signature: i=2; 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=1xDIZ0FJ4RbDwf0W5eLobGDtc6G3Ke67fKlV3xXjU8c=; b=WLLgQfMOv/5JggFzbo+9hygiVjscsnqNXIDzEnzlGc97DhUi3Ui9mdaEYAowVxkCApd9EK/udQlRXod7veaDqsv53Pyzu3OpNPrjwXpNf+AuBxtq8SebnEO5TNpr+MZVJZe4bkI8VefDFaD69r1aBbo31o44snK7ZxFXGMSBWmYQ+XE7mAwmNW4znH0dVZp0gYxt0RyMLOADG5Ck6wI5mP32wxRPxeZ+om3oDJM6if67h2u6Q8vZaxZGFCCXuEQZf4lkYP+6g0zP+aSF5NpZSlsGNCMhRT3mKhbBuyxbxfMG8DChkwEXO/xKaTqwJvnS/DmYRAwwo9FMMcImVP/ZVQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AS9PR01CA0005.eurprd01.prod.exchangelabs.com (2603:10a6:20b:540::15) by AM8PR08MB5730.eurprd08.prod.outlook.com (2603:10a6:20b:1d5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.7; Mon, 14 Nov 2022 20:08:34 +0000 Received: from AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:540:cafe::45) by AS9PR01CA0005.outlook.office365.com (2603:10a6:20b:540::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17 via Frontend Transport; Mon, 14 Nov 2022 20:08:34 +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 AM7EUR03FT022.mail.protection.outlook.com (100.127.140.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12 via Frontend Transport; Mon, 14 Nov 2022 20:08:33 +0000 Received: ("Tessian outbound 58faf9791229:v130"); Mon, 14 Nov 2022 20:08:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c026e710d1c1a980 X-CR-MTA-TID: 64aa7808 Received: from 52a835207f93.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1DDBCD3A-5271-42AB-9BF1-07013352C977.1; Mon, 14 Nov 2022 20:08:24 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 52a835207f93.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Nov 2022 20:08:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F2WbC9DK7YqIlTzhZawzMh/9VuWNIFfs8at/kwmveZlVgHp36xzlud7+YSGAYqZAZX36exjkSKsnLZ56EpsIf7OPsZFok4ExjpnzAhA/HGaMjOjJd2OCWVG/BEy07U8nyH3mKF08MyQHIDs3j6U+o10hE9MKhJG2fNGBWxLY4cXjY0qMoLqgegDAq1qsiCHEt49F1MXL8y9Xv4IRfqkqeWMWn6DiZWMko+AeAbIvZuCLyFzrJwFrj5iQTQ/jcnWdQR2y1S43Spob5k+GMI4z+ChCetyZ6cgHoTLcTQ8cO/yDp8J+Ec0HC5ys0SmfJIWo5iOpXSaEgHqwOrwrOYaWjw== 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=1xDIZ0FJ4RbDwf0W5eLobGDtc6G3Ke67fKlV3xXjU8c=; b=ck7KyoThlZVf4QWeg2AXqw56VjqHAilN/ktNy1bcZZok3y4NlquqcwgW1J78WBETaHjn0MzfUgr6wLCPDvyHj+cNxNOXV66/yRASaMd+GhwY7loKJcnrBHtlKJpaWjbR61pSHiRsEEcMNYgHXQKOJ9kFc14kB8QlXNJiPinXnI2f1yc7raqWzdk2tnWxAegsolMmJwTn73bA9K8h9hUfkd/XY29HqYq1b9vppwrksQaDdBWT+zp8g1PW/tXG/6G8L1MOHree3WlqRas5kSccU1Csr6vSGuCVpU7yUl5rxwPVU0J0A7O95tv4tzWktqc2G0Y2axhyiz/KfuXo8qJl1g== 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 DB9PR08MB7607.eurprd08.prod.outlook.com (2603:10a6:10:30a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.5; Mon, 14 Nov 2022 20:08:23 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::bd2a:aff9:b1a0:2fc7]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::bd2a:aff9:b1a0:2fc7%4]) with mapi id 15.20.5834.007; Mon, 14 Nov 2022 20:08:22 +0000 Date: Mon, 14 Nov 2022 20:08:20 +0000 To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH][committed]middle-end: Fix addsub patch removing return statements Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0208.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a5::15) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DB9PR08MB7607:EE_|AM7EUR03FT022:EE_|AM8PR08MB5730:EE_ X-MS-Office365-Filtering-Correlation-Id: 048fbb5a-a84e-4f10-6c5d-08dac67c0221 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: oYq23P10S39eC7jDC2hAQO8PvL9YQ5uG1uPyX8aZMpwqSDPqGVaAWURFU7kDmvc1SSUBOhSFg95zLEAs0zaXfPAzGiWsEQDQAH9ML2J7Z7xv5oyIv50BVlAuqsFEp/RGO9E4PcTthPPpFuEus57ZfZ2daELA4b6uU5dIMLVYqdVyPvpWuzVI+exQIj525Ho1QAuNWuFw9/Z4Os11UVhRhVN6/nUorxwEGj00ezQCZTOnUB2hL7GMpdXfxIRJuD9PUovkWlgWJJN98DyMX7or+4HVylZqxdM5Ks5MqrMlcWWh83koLTX3iwbgzEPx+hYsRsaRjFR7/MpfrC1N8L7kAKrRfoBZTuP3c0IOwRk4XD81PvrpdfbU6tRDDcUqDuHo6NHj0oIms3hvj3uptxyJVJY04rUg4xQcB6jusOIEbliu8PBdJKJ5YuAk3lMKaucDYDCaLcPOtM2wzB4NR4N0jK++qzVDjTNJeDNx4FViQYKwdwEqza9j64anXP3r37U2DEjs+GEmS4CeCF5b3R7d9vGHkvmhZwRlL1zIfsB3PlQ9WGJDaoNI6gLUow6mw+uoF6NEZzDJmlaUYKCPoAEQj2ib4CWB8WtVpIqcejBimaVrs56p01fKmJBQUxgSF/BF10B6lWiBuNS7v+uChwg0emU8odJmqTwjF0iVEueJTkbDzNEQoC2Q54oSxSqOcR7Pj8lYdB16ZHY31AcsdXmXUNVvldtVNqEcoyTtJ0+VuvwXn8DqFTtVQmaaq56R7aDZ+Ei4WVe5flIKVpewGhHNnUSY4vTgquAqEIJqY+Rwx7jUQjwFR/PX/dfDg/evByqu 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:(13230022)(4636009)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199015)(478600001)(6486002)(66946007)(66476007)(36756003)(66556008)(8676002)(6916009)(316002)(4326008)(83380400001)(38100700002)(6506007)(6512007)(4743002)(33964004)(44144004)(86362001)(26005)(186003)(2616005)(8936002)(44832011)(235185007)(41300700001)(2906002)(5660300002)(4216001)(2700100001)(473944003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7607 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: AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bda37d78-bb4b-4699-0f89-08dac67bfb61 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UrNBB+fbcT6sK5lvHbQA6gp2oaHoPeK19Byt8AEFHnyP+eFOWI2qKXJkzBrYci9RmhDNqBWgJ4RZ9DuS4QOJQeA2gHaW7f0FCBVcRSRZm7/lwOvZLrxeSKarrXcsChvmOmaW7/rm8LxQqyq0Hu4NV3IFcw5yriis2uOZGDaagaEvp5rWmGtgI/Hv0o2VSpa+WjBlrdhYKiKl6vSHXRs8X0ScpRX16M6zTWSBy+WMYu0YzYAEdKULmaFKrK3WFPVHQreXqQL+MinACJ5lKyoycHxsXirvhgv5Y0juqbH0/zErE1cnPG5yUJJV1MgsD38ROHyLk9vjtSzs6urVHmDUS3UhIzlRrUrhiC/2u9NGU3cvLhs/q3/Y0mtxg11k5tlw7o6AnqWZ+wRXPUbWijhlseqJwaY0yIpbuqmuIrt9lLtFaBQSk8wA0gJN37q1KDi07ApUyWlTtM3uXR/YK6qIJiL4yK6SsYfdQfvaX5h2HgA+piCRq0l35aJThvxxBsKRqsqLPfTeGJ3lhJwCH5JDXLSJFHlGxkkMrq9VJUqD5R9MQ/aXWkTZvCZt43vQ3fx+ZjB9qfmyo1JU/FZ+G1cq4LdicIoaC8fnt/pmigG/2zckdHMQJdseGuj4rvRFYhYHyuNCmK5SiJPXZF3dtvGvBkgV3/uCkDHD8+clOjcrnJmawIbhmnrFRidVsgnSgjBFRVUyiNw8fUj49vHtfuxS6BdrTTwfguztaud5T207485U7pCC0Cl/HCDFDXcinch7MK3yHqFT7VGt+my8/Ab4UEaEYOhtC+slSg7efVXwbGOBi2bw88LXLiOyMdCtYkLMH+WlTpIDfl7Sc8sOFflsaO9cDVH/k/NJ1q+6y6LMQ5o= 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:(13230022)(4636009)(136003)(396003)(376002)(346002)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(47076005)(2616005)(41300700001)(107886003)(83380400001)(4743002)(26005)(6506007)(6512007)(86362001)(6916009)(316002)(186003)(82740400003)(336012)(4326008)(5660300002)(70206006)(40460700003)(70586007)(8936002)(36860700001)(478600001)(81166007)(36756003)(8676002)(356005)(235185007)(44832011)(33964004)(44144004)(40480700001)(82310400005)(6486002)(2906002)(4216001)(2700100001)(473944003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2022 20:08:33.9710 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 048fbb5a-a84e-4f10-6c5d-08dac67c0221 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: AM7EUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5730 X-Spam-Status: No, score=-12.6 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, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, My recent patch had return statements in the match.pd expressions which were recently outlawed.. Unfornately I didn't rebase this patch before committing so this broke the build. I've just reflowed the conditions to avoid the returns. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Committed to fix the build, but think it's still trivial as it just reflows the code. Thanks, Tamar gcc/ChangeLog: * match.pd: Remove returns. --- inline copy of patch -- diff --git a/gcc/match.pd b/gcc/match.pd index 4701578c96451d56e5235d5e0bc5d0a0378c1435..946dcd1b301c8fbcfe36e534651ff0b183b324ef 100644 --- diff --git a/gcc/match.pd b/gcc/match.pd index 4701578c96451d56e5235d5e0bc5d0a0378c1435..946dcd1b301c8fbcfe36e534651ff0b183b324ef 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -7984,51 +7984,51 @@ and, { /* Build a vector of integers from the tree mask. */ vec_perm_builder builder; - if (!tree_to_vec_perm_builder (&builder, @2)) - return NULL_TREE; - - /* Create a vec_perm_indices for the integer vector. */ - poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type); - vec_perm_indices sel (builder, 2, nelts); } - (if (sel.series_p (0, 2, 0, 2)) + (if (tree_to_vec_perm_builder (&builder, @2)) (with { + /* Create a vec_perm_indices for the integer vector. */ + poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type); + vec_perm_indices sel (builder, 2, nelts); machine_mode vec_mode = TYPE_MODE (type); machine_mode wide_mode; - if (!GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode) - || !VECTOR_MODE_P (wide_mode) - || (GET_MODE_UNIT_BITSIZE (vec_mode) * 2 - != GET_MODE_UNIT_BITSIZE (wide_mode))) - return NULL_TREE; - - tree stype = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode), - TYPE_UNSIGNED (type)); - if (TYPE_MODE (stype) == BLKmode) - return NULL_TREE; - tree ntype = build_vector_type_for_mode (stype, wide_mode); - if (!VECTOR_TYPE_P (ntype)) - return NULL_TREE; - - /* The format has to be a non-extended ieee format. */ - const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode); - const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode); - if (fmt_old == NULL || fmt_new == NULL) - return NULL_TREE; - - /* If the target doesn't support v1xx vectors, try using scalar mode xx - instead. */ - if (known_eq (GET_MODE_NUNITS (wide_mode), 1) - && !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)) - ntype = stype; } - (if (fmt_new->signbit_rw - == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode) - && fmt_new->signbit_rw == fmt_new->signbit_ro - && targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS) - && ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype)) - || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))) - (plus (view_convert:type (negate (view_convert:ntype @1))) @0))))))) + (if (sel.series_p (0, 2, 0, 2) + && GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode) + && VECTOR_MODE_P (wide_mode) + && (GET_MODE_UNIT_BITSIZE (vec_mode) * 2 + == GET_MODE_UNIT_BITSIZE (wide_mode))) + (with + { + tree stype + = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode), + TYPE_UNSIGNED (type)); + tree ntype = build_vector_type_for_mode (stype, wide_mode); + + /* The format has to be a non-extended ieee format. */ + const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode); + const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode); + } + (if (TYPE_MODE (stype) != BLKmode + && VECTOR_TYPE_P (ntype) + && fmt_old != NULL + && fmt_new != NULL) + (with + { + /* If the target doesn't support v1xx vectors, try using + scalar mode xx instead. */ + if (known_eq (GET_MODE_NUNITS (wide_mode), 1) + && !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)) + ntype = stype; + } + (if (fmt_new->signbit_rw + == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode) + && fmt_new->signbit_rw == fmt_new->signbit_ro + && targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS) + && ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype)) + || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))) + (plus (view_convert:type (negate (view_convert:ntype @1))) @0))))))))))) (simplify (vec_perm @0 @1 VECTOR_CST@2) --- a/gcc/match.pd +++ b/gcc/match.pd @@ -7984,51 +7984,51 @@ and, { /* Build a vector of integers from the tree mask. */ vec_perm_builder builder; - if (!tree_to_vec_perm_builder (&builder, @2)) - return NULL_TREE; - - /* Create a vec_perm_indices for the integer vector. */ - poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type); - vec_perm_indices sel (builder, 2, nelts); } - (if (sel.series_p (0, 2, 0, 2)) + (if (tree_to_vec_perm_builder (&builder, @2)) (with { + /* Create a vec_perm_indices for the integer vector. */ + poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type); + vec_perm_indices sel (builder, 2, nelts); machine_mode vec_mode = TYPE_MODE (type); machine_mode wide_mode; - if (!GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode) - || !VECTOR_MODE_P (wide_mode) - || (GET_MODE_UNIT_BITSIZE (vec_mode) * 2 - != GET_MODE_UNIT_BITSIZE (wide_mode))) - return NULL_TREE; - - tree stype = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode), - TYPE_UNSIGNED (type)); - if (TYPE_MODE (stype) == BLKmode) - return NULL_TREE; - tree ntype = build_vector_type_for_mode (stype, wide_mode); - if (!VECTOR_TYPE_P (ntype)) - return NULL_TREE; - - /* The format has to be a non-extended ieee format. */ - const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode); - const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode); - if (fmt_old == NULL || fmt_new == NULL) - return NULL_TREE; - - /* If the target doesn't support v1xx vectors, try using scalar mode xx - instead. */ - if (known_eq (GET_MODE_NUNITS (wide_mode), 1) - && !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)) - ntype = stype; } - (if (fmt_new->signbit_rw - == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode) - && fmt_new->signbit_rw == fmt_new->signbit_ro - && targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS) - && ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype)) - || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))) - (plus (view_convert:type (negate (view_convert:ntype @1))) @0))))))) + (if (sel.series_p (0, 2, 0, 2) + && GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode) + && VECTOR_MODE_P (wide_mode) + && (GET_MODE_UNIT_BITSIZE (vec_mode) * 2 + == GET_MODE_UNIT_BITSIZE (wide_mode))) + (with + { + tree stype + = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode), + TYPE_UNSIGNED (type)); + tree ntype = build_vector_type_for_mode (stype, wide_mode); + + /* The format has to be a non-extended ieee format. */ + const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode); + const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode); + } + (if (TYPE_MODE (stype) != BLKmode + && VECTOR_TYPE_P (ntype) + && fmt_old != NULL + && fmt_new != NULL) + (with + { + /* If the target doesn't support v1xx vectors, try using + scalar mode xx instead. */ + if (known_eq (GET_MODE_NUNITS (wide_mode), 1) + && !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)) + ntype = stype; + } + (if (fmt_new->signbit_rw + == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode) + && fmt_new->signbit_rw == fmt_new->signbit_ro + && targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS) + && ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype)) + || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))) + (plus (view_convert:type (negate (view_convert:ntype @1))) @0))))))))))) (simplify (vec_perm @0 @1 VECTOR_CST@2)