From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 38F0F3858CDA for ; Mon, 31 Oct 2022 21:44:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 38F0F3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x632.google.com with SMTP id p3so11902117pld.10 for ; Mon, 31 Oct 2022 14:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tNdNUKPpTlyhAAjXci09NN+99+ahGJG68bWIH/QDEeI=; b=nX4N+UWxRKYNo4yQiYa9R3xoL8r8xEUpWE0oA9wwpWEBxOksevFxLK41TEQIA6rPM4 xCfqw9oB1TlFwh3ylK8VxuoiRhhEYNWnezSvcoSA8Q3r67dq1Sar7DX4Zfl30AFWY97h UzQugk/QbaD2SuCOu+ec81ohIiB8h4k0fZ/404QkP+OJbrOzkv29nvCCIIWCvz3Ziu9Q ttHoGFCgtpzj325dt5cfSovEdP6kfj2GbCPTE7BZQ6re5PskZVcWZlDYzHWUZl0xTWsx aPgmCaV4qPfhIWzqwDs0BU9pe1z+YuzO8G1b4ZW9jwNS3IubbWxjWdwGLITGMgrOJICQ 7RnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tNdNUKPpTlyhAAjXci09NN+99+ahGJG68bWIH/QDEeI=; b=DgF2GxTHsPrLuw8ZMlP1t5WlkMF2X7cV4z3Es1B7DrujMGqeUPExICNARiG7LNCLjs aS6bYRGD/6AEARGxPrz3+ciCNYjpeUOYCgJmkkI82XUQUo4IE2pGRI1VNzcjUduusyQ0 4R7Y4GG3I1zhgnkAnuf/wmoXxjWU5b4Xh9TE5HtjoPUwYD0YyswpAP6eHzoEcvCAIxN7 TweNXWLjckhnpU1LOrsuB5JqVSBsgOTCo++HYlwpA+O3VxvdE9aeil3dTEJw2vnRlwUi FsDiiXeLE5foW4xT1Cn+fiRez4UuadqOm61Q64CLMXWoMsGX6JoAuVTmTTy14sPPy7Sj V78A== X-Gm-Message-State: ACrzQf2KD3q/7bBcgbw8FciRebRxPxzaLc06N57TCOIWcSHvkB7klfy/ wbjKMOb270kcMVqN8+d1/vA6mGJo9kc= X-Google-Smtp-Source: AMsMyM5OOdkt0CWy2BfaY6BSZGVehV2azn0JJ+apS9xKSGnrAyb+sgceNt7MOSib9GjX4aKVxaB8aA== X-Received: by 2002:a17:902:bc83:b0:187:85a:28b4 with SMTP id bb3-20020a170902bc8300b00187085a28b4mr14367881plb.96.1667252684087; Mon, 31 Oct 2022 14:44:44 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id e19-20020a63ee13000000b0046f469a2661sm4597525pgi.27.2022.10.31.14.44.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 14:44:43 -0700 (PDT) Message-ID: <1a9d90ff-0655-0e61-f9d0-ddc02d6456c4@gmail.com> Date: Mon, 31 Oct 2022 15:44:42 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 3/8]middle-end: Support extractions of subvectors from arbitrary element position inside a vector Content-Language: en-US To: Tamar Christina , gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/31/22 05:57, Tamar Christina wrote: > Hi All, > > The current vector extract pattern can only extract from a vector when the > position to extract is a multiple of the vector bitsize as a whole. > > That means extract something like a V2SI from a V4SI vector from position 32 > isn't possible as 32 is not a multiple of 64. Ideally this optab should have > worked on multiple of the element size, but too many targets rely on this > semantic now. > > So instead add a new case which allows any extraction as long as the bit pos > is a multiple of the element size. We use a VEC_PERM to shuffle the elements > into the bottom parts of the vector and then use a subreg to extract the values > out. This now allows various vector operations that before were being > decomposed into very inefficient scalar operations. > > NOTE: I added 3 testcases, I only fixed the 3rd one. > > The 1st one missed because we don't optimize VEC_PERM expressions into > bitfields. The 2nd one is missed because extract_bit_field only works on > vector modes. In this case the intermediate extract is DImode. > > On targets where the scalar mode is tiable to vector modes the extract should > work fine. > > However I ran out of time to fix the first two and so will do so in GCC 14. > For now this catches the case that my pattern now introduces more easily. > > Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu > and no issues. > > Ok for master? > > Thanks, > Tamar > > gcc/ChangeLog: > > * expmed.cc (extract_bit_field_1): Add support for vector element > extracts. > > gcc/testsuite/ChangeLog: > > * gcc.target/aarch64/ext_1.c: New. OK. jeff