From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 52B743853D41 for ; Thu, 17 Nov 2022 23:41:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52B743853D41 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-pj1-x1033.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so3499302pjk.1 for ; Thu, 17 Nov 2022 15:41:30 -0800 (PST) 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=CTxsXkOBkekLYOESp9Wq/AHYxewE7VNDDsAmw3Akb9M=; b=nI/L/Bze+5H47Uafgl+y36burGdduUw541ykAqs1im+4mghfT9QlK51VculMKvdneX Fl3KqdAE44nb45QHK7qmJWjQikY6CVWtgIZFM1aOP5HoxCF9MuXuHY+KVJ31kZtyStV6 HmpPW0VkHVlSW1f3/BBRsrgbxyE0NWQ2oA/bxTnXhZXI0OLRE6YyFNetWpWb2/oo8aXk s04wDFgbN3/QTLjNF9zMDmiSUmjdqTjyGAnNR+fdV84qgqeHUmoZf1oGmBRdjWuoV+R7 Tbfwy3XaK/lBAR+AJ5N4ZMZQOw/r9HzZLwFAoUqJHZ40FsiNxyxyjI1UCnLYyaxRhced +qww== 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=CTxsXkOBkekLYOESp9Wq/AHYxewE7VNDDsAmw3Akb9M=; b=rZglVEVtF7MmNSnBl0WryMKyCG4WSaNuoQowgDFzZi4TRlE4Z7vmKLqjTLFI5VrT4E Tej2cHCLaRA3uSaYnT+KYi5Oi19z6E99rmocPV/RLRhIMm3wShOnMPwnyF18RLv9KCnM eqwrgJkXt3KIFqZS4LeVzsuvdBhuLh3qdLqwb+i3x+z5sCAXJ6dk5czbG2hNZBLY1kAC QxyDa7WlNIcLlFQ7AEDs+E2h72y4DgY7ylWyPXavUYaa5swbzoRbA+gIpxaXgGTOken7 fE1zPBDW1uaGIy3mtztN2+nccvTUGns2iU4CXX6nn9DgdDT3X8dMl5abHCiqbfY9sMVN ma3A== X-Gm-Message-State: ANoB5pnF82e+ih44jkd0gK0P8gwRs0Wt9fFr745JCqQQopNwK2wL0RFI S+hnZm1UcIPmXM/2JPVnY7g= X-Google-Smtp-Source: AA0mqf7UWOqwNhVp3Qzhafr4sgN40gKaxWcF4uP7qLC9OixHoaZ780gAtVlAnzBimEMfCr4nQ3VPNg== X-Received: by 2002:a17:902:c946:b0:188:e49e:2657 with SMTP id i6-20020a170902c94600b00188e49e2657mr4837563pla.151.1668728489214; Thu, 17 Nov 2022 15:41:29 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id nu18-20020a17090b1b1200b00213a9e1ec44sm4127562pjb.52.2022.11.17.15.41.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 15:41:28 -0800 (PST) Message-ID: Date: Thu, 17 Nov 2022 16:41:26 -0700 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 4/7] RISC-V: Recognize sign-extract + and cases for XVentanaCondOps Content-Language: en-US To: Philipp Tomsich , gcc-patches@gcc.gnu.org Cc: Vineet Gupta , Palmer Dabbelt , Christoph Muellner , Kito Cheng , Jeff Law References: <20221112212943.3068249-1-philipp.tomsich@vrull.eu> <20221112212943.3068249-5-philipp.tomsich@vrull.eu> From: Jeff Law In-Reply-To: <20221112212943.3068249-5-philipp.tomsich@vrull.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,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 11/12/22 14:29, Philipp Tomsich wrote: > Users might use explicit arithmetic operations to create a mask and > then and it, in a sequence like > cond = (bits >> SHIFT) & 1; > mask = ~(cond - 1); > val &= mask; > which will present as a single-bit sign-extract. > > Dependening on what combination of XVentanaCondOps and Zbs are > available, this will map to the following sequences: > - bexti + vt.maskc, if both Zbs and XVentanaCondOps are present > - andi + vt.maskc, if only XVentanaCondOps is available and the > sign-extract is operating on bits 10:0 (bit > 11 can't be reached, as the immediate is > sign-extended) > - slli + srli + and, otherwise. > > gcc/ChangeLog: > > * config/riscv/xventanacondops.md: Recognize SIGN_EXTRACT > of a single-bit followed by AND for XVentanaCondOps. > > Signed-off-by: Philipp Tomsich > --- > > gcc/config/riscv/xventanacondops.md | 46 +++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/gcc/config/riscv/xventanacondops.md b/gcc/config/riscv/xventanacondops.md > index 7930ef1d837..3e9d5833a4b 100644 > --- a/gcc/config/riscv/xventanacondops.md > +++ b/gcc/config/riscv/xventanacondops.md > @@ -73,3 +73,49 @@ > "TARGET_XVENTANACONDOPS" > [(set (match_dup 5) (match_dup 1)) > (set (match_dup 0) (and:X (neg:X (ne:X (match_dup 5) (const_int 0))) > + > +;; Users might use explicit arithmetic operations to create a mask and > +;; then and it, in a sequence like Nit.  Seems like a word is missing.  "make and then and it"?? Do we really care about TARGET_XVENTANACONDOPS && ! TARGET_ZBS? If there's a good reason to care about the !TARGET_ZBS case, then OK with the nit fixed.   If we agree that the !TARGET_ZBS case isn't all that important, then obviously OK with that pattern removed too. I'm about out of oomph today.  I may take a look at 7/7 tonight though.  Given it hits target independent code we probably want to get resolution on that patch sooner rather than later. jeff