From patchwork Fri Sep 23 09:24:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1681491 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=A3Ex/A+U; 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 4MYmwP2yg1z1ypX for ; Fri, 23 Sep 2022 19:25:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 67A30385741D for ; Fri, 23 Sep 2022 09:25:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67A30385741D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663925139; bh=mSwCke9E9C5Wf4OnaPXTtOdMhsP5SWl/yWgJagsNBHU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=A3Ex/A+UT8J52Y3SBqE/QGSJKJEuXP3W/MOIzYgKWCJqRgzcy9eKSW42uN6I5WKdk qqUkv44RtxGJqh9D2yab5q5etEuTVxtxNb2wDn/B2rF0Vj6ivupe0UaKLwVZIpgrzE 5pQ8+aOnWOdmjKoFEjs8gu8IPy+h3av2Tzip2Vys= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130047.outbound.protection.outlook.com [40.107.13.47]) by sourceware.org (Postfix) with ESMTPS id F17463858C52 for ; Fri, 23 Sep 2022 09:25:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F17463858C52 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Fr58zU30mLVv5E7fNPj9O0jXE8bG4MlzkGTS/L7CaTDDOjd+5cEGrJkzkHopkU5XGM3eaNZI9VPl861VrQNbmHRGawnrs6vMshlPmRHhglQDwQz1ZDQdbC2192W407Hh6ACcKwbJ2Y6QpvmlFoApC3FyitBCG3Ozo94TN+8BPY3eFLvjr2k4W3M6zBkzryXEAGpAXMbJpmGXWGtjkmOi8OHn/+f4Xzbnz33dS7LnfMd2ZNxu02Vy8ZfP85CgkS+nQ2/AUOnrc/6N0SN3Sw5VrWKN21xH5+MwbY46/YkUAwpzluxT7eV5KWTlwOAbzRQnm+p2dhVsPmiUVOFMpWQI6g== 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=mSwCke9E9C5Wf4OnaPXTtOdMhsP5SWl/yWgJagsNBHU=; b=Aedq4TM7tTxCQvzi4gJGAjGAJ4FFdo9TetbwT8aT3Opve+01Jl+lepwvXF+7PAGfZVA0+xc4aWe6QX2dentzkSyBf4H7MOrny7VR0BNJLHgfvPbxTmiuFAJpN3JeIw1aZzNphaY8VFrw8ChTJhA51P045SPOj9e7gTG+zxxe5dRJVkc2tJ33sIIjQePEJt/8kJ6OoHC5wGOc1dE+8TkDdybrt8T+5wE98RaeJ6x/ZP8zw0b/qZtgszh/Zz3130szWGEaxlpEVzXmYaJzv5q/awQSPLNvpU+w1w35UcX/4W2xlTGZSGidmF6+ZrRRCrxHosF71eUYtoEUaAD1ssQz7g== 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 AM6P194CA0078.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::19) by DB8PR08MB5386.eurprd08.prod.outlook.com (2603:10a6:10:f9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Fri, 23 Sep 2022 09:25:13 +0000 Received: from AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::54) by AM6P194CA0078.outlook.office365.com (2603:10a6:209:8f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20 via Frontend Transport; Fri, 23 Sep 2022 09:25:13 +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 AM7EUR03FT035.mail.protection.outlook.com (100.127.141.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Fri, 23 Sep 2022 09:25:12 +0000 Received: ("Tessian outbound 3c27ae03f5ec:v124"); Fri, 23 Sep 2022 09:25:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3f3f52b6993c9019 X-CR-MTA-TID: 64aa7808 Received: from 6540a6fb6139.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 153D05FB-50D1-41B4-9388-9848E61CED32.1; Fri, 23 Sep 2022 09:25:05 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6540a6fb6139.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Sep 2022 09:25:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SXdiD/bFQutREgc4tDhYxUNMCn4O7zLkMW22mLqULy4tZrWjqiacoQdlk3RX4oPl9AAALLFgrTi9udEDaOeA/kMi2CkJklfRQtqyryaxBCiPN6lHeaJCETt694zoXvl8Qsyb4x8tBPn01W8Hd8D26KuABQ/rrSOs9AThr7iwSLARCJOUJdPIZqbiBclqpiJveIaitshvRB0udRAYKM2nGp49QJtx9gEE10G6DZZJRuAK5hGwfrbA76pQzLs5mNOudAm/ROJTrIpLvbyuWZK2eDbs/WIq6rNR8NAyHTznAkAIhCW/dK3m+CkzN8mVneLkEQHvo1qAeHxDGD+1zmBeJQ== 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=mSwCke9E9C5Wf4OnaPXTtOdMhsP5SWl/yWgJagsNBHU=; b=oMsFmgv4gN6kwsY2M1rYp0RfdV2BY/Bhof5847c1TZ/hyE5QYTYIQcIH08sW2DL1BQ1qppYBr1pgwRLaJRQ26+sZ5WFmSJ/cSCKzz6g8CiHhxe1PQUaqmTL88O4HV3s8NQu4n1y3cDThZrB85oUVofA7PMPDsUJLf1fW7gXd9/53X5jZAkP3VkLAjUR4v8CVYunwWjQ3L1hbGdfcegRjmdSckITyqOkJVrE6wkxuWT1ertQLE09oX7xLyJpPs+JPathrmlyG4b0q23YBH2yI4vKy/1FLZoalrgGSUVf5cCYEVf2NjhDNIH8lRLZZhAzf55KDyod4QKiapuUNB7fGJQ== 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 AS2PR08MB9475.eurprd08.prod.outlook.com (2603:10a6:20b:5e8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Fri, 23 Sep 2022 09:25:03 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::6529:66e5:e7d4:1a40]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::6529:66e5:e7d4:1a40%4]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 09:25:03 +0000 Date: Fri, 23 Sep 2022 10:24:56 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2]middle-end: RFC: On expansion of conditional branches, give hint if argument is a truth type to backend Message-ID: Content-Disposition: inline X-ClientProxiedBy: BN9PR03CA0892.namprd03.prod.outlook.com (2603:10b6:408:13c::27) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|AS2PR08MB9475:EE_|AM7EUR03FT035:EE_|DB8PR08MB5386:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dabb9e7-2080-46dc-2614-08da9d4584a7 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: CdsJnzbxB2pBBtnpPaqSOZ+XjASgPYJl263PR9KnMoEPaXKL0KciDvHMlamvuJfxIYTn+J0LwhkC/+p7xBLU+SsY8cbGfcC4xtdJGm3XDdOqFdQpAtUm+j7Jda5LgFZnxxPZm1WjTfYFsqlM7lhjKLvXH10Dh427ixDTGDLFA64ScB7lkDAilDPC8EjRphzC4VOKXVUVzSl6rhtzMhl8P+FMNHOvY1IBD0DYCj3IQYuVSJl5KCdtWWHzm3TsM9mz4gt8q+WGzUciQwguSjILneK43p/21WXJ24hMif6ka8HNnkiqm6xAcJKQUHUBQ84ZqS0NtlI8ol/jUFmX9j4oWlqSCwz7qW0Kh8pT1QeHNmbDF5m0Sbsxnv2JL/J8Wgwt6DA475fKIq1a7wawuh/T++3sIBfv1da8ynhz71vAQe8Jof+FlD73V/ILdASCojIvq7TFftFuE2TY6zevGvhBqcUfe/QTU6utH+Trv1He1oGGDQxUdeIB6HT4uMbMwLcxYDROeVZ4q9x27G60DeZli829FctKDtGIHxZP1ccdMmwJJlXi4DCwkmSZSJKJWfHB39jngrwKnAVqulK2ApSFuoGxUnRMvao5OQ26EDKtNHs3mhkCvvxwzaAkBupcLLfW/jUxq7GO91R1kinSshgmh5m9e/DClgVgmxJioGa6olPaJT2kI7HniFMo1x5GlWftaKCi0TNh0QtA1HkzeI1hq+O/Hdq4FH2h4O8B7BCNO8kLJ/SwoD4HYbj90K7MUtnTlZfPKLw17Wb/YTcm4Rq37w4dKUWeO9vrRqmsaDV+zrs= 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)(376002)(346002)(136003)(396003)(39860400002)(366004)(451199015)(6666004)(2906002)(6506007)(44144004)(33964004)(86362001)(478600001)(6486002)(8936002)(6916009)(41300700001)(36756003)(5660300002)(44832011)(186003)(6512007)(26005)(2616005)(4743002)(38100700002)(235185007)(66899012)(66556008)(4326008)(316002)(66946007)(66476007)(8676002)(83380400001)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9475 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: AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 35e7d24b-5191-4973-ca1d-08da9d457eca X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C+srADePXJ1hWgnl83/Fy6Sffa2vnTUBeHy9sEPet/pqulr2UFUjxVimfM+s0z9gG0aMKtaJKzPRpmCq+3a+h0LxoTH4fQtv2JTfLyMmMTjgufMoKiOT/zsCrh+utNhdvYmlXAeTnKXXGAawwXEPNqQS8+n2kjbrAWdKYNIyisR3ppOWWzLyxDReZ0N+nokh7x8qHWcxLeea7YzE5wue9BDBh4FRtk/hz2gQlOzfdDwx/Xe0QemstnjA+z0DeXGzWwgPC7x/nH/8NeFooTKg7BeZClt5BjmJBOGysSbwIY99gJYNnI/V2VJLc0ldtTjkrBoq11AQc/XIrtUjgvUdG19UnSTnspcP9uZ6F3MxgNHA1nmxW6lEsVPIY9DAcnk3jnqs25u33STTDiaYBmZVIhwyOirhR7IFMPkwO1CgzgALUs/IO+CtDAzKA1fnQfTGnmgh4n67Mb4n07E6gc5t04AAvSt3+HCy9POe4dXGcrV9CgUYpo9kZc7zvPhVljF+mO8J8n0NiWeiLhHINkNi8nZk/wmFOKjIy9DU2vKonbx3aNer+JKEp/z0bLOavviHZAKvGkWvVOAsvmgaL2GGEf7C2pM/25lZc71i7LBQom0dV9kLNSEcYqynGntYYFDExDLtDA+QLtlmOjfzY+o4uYa9YDqEPQwsiYTwoKRvKT6RqktKti55WcIAFXvbsfWcwjey+TDvBTOd0sdk9kWxk8jGOBSN6Tebwhnwt8e1UWG9Rv/pY1mLal4SIMyq/nZt+Ac2xnELe+RQu+AU0DvOIjw9Sf0r/qREMQ25nm+8T401W6ynC4H8QgO63aL/AIXe 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)(39860400002)(346002)(396003)(136003)(376002)(451199015)(40470700004)(36840700001)(46966006)(81166007)(41300700001)(66899012)(82310400005)(4743002)(186003)(36756003)(6506007)(8936002)(40480700001)(2616005)(6486002)(316002)(86362001)(70206006)(356005)(478600001)(6916009)(82740400003)(70586007)(336012)(8676002)(26005)(6666004)(40460700003)(235185007)(4326008)(6512007)(47076005)(44144004)(2906002)(83380400001)(44832011)(33964004)(36860700001)(5660300002)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 09:25:12.9572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8dabb9e7-2080-46dc-2614-08da9d4584a7 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: AM7EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5386 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, 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 Cc: richard.sandiford@arm.com, nd@arm.com, rguenther@suse.de Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, This is an RFC to figure out how to deal with targets that don't have native comparisons against QImode values. Booleans, at least in C99 and higher are 0-1 valued. This means that we only really need to test a single bit. However in RTL we no longer have this information available and just have an SImode value (due to the promotion of QImode to SImode). This RFC fixes it by emitting an explicit & 1 during the expansion of the conditional branch. However it's unlikely that we want to do this unconditionally. Most targets I've tested seem to have harmless code changes, like x86 changes from testb to andl, $1. So I have two questions: 1. Should I limit this behind a target macro? Or should I just leave it for all targets and deal with the fallout. 2. How can I tell whether the C99 0-1 values bools are being used or the older 0, non-0 variant? Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. However there are some benign codegen changes on x86, testb changed to andl $1. This pattern occurs more than 120,000 times in SPECCPU 2017 and so is quite common. Thanks, Tamar gcc/ChangeLog: * tree.h (tree_zero_one_valued_p): New. * dojump.cc (do_jump): Add & 1 if truth type. --- inline copy of patch -- diff --git a/gcc/dojump.cc b/gcc/dojump.cc index 2af0cd1aca3b6af13d5d8799094ee93f18022296..8eaf1be49cd12298e61c6946ae79ca9de6197864 100644 --- diff --git a/gcc/dojump.cc b/gcc/dojump.cc index 2af0cd1aca3b6af13d5d8799094ee93f18022296..8eaf1be49cd12298e61c6946ae79ca9de6197864 100644 --- a/gcc/dojump.cc +++ b/gcc/dojump.cc @@ -605,7 +605,17 @@ do_jump (tree exp, rtx_code_label *if_false_label, /* Fall through and generate the normal code. */ default: normal: - temp = expand_normal (exp); + tree cmp = exp; + /* If the expression is a truth type then explicitly generate an & 1 + to indicate to the target that it's a zero-one values type. This + allows the target to further optimize the comparison should it + choose to. */ + if (tree_zero_one_valued_p (exp)) + { + type = TREE_TYPE (exp); + cmp = build2 (BIT_AND_EXPR, type, exp, build_int_cstu (type, 1)); + } + temp = expand_normal (cmp); do_pending_stack_adjust (); /* The RTL optimizers prefer comparisons against pseudos. */ if (GET_CODE (temp) == SUBREG) diff --git a/gcc/tree.h b/gcc/tree.h index 8f8a9660c9e0605eb516de194640b8c1b531b798..be3d2dee82f692e81082cf21c878c10f9fe9e1f1 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4690,6 +4690,7 @@ extern tree signed_or_unsigned_type_for (int, tree); extern tree signed_type_for (tree); extern tree unsigned_type_for (tree); extern bool is_truth_type_for (tree, tree); +extern bool tree_zero_one_valued_p (tree); extern tree truth_type_for (tree); extern tree build_pointer_type_for_mode (tree, machine_mode, bool); extern tree build_pointer_type (tree); --- a/gcc/dojump.cc +++ b/gcc/dojump.cc @@ -605,7 +605,17 @@ do_jump (tree exp, rtx_code_label *if_false_label, /* Fall through and generate the normal code. */ default: normal: - temp = expand_normal (exp); + tree cmp = exp; + /* If the expression is a truth type then explicitly generate an & 1 + to indicate to the target that it's a zero-one values type. This + allows the target to further optimize the comparison should it + choose to. */ + if (tree_zero_one_valued_p (exp)) + { + type = TREE_TYPE (exp); + cmp = build2 (BIT_AND_EXPR, type, exp, build_int_cstu (type, 1)); + } + temp = expand_normal (cmp); do_pending_stack_adjust (); /* The RTL optimizers prefer comparisons against pseudos. */ if (GET_CODE (temp) == SUBREG) diff --git a/gcc/tree.h b/gcc/tree.h index 8f8a9660c9e0605eb516de194640b8c1b531b798..be3d2dee82f692e81082cf21c878c10f9fe9e1f1 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4690,6 +4690,7 @@ extern tree signed_or_unsigned_type_for (int, tree); extern tree signed_type_for (tree); extern tree unsigned_type_for (tree); extern bool is_truth_type_for (tree, tree); +extern bool tree_zero_one_valued_p (tree); extern tree truth_type_for (tree); extern tree build_pointer_type_for_mode (tree, machine_mode, bool); extern tree build_pointer_type (tree); From patchwork Fri Sep 23 09:17:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1681487 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=X+9PwLQz; 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 4MYmlm0G7qz1yqV for ; Fri, 23 Sep 2022 19:18:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4EC43857B80 for ; Fri, 23 Sep 2022 09:18:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4EC43857B80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663924685; bh=3cZmFh41yFaBR5bjqmteztLiwVN3xxOgDaEphTPfk0w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=X+9PwLQzd+X6+96pmh3LG85t6GtHeOptkCDCgfL+IMFVJhBuHEM1ZInocsfMZ/Vqz 2Y6EvDwRX65BsE6vKmcTmG3e+cd4bWK5uoOsb+IobT2Ex1tKB6TtxRFwDhfGb+WUOa mlYHb4u3IEzDoOaSwxPBdEFvyR58cpWm9rqsj+VE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80088.outbound.protection.outlook.com [40.107.8.88]) by sourceware.org (Postfix) with ESMTPS id EAF293858C52 for ; Fri, 23 Sep 2022 09:17:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EAF293858C52 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=CLlJxWq1Ctq2RAZa9Vb2CstCESD2ugUv/YjNcF7/ZanqmHkJquN24axJCDJnjgY6iRiRW5h7Fk0bXw2RhWv4G6nGDlByybjpTzparI7llEI4GPyU8a/frFe9tlEpGXbZm+lJW+U/6ZUdW0eRhF8hnS9z81qONx/jhwGWg3GhHqi4zYdA544VbJsrieAfWuVujSDREbIPHj18QQsrhbakzuhjnzE10hJJkX+wwqnHJO+V81pRt78k9M6TzfbET8hz4v2cKo/kfeJ3Vp3wCaqzjqRWtNFRaxoqB5w1dSPi7Prj0hVzVDs3ICTJwRVR526YWZfQCaGgsE53MboVl39r/w== 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=3cZmFh41yFaBR5bjqmteztLiwVN3xxOgDaEphTPfk0w=; b=IL4TkemYbRTTKy5R/iEsZ3F4urMn/27sCjbhQ1qQ0DZb3AxVLPypt9UCqQv3OUFz/G8/NJXCcvuskR5JjRoOiaav4X0cgYxR62paaW3mkD0jtPBS3PP/XAEtI3gMymJeH46uQCxKHYHsU+iuSNeDJ4lBC7Xbt+OToR4n3qhuKgeB5SBXBpnzH1mO/qPBb0tSMn7JW/25Ukx43bB6zRKRKtXj2lCp4ikeF6VgKrdh/XOFm+gaJ3VOzjeTrcVESYEiiUys+Ug/Q2zrigsCZESsVP28UMzlh/0e5I2ngjJB3Pv1s8oWSUNUj/b6xNro1zteoAOwcAMFL+mpQeZgPEIg/g== 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 DB6P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::21) by AS8PR08MB5880.eurprd08.prod.outlook.com (2603:10a6:20b:29f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 09:17:37 +0000 Received: from DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:28:cafe::b4) by DB6P191CA0011.outlook.office365.com (2603:10a6:6:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20 via Frontend Transport; Fri, 23 Sep 2022 09:17:37 +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 DBAEUR03FT042.mail.protection.outlook.com (100.127.142.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Fri, 23 Sep 2022 09:17:37 +0000 Received: ("Tessian outbound ee41cdb23966:v124"); Fri, 23 Sep 2022 09:17:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 24515cb2c7a788a3 X-CR-MTA-TID: 64aa7808 Received: from d46b956e712d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A9AFF06B-55FF-4F5D-B437-8AA81E18647D.1; Fri, 23 Sep 2022 09:17:30 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d46b956e712d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Sep 2022 09:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mxcNA6A8S689Vv+P79cWCi838oAOw+0EZOXlsM4unr7ZVgA34iu1xPb6E/ETbVxBEyS9GhNDNORdQJXEp9V1Xx0RaVZYSzlB4CF2r8mS2z/DzMVa6v2MdWDdBiQ7cyzYo/KqLrqoXBkQWvPdPFQZiUz1Fdy7hN0dfV/JrwBTRu9kECOZNzLC55tn4s3MRM6y4NoBvSqIIrgxMgQgSVGkBAPO0yS0GmQZW4DFHp9GKi0XbloXzBCA98H+MRcWtaECPea5Ecseu4hMwVkJl11g6OzZRV/fY04YYdJyMxP3qW0oO9O3GZS4tZv8ZtqMVQ9EBMSFKTiivhLHKSOiaYBWcg== 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=3cZmFh41yFaBR5bjqmteztLiwVN3xxOgDaEphTPfk0w=; b=NnydnEvkLsLBpqFdIXlFO9DT8e5btQziSCdE8bb18dzxAfV6fp3giYfu5l5OhSXosVKVUxMY4vWdyngtIcbESw6f0nWFIj2zHODaduhtKGEI+rRvS7Muft4N/H40MsGfDxKTJvvg0Z0DM7lwN3dZWW2gbqW65Kpup7VdoadKDq3rFPyIyyMDoP8O0E4BTAE4JzcLgqvgMLNpaKx8vZyDtaEH2zt6/DzVTrD+XLDpJtMh4ssT/9IuI8ca3hGsLDAYX5cRJ693tePLl0f9UihxslD2Lo1Ftdhc9uleRZb6IwzAzXIMhi5qmCGoMbVyrWE4Vb62abtVoaew0dR2C5nWZw== 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 DB9PR08MB6444.eurprd08.prod.outlook.com (2603:10a6:10:23c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 09:17:28 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::6529:66e5:e7d4:1a40]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::6529:66e5:e7d4:1a40%4]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 09:17:28 +0000 Date: Fri, 23 Sep 2022 10:17:23 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2]AArch64 Add support for neg on v1df Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P265CA0151.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::19) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DB9PR08MB6444:EE_|DBAEUR03FT042:EE_|AS8PR08MB5880:EE_ X-MS-Office365-Filtering-Correlation-Id: e9179342-845e-4548-3308-08da9d4474db 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: 5L43yJIuJtRM6+Nr1s8v8iASVp/A6tJ/Zn2WmGc4XX1r4zLacU+oVjj2eUFH93v5AyRcVQv5BV42ABoOTcIJLeymPOAdYfpJnrcSS1L86epQCoBPbp+rkoWCmDFo1QlRWU8YFtuWSczRd/duQxSZY3vf/TKRHfRnfoIZZvU3TmSNNSlrl5+HxBB47fKYwiiBlnhxs62Dk/5tGCQAn45wkBlQ5+5oB1L7hLnQSBz1TqvmTP4mkly+O3ZpTJhy7dfv2BwRQDW2Z6VoqIeCgRuuxnzt0zPTs1d1NwRGUTSq2NRlBsTMvJnhAsVLbH1qfFPL/pOwBrupUMMiCxE4WUKKz8GRvDGIJUsigDIatAALLBynwScQgWo2/LTbXZO6eazw9B2BEvMY20/HpqqF6/fq60q29iUq89y2NUUbHpch7lWweMqWpXc3yeE80RrQLeweao2apSO47hVGwZHQnjreI+fRV7NpAlQoStoQ9Sya6i7WBHRQ7m+8TfwC+oT1Vq7eLPG/wcVe2SkFJv5VlpcvWo7FpUR1L16DUziRF2B1h0lXb1bXnbKHyjagzFpDX/qIBkkODchdh202dcZgXz7b960EKmtp/uMp2knKHbzjscdlTBuOvW/Rt3Ws85Eblo8DJaiYxDJoRmU6Kg4aGHBTmnwZjA4oB7EC6a9DZepBhYXdHApyu76JjNAJSHekJKWx2pKS+vwQ+1KE4nM6+DubZcZAjx0zIV1lY/bUfEXkuGgHGk/bysbdUMVqw7nO+1kzzSDrSkPo1D4zdF/VJlodj5QqJvHEs/n0o3OeXs7JfEbWcwD5bF420usL8ov7hauyw+IlL9hAo9YaLRKwbb/zKA== 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)(136003)(366004)(396003)(39860400002)(451199015)(44832011)(2906002)(66476007)(41300700001)(5660300002)(4326008)(66556008)(66946007)(8676002)(235185007)(8936002)(84970400001)(6486002)(478600001)(186003)(6916009)(2616005)(6666004)(6506007)(316002)(6512007)(4743002)(33964004)(44144004)(36756003)(26005)(38100700002)(86362001)(4216001)(32563001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6444 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: DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ceb45789-177c-4886-d837-08da9d446f4e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v4hC0dxtdqEva3BkmfyT5a98/vLgGoeSA4Vx8cpnfnKUP6RtMizqc09gpanXTDSvZIF6mPav/iP6WTVbm4LytUo6tTzqrYKEHPtIKcaAgsgvkhYQHPg1uG1rGImIhrrDDgQGSzMQyvJbeB/CVLpqz3Owwe52JYn+FvmWIfS0yJa37ZHtvIZJRiTXnisE1ABPwNuYrOCdclnH9qbAecczZCgn/1lByfKeWOdzjo2a2JNNPgeD2P+xgN+UDJ28LdUJvOp/DThXgmbPFohDJ926Mon6ZAMXv6t1p0ufzfULX1smflXxpp68/jYgbFdYF5imvHt1+3StE+vdnrJCbko3YJgZz/1+rCnTdP/9qN9MTFHay6d6EBfVWoAfJML+0luLGft6TxYfZiM8aereNxNgNL9JawXp13X18eUlRh95g2ew371eLdxp/y58VxNlPRrRip0hsoz+J9UkTaXPdvhhcWHt6BG0QpIhzGlzLa/YdAcZii7t9/LZ9UT2sGOeFn9k+m1hUQ1e/sTHWu7k0j0Rf1x5M1bWhrYQSL8KD4BK5vGLueO+a6aWO74DdDyv7qBJ9U9R5fKzf0yNPOqnzSVd1YP1ws3iBo9roysHz2y+rO5TujYEDiaLKXCkNNcrAObUhU8qDQiVhfZWHog7nX+gFF97+fi103WOdFuePs8/qOHXQIO6ia4kOZY8qkYC83AF7JC3xqkgl1yAqyyeMAH78lYh8Xz3Q7R+EhjRhaqksD4LHAuKinHo/vQBoe0lD89AZ9N5AMl/2s8rM/7NQ21/ZbIjqzUqxrBJB4KngDzNOkuoU9Brgl8wUIR7ZfabGc0rC7vGgAjJM/WjcwY3GrAOO504hlp0bCxBi+XocXiWOhAQ3MPuHfVhR5WHK/mj9kUu 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)(376002)(346002)(39860400002)(396003)(136003)(451199015)(36840700001)(40470700004)(46966006)(186003)(336012)(47076005)(84970400001)(81166007)(41300700001)(82310400005)(82740400003)(5660300002)(235185007)(44832011)(8936002)(36756003)(40480700001)(6666004)(86362001)(356005)(40460700003)(36860700001)(6506007)(6512007)(2616005)(4743002)(26005)(2906002)(316002)(33964004)(44144004)(6916009)(6486002)(478600001)(70586007)(8676002)(4326008)(70206006)(4216001)(32563001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 09:17:37.0049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9179342-845e-4548-3308-08da9d4474db 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: DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5880 X-Spam-Status: No, score=-12.5 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, 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 Cc: Richard.Earnshaw@arm.com, nd@arm.com, richard.sandiford@arm.com, Marcus.Shawcroft@arm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, This adds support for using scalar fneg on the V1DF type. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * config/aarch64/aarch64-simd.md (negv1df2): New. gcc/testsuite/ChangeLog: * gcc.target/aarch64/simd/addsub_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 f4152160084d6b6f34bd69f0ba6386c1ab50f77e..cf8c094bd4b76981cef2dd5dd7b8e6be0d56101f 100644 --- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index f4152160084d6b6f34bd69f0ba6386c1ab50f77e..cf8c094bd4b76981cef2dd5dd7b8e6be0d56101f 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -2713,6 +2713,14 @@ (define_insn "neg2" [(set_attr "type" "neon_fp_neg_")] ) +(define_insn "negv1df2" + [(set (match_operand:V1DF 0 "register_operand" "=w") + (neg:V1DF (match_operand:V1DF 1 "register_operand" "w")))] + "TARGET_SIMD" + "fneg\\t%d0, %d1" + [(set_attr "type" "neon_fp_neg_d")] +) + (define_insn "abs2" [(set (match_operand:VHSDF 0 "register_operand" "=w") (abs:VHSDF (match_operand:VHSDF 1 "register_operand" "w")))] diff --git a/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c b/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c new file mode 100644 index 0000000000000000000000000000000000000000..55a7365e897f8af509de953129e0f516974f7ca8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#pragma GCC target "+nosve" + +/* +** f1: +** ... +** fneg d[0-9]+, d[0-9]+ +** fadd v[0-9]+.2s, v[0-9]+.2s, v[0-9]+.2s +** ... +*/ +void f1 (float *restrict a, float *restrict b, float *res, int n) +{ + for (int i = 0; i < 2; i+=2) + { + res[i+0] = a[i+0] + b[i+0]; + res[i+1] = a[i+1] - b[i+1]; + } +} + --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -2713,6 +2713,14 @@ (define_insn "neg2" [(set_attr "type" "neon_fp_neg_")] ) +(define_insn "negv1df2" + [(set (match_operand:V1DF 0 "register_operand" "=w") + (neg:V1DF (match_operand:V1DF 1 "register_operand" "w")))] + "TARGET_SIMD" + "fneg\\t%d0, %d1" + [(set_attr "type" "neon_fp_neg_d")] +) + (define_insn "abs2" [(set (match_operand:VHSDF 0 "register_operand" "=w") (abs:VHSDF (match_operand:VHSDF 1 "register_operand" "w")))] diff --git a/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c b/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c new file mode 100644 index 0000000000000000000000000000000000000000..55a7365e897f8af509de953129e0f516974f7ca8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/addsub_2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#pragma GCC target "+nosve" + +/* +** f1: +** ... +** fneg d[0-9]+, d[0-9]+ +** fadd v[0-9]+.2s, v[0-9]+.2s, v[0-9]+.2s +** ... +*/ +void f1 (float *restrict a, float *restrict b, float *res, int n) +{ + for (int i = 0; i < 2; i+=2) + { + res[i+0] = a[i+0] + b[i+0]; + res[i+1] = a[i+1] - b[i+1]; + } +} +