From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) by sourceware.org (Postfix) with ESMTPS id 2D2903857C40 for ; Sun, 19 Nov 2023 19:42:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D2903857C40 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 2D2903857C40 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700422968; cv=none; b=tZhm/l8Am1qHA79WJM78bHF7zF7CiuYnIkyfBk/E0uCaOq3Pd/Tg5dBKtmNVggOjD439BdnNc5ZcdgcGhRmE3ywq4O/6gXv3gNFhiIGbcyDVfupKaXtX6Tq8r1TM+DKQ/F79qeTN7nZLnUNZvC9qXcvZs8Hf/n+1bPC0kfRjCww= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700422968; c=relaxed/simple; bh=fbIIO8LKXfMIoqpfmJzYgxV68EkuGf6fRLqomQmct0s=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=v9LXcsjojiTM1dY0MrhXBFWo8uqVjMx8lrYgOvjs+B8qGqOqT1qHva9UUf9aTGTtqPlyrwhOXN7Uq/HA/ZuUD/wo32URMQJ5S3Mj9pJr7ZxlPlPV3L5RkIYeCnbhQPedEW7kD3g59UlLWYXXXhwC5MFwbWPM4LxOPgYnLGHc86E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-58786e23d38so2337231eaf.3 for ; Sun, 19 Nov 2023 11:42:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700422966; x=1701027766; 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=1EIDMDC9xG0F2RIVwC6tyy4j2NQxRZhTzoJ1YL/o/04=; b=mvQ1P1dysZXKvFAgcpG6lpMALJQT5eZn8JWcvPVqkshqg9WlGOHran4CiXoGyckWlP YV752ImsCOCudErwXuzvFVwaTHBTq7KwNqnGiFAWeMJif9IkaqSBkPi71/wZezKdewKH +2RRsrAQbZQY3nGeKGQbdOeEVRLuBv61WBdbxqE6y+HxCLK7QKSoxofcuSwZbK09Lcjn tYpCkKaGETcnDXRS0Q8rX3kir/Kc3m27QGr/IaZH++K4o8vqwY0xpV0ki7JXma6AmyIb ddEWUBta/1G13DepDVMV80maeJjWlK2z+9D2Pg0DT2QGkuwYHu9pJ6lenW70KrbPymKM roZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700422966; x=1701027766; 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=1EIDMDC9xG0F2RIVwC6tyy4j2NQxRZhTzoJ1YL/o/04=; b=stjs7vu6adGy1n1HlHSxwUJMroVmIbyDbJ/1f8WdTW2tiLiUJs/i6Omy1dEVIMhFbA Ozz5Y2DmjS9HvnJpiUO5XPqHNXOIPn914qUt/U6PA0ko576vzFDwgbs46MWz6iguhvx2 wtaia3rUU0DxeHColuzR/NhcfIvEW8iY56SZGmE7maRyLAy/0B50ekzSS8DytSQKVxj3 tkB7QoUrME/QAHM8fnsB03x8BqcbuSSebjoOKrsixGGtq3oLuxxwQsPwDmI/r8p2Nbeb j2IFS23Y3cdPeTBHlC6WQlYrozPn6qCgPYywJSRnysbcgtA8WUyMtI+tYSZZUQOTJkLA /GLg== X-Gm-Message-State: AOJu0YwMsZiwYqvsWpFPqSBi8KwhQl5ZBIPm+0TgIEbLjyPF5St1bQzu GefP/3mq1Wn0tkkORDMkXZ8= X-Google-Smtp-Source: AGHT+IEE54lt9clCbrqu0yntoXe4miKnVpCVPkn7BeQBT0D+NFJyRxGC5b4MyEseMQ7PfL3KdyJt9w== X-Received: by 2002:a05:6820:1502:b0:58a:231d:750d with SMTP id ay2-20020a056820150200b0058a231d750dmr6329493oob.9.1700422966385; Sun, 19 Nov 2023 11:42:46 -0800 (PST) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id 62-20020a4a0641000000b00581debbeeb4sm1187488ooj.1.2023.11.19.11.42.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Nov 2023 11:42:45 -0800 (PST) Message-ID: <6c95d298-a854-4976-bc31-830b9e1cde09@gmail.com> Date: Sun, 19 Nov 2023 12:42:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 34/44] RISC-V: Provide FP conditional-branch instructions for if-conversion Content-Language: en-US To: "Maciej W. Rozycki" , gcc-patches@gcc.gnu.org Cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt 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=-1.5 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,URIBL_BLACK autolearn=no 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/18/23 22:42, Maciej W. Rozycki wrote: > Do not expand floating-point conditional-branch RTL instructions right > away that use a comparison operation that is either directly available > as a machine conditional-set instruction or is NE, which can be emulated > by EQ. This is so that if-conversion sees them in their original form > and can produce fewer operations tried in a branchless code sequence > compared to when such an instruction has been already converted to a > sequence of a floating-point conditional-set RTL instruction followed by > an integer conditional-branch RTL instruction. Split any floating-point > conditional-branch RTL instructions still remaining after reload then. > > Adjust the testsuite accordingly: since the middle end uses the inverse > condition internally, an inverse conditional-set instruction may make it > to assembly output and also `cond_move_process_if_block' will be used by > if-conversion rather than `noce_process_if_block', because the latter > function not yet been updated to handle inverted conditions. > > gcc/ > * config/riscv/predicates.md (ne_operator): New predicate. > * config/riscv/riscv.cc (riscv_insn_cost): Handle branches on a > floating-point condition. > * config/riscv/riscv.md (@cbranch4): Rename expander to... > (@cbranch4): ... this. Only expand the RTX via > `riscv_expand_conditional_branch' for `!signed_order_operator' > operators, otherwise let it through. > (*cbranch4, *cbranch4): New insns and > splitters. > > gcc/testsuite/ > * gcc.target/riscv/movdifge-sfb.c: Reject "if-conversion > succeeded through" rather than accepting it. > * gcc.target/riscv/movdifge-thead.c: Likewise. > * gcc.target/riscv/movdifge-ventana.c: Likewise. > * gcc.target/riscv/movdifge-zicond.c: Likewise. > * gcc.target/riscv/movdifgt-sfb.c: Likewise. > * gcc.target/riscv/movdifgt-thead.c: Likewise. > * gcc.target/riscv/movdifgt-ventana.c: Likewise. > * gcc.target/riscv/movdifgt-zicond.c: Likewise. > * gcc.target/riscv/movdifle-sfb.c: Likewise. > * gcc.target/riscv/movdifle-thead.c: Likewise. > * gcc.target/riscv/movdifle-ventana.c: Likewise. > * gcc.target/riscv/movdifle-zicond.c: Likewise. > * gcc.target/riscv/movdiflt-sfb.c: Likewise. > * gcc.target/riscv/movdiflt-thead.c: Likewise. > * gcc.target/riscv/movdiflt-ventana.c: Likewise. > * gcc.target/riscv/movdiflt-zicond.c: Likewise. > * gcc.target/riscv/movsifge-sfb.c: Likewise. > * gcc.target/riscv/movsifge-thead.c: Likewise. > * gcc.target/riscv/movsifge-ventana.c: Likewise. > * gcc.target/riscv/movsifge-zicond.c: Likewise. > * gcc.target/riscv/movsifgt-sfb.c: Likewise. > * gcc.target/riscv/movsifgt-thead.c: Likewise. > * gcc.target/riscv/movsifgt-ventana.c: Likewise. > * gcc.target/riscv/movsifgt-zicond.c: Likewise. > * gcc.target/riscv/movsifle-sfb.c: Likewise. > * gcc.target/riscv/movsifle-thead.c: Likewise. > * gcc.target/riscv/movsifle-ventana.c: Likewise. > * gcc.target/riscv/movsifle-zicond.c: Likewise. > * gcc.target/riscv/movsiflt-sfb.c: Likewise. > * gcc.target/riscv/movsiflt-thead.c: Likewise. > * gcc.target/riscv/movsiflt-ventana.c: Likewise. > * gcc.target/riscv/movsiflt-zicond.c: Likewise. > * gcc.target/riscv/smax-ieee.c: Also accept FLT.D. > * gcc.target/riscv/smaxf-ieee.c: Also accept FLT.S. > * gcc.target/riscv/smin-ieee.c: Also accept FGT.D. > * gcc.target/riscv/sminf-ieee.c: Also accept FGT.S. So this is a more gradual lowering of the FP branches to allow ifcvt to do a better job. Seems generally reasonable. I don't expect that we're missing any significant simplifications, though I probably could construct a missed CSE/GCSE if I worked at it for a bit. Presumably the length computation can't be handled by the generic code we've already got in place? OK for the trunk. jeff