From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 8D3BB3858D1E for ; Tue, 20 Feb 2024 06:49:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8D3BB3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8D3BB3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::332 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708411793; cv=none; b=PgLwfGoOajVMPCEeOpSlraEZUyRkqaLQFtj2Z34iau1yj/Y1/ccYZP+SC6ZHbZSNeu4z/OW5T2EkVQkx4mUZ3liWzPrGsr5/TG+76cl2EBrK0Uiee86lzBKw2xJPexwIwB3Tpmkkji5NAmSWYBemzS76rDKxKpLKDKYWJe3/ono= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708411793; c=relaxed/simple; bh=avvv26J90XTHfAjHVnFzSIkIrV921dkkqmATFCTbbQk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ebPEu80M4evgOBANDACtHWeNTbWmOPdfHPSm708aFRS2/5wwSD9LLAgPCdEXzlVQ/ARIqPC/FSZHliv9vd6yuJWh4INMBJyOv12A0t3RfyypN8ypuNgjWzA/UFl1oh2fqt3ZcRwzbfPqjE8PDXJXvOSlcy+yvRvI+FN5k/YKg1I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-6e45ef83c54so184446a34.2 for ; Mon, 19 Feb 2024 22:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708411790; x=1709016590; darn=gcc.gnu.org; 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=IZJJaWcS6A5MjP0+qR+xGGfQxGi3TEZ9bg1/9xGQ9xo=; b=D2/dATkY8faVZ3iUfkcl6taA9kOcKInf0LXX3F3PC31pEyNa9wXQleljuauKscLAHz 3JsLHCNiMa9nvRHb148SEZFlBXUg6ulLnYoF+YJ5814PD6xmhhFqguT91eStGPjvWxKQ qLCJfcjQ1Rl9u/v/m0uZc0k4PTjz6MUlJ53xiBPFGzzsE5pBmZYK9QhBtCNiiyIgPXyp bNY1zLuWNXBcRN3Orau32RvW/fyQF1vfZiNvAkHGhQ3QFvF2i9wOuxDf38uEInlBWKvW QMHt0or6chEAM1WtbEInwEpBiSKfUoMPgMDNEHG48lPAFBXl04/NKB7p0MCTMZXvAwAI kR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708411790; x=1709016590; 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=IZJJaWcS6A5MjP0+qR+xGGfQxGi3TEZ9bg1/9xGQ9xo=; b=LxX0P33II6XEhKvoN0fL7/ElSLXTw5CCW8RSrhESAR20DMgOI1ms9sS4J2q1/EVikB nYPQNQDvsDOPnn4nCcx/rDAGNzEcu0iagqNEv53ESeTJ2pWChpkkWzF9bkBys17oemjT cSJQpMTq9GkQSridj5qNuLuaKQg2KhcPkfMXjeLIdYh8HY9kM6vRznv6TYUCqPQClk9T m+vgZQv9sI9mHhXACHzSOCRqs4vR15hAuTL264GraozrdoEB7bZnUowjSbGFdCevCCnI C5GQmBrdiYYaSGVoTJTRtOlPXLQ7XkALeHYIqPrHWOUobQcnxbxcm7WxTWsoZInDG81W M6BA== X-Forwarded-Encrypted: i=1; AJvYcCX4D3xoiM+x8mbD5pkhbl5DlOsju0VcLEZ/DtxKWeC0BPsOFnJZbuHsXHhXrBFM3syOp8QFtX+1qzJbBxpHr4ejfj/xp2autA== X-Gm-Message-State: AOJu0YwtDeV6sC730cC1EyTUkbfLFQCcmcKSo91YSSvxOTd21e84VFWL vrKDiRlUtOiB5qyCg4rAYqWy44LTCjqh5hVk8Ynk/jfcpRY/K1aZ X-Google-Smtp-Source: AGHT+IF/AqXsnd6kaZAkcodz/b9sWqTW0d6z2+2yb4nAVyp/72vLVPg0F7gFv6iZmTcLeksXpVDFmA== X-Received: by 2002:a9d:784d:0:b0:6e2:b28f:6179 with SMTP id c13-20020a9d784d000000b006e2b28f6179mr13058525otm.1.1708411790592; Mon, 19 Feb 2024 22:49:50 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id o3-20020a0568301c4300b006e458661199sm328744otg.79.2024.02.19.22.49.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 22:49:50 -0800 (PST) Message-ID: Date: Mon, 19 Feb 2024 23:49:48 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH] RISC-V: Fix CTZ unnecessary sign extension [PR #106888] Content-Language: en-US To: Alexandre Oliva , gcc-patches@gcc.gnu.org Cc: Kito Cheng , Palmer Dabbelt , Andrew Waterman , Jim Wilson , Raphael Moreira Zinsly 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 2/19/24 21:26, Alexandre Oliva wrote: > This backport for gcc-13 is required for pr90838.c to get the expected > count of andi instructions on riscv64-elf, rather than fail because of > two extra andi insns in functions where it is not necessary. (On > riscv32-elf, it passes). Regstrapped on x86_64-linux-gnu, along with > other backports, and tested manually on riscv64-elf. Ok to install? > > From: Raphael Moreira Zinsly > > Changes since v1: > - Remove subreg from operand 1. > > -- >8 -- > > We were not able to match the CTZ sign extend pattern on RISC-V > because it gets optimized to zero extend and/or to ANDI patterns. > For the ANDI case, combine scrambles the RTL and generates the > extension by using subregs. > > gcc/ChangeLog: > PR target/106888 > * config/riscv/bitmanip.md > (disi2): Match with any_extend. > (disi2_sext): New pattern to match > with sign extend using an ANDI instruction. > > gcc/testsuite/ChangeLog: > PR target/106888 > * gcc.target/riscv/pr106888.c: New test. > * gcc.target/riscv/zbbw.c: Check for ANDI. In general, shouldn't backports be focused on correctness issues? It's unclear what the motivation is for backporting this change into gcc-13. Not objecting, trying understand at this stage. Jeff