From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by sourceware.org (Postfix) with ESMTPS id 75B80387545A for ; Fri, 29 Sep 2023 19:43:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 75B80387545A 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-io1-xd2d.google.com with SMTP id ca18e2360f4ac-79fa425855cso435999739f.2 for ; Fri, 29 Sep 2023 12:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696016601; x=1696621401; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qIdK71jhC5IPpe/1yjekntN4cPRv6hImoa9bkCnXYtY=; b=FGePmhfGNw0Ew7Ze4MYdkTHfN3Z4yZBEcZsJaPHKoh6yoOyIUrJiAJIh4Z+77SmGEe 6YEgTyo3f/lvJuL58ogtvOiqZwQairBdoc/IriBibVkY45R/jLi7fkBbarj2SSP58E7Q MR0xtlo1IymJHk8mUg6+/8Vu5NxDtZWMu7sInlKcZBHImAQKzO1R0L15mAboesRIsAMJ M+kLqf8lsq6sqUS9RQO+VeT4sFku/x/T+NQAq9mLeohXLu25HOlAk4IPfM0gqqT9vnOl uKZ4TJBuI0j35CTLUUnDCWz0iHb3enwMu9/UkivVf8g5Sp9fI4qMorPM4Fummko7KLnp Q7hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696016601; x=1696621401; h=content-transfer-encoding:in-reply-to:from:references: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=qIdK71jhC5IPpe/1yjekntN4cPRv6hImoa9bkCnXYtY=; b=aiHfWCaZiKubWcv/ubiHFKmVuPVDlWyMrNHxcJ8QFyIdVP1udYrddE+SmOG3RsMADy WL/s6KiSUtU2TK+Xen+htQN17163RSacL+3pXGp9MbEX303PQeSideg84Jhic16FltnL Y1p3EL7AZth/Y8Lach1E81ghD4tTgUgg+Wja+m0xgPAgWPO0c4uBeX/znbK8RVb9MIK6 vt5YnzHmu4q9W/xXRN12sxbh/POeDxmyYmJzlZfbwAAE2nSj7fcB7ANFs7BMaNy59B/S FvgiHmBnD/kLKGJIxSuiwP9aZLBtaK3W/3r5zwEkX2QNNnioR8eJdhPIKSuA7A23CYZl JU8A== X-Gm-Message-State: AOJu0YwpyVeXaLUwZWkV1JmR1zS+iJEs1xTBFFqewQFKDrFmqUbtIjCk lDO0TBGTwlTS3sK4CEOvsUM= X-Google-Smtp-Source: AGHT+IGm3m7/epqWqNsrailhjgofiDL2X278dAF96kwsM5qyVy2Zk5rhn5NUOuHNKdG8OVNcOJxGlw== X-Received: by 2002:a5d:9754:0:b0:791:acd7:233f with SMTP id c20-20020a5d9754000000b00791acd7233fmr4894113ioo.15.1696016600571; Fri, 29 Sep 2023 12:43:20 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id v13-20020a5ec10d000000b00786ef44ec28sm2128092iol.12.2023.09.29.12.43.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Sep 2023 12:43:20 -0700 (PDT) Message-ID: Date: Fri, 29 Sep 2023 13:43:19 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [V2] RISC-V: Replace not + bitwise_imm with li + bitwise_not Content-Language: en-US To: Jivan Hakobyan , GCC Patches 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 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 9/12/23 13:09, Jivan Hakobyan via Gcc-patches wrote: > In the case when we have C code like this > > int foo (int a) { > return 100 & ~a; > } > > GCC generates the following instruction sequence > > foo: > not a0,a0 > andi a0,a0,100 > ret > > This patch replaces that with this sequence > foo: > li a5,100 > andn a0,a5,a0 > ret > > The profitability comes from an out-of-order processor being able to > issue the "li a5, 100" at any time after it's fetched while "not a0, a0" has > to wait until any prior setter of a0 has reached completion. > > > gcc/ChangeLog: > * config/riscv/bitmanip.md (*_not_const): New split > pattern. > > gcc/testsuite/ChangeLog: > * gcc.target/riscv/zbb-andn-orn-01.c: New test. > * gcc.target/riscv/zbb-andn-orn-02.c: Likewise. Thanks for the updated patch. I've pushed this to the trunk. jeff