From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id B37E83858D33 for ; Sun, 19 Nov 2023 05:35:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B37E83858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B37E83858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372120; cv=none; b=dSZlf7C9IguFmclHUM77LIuyPiwWe4oidssLLCYFDHqImvNqb9CRberSbEMylq3TdWxoPfk5c5zC99bfed92D5978Qb5vqmeVDoly8zrrzsOoaT86sHzXmunEB6YlETntYRceXGNh1ZN4rUogEvtm8JjOKP4JphgMCxmHWrv8J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372120; c=relaxed/simple; bh=EXOh2MiilnxxXZjCFMyPRKshhXGIEf5UPudsVI0+alw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ZJrJpcmcbRAokjBe0ez4LY0GfsU6G8QxwbV1udj4YhQDR7ldn1UNCBACZ8dlugesbPu9F70q8hIspNUxdRMRyKDQbPO0YwSOstgpjqZ+NBS+r0vmGE28C3U3pzf4s10yQT8aPDpvc2lrlTN6++25AA15tqdXtRH3zBtJVDRKe9w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9c603e235d1so459266866b.3 for ; Sat, 18 Nov 2023 21:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372115; x=1700976915; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=xUckQAHqFPux0WnaoYwdzWJRAv9n4QzJnECH4j7oJsA=; b=B7c8+selaZdrtwu+WWLdExFCki0L+e0E/LPCYnKyrtIe42kaLvwhkzCvAzTBTIN708 5djy5f2S+A0NK99hgdRWHNXAURbipluvMchgulhzcm+a1shdihDYC57hF6nq0gAhETOA ifkFu417c7s/eT6Hq57d+tdqdcMCKHb3w3jDmzWYg0JbET+ey+rigcwE1ULIoAbQhblU Y5ExjA61e67t700fDf51t8VaMAa4CZgFMYokTxXZ+qjpObpuxts+WlB/6fxnoFyrlS6B B2178/skw7ckGql4cKKuQpzw/ZcgGg4YoKknlY09EH2PL2mnyFwRZXQv/j+klTMDnUGs vIlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372115; x=1700976915; h=mime-version:user-agent:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xUckQAHqFPux0WnaoYwdzWJRAv9n4QzJnECH4j7oJsA=; b=BqG6W+We6WtAmeI+nvMUMV++P+ar55z0pM+o7Rrbo2X25BzEVZNbHFp9t2hmKv04Gb FNwPXAz0WzdegytCLwqJJj+CFtVgFv0VkhqS2Od3+R9tE9SubJVDykt+SXVQFAIyvrkR fRgg7JoFL+rB1c/HXUH+ghPb6+09Y2IMJY3lW2juL0TXcw1kEZ0F9LVSEbtknYZnoMAZ Ok/ufXrxZc6Pktn6Yp5219gkUPVvoEXd+Ic1Kp8zkccytdDPsL6JTk5ZjTvlUalsbUk+ a37vkBQcP7wutZu4hdiscb9ACMRYd47cQgqy6Bz7nqFa5YUVU2dA9D8HhexaUmlx3G0W iJpA== X-Gm-Message-State: AOJu0YyP1emytZ1uJyCNvURari9CweEVmlTuP1domqcx8hjvJwQ9NOwK KIBgP80cdhd1rV22uvpoYOBGRNiN0poC94RXirWycw== X-Google-Smtp-Source: AGHT+IGwLln5eXa1+t/7NmHyZ9QXAs/PtXWs6eLMpiLWp96oR63sCaKaf9YIfTTKao2PzbcwvL62UA== X-Received: by 2002:a17:907:9384:b0:9be:6ff7:128a with SMTP id cm4-20020a170907938400b009be6ff7128amr2652682ejc.67.1700372115192; Sat, 18 Nov 2023 21:35:15 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id v11-20020a1709064e8b00b009829d2e892csm2578693eju.15.2023.11.18.21.35.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:35:14 -0800 (PST) Date: Sun, 19 Nov 2023 05:35:10 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 00/44] RISC-V: Various if-conversion fixes and improvements Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: Hi, This patch series has come out from a simple change to add generic conditional-move and conditional-add expansions for a yet-out-of-tree target, which has relatively expensive branches and no conditional operations beyond the base architecture conditional-set instructions. At one point I have concluded it may make sense to release this code to the general public, especially as some of the conditional execution sequences will trigger for targets we already have support for. Naturally as a part of a proper upstream submission I chose to add suitable test cases. Now these test cases triggered a lot of issues in our existing code and as I fixed them what was supposed to be a couple of patches has turned into this humongous patch series, including a branch costing model rework. Oh well. Please see individual change descriptions for the details. The overall patch series structure is as follows: - 01-02 add test cases covering the existing state that won't change throughout the patch series, - 03-08 make small preparatory clean-ups that do not change semantics, - 09-13 implement a branch cost model rework and add the associated test cases, - 14-24 make various improvements for integer conditional operations and add the associated test cases, - 25-28 add generic `movMODEcc' support and the associated test cases, - 29-31 add generic `addMODEcc' support and the associated test cases, - 32-44 make various improvements for floating-point conditional operations and add the associated test cases. There is potential here for middle end improvement, in particular branch costing is already documented in if-cvt.cc to be intended to consistently use BRANCH_COST, and then the generic conditional-move and conditional-add sequences could I suppose be emitted there in a target-agnostic way rather than being supplied by the backend. This I suppose could be investigated in the future if the RISC-V approach turned out potentially useful for other targets. This has been so far verified as follows, using SiFive HiFive Unmatched hardware and the `riscv64-linux-gnu' target: - New target test cases have been run with `-mtune=sifive-5-series', `-mtune=sifive-5-series/-march=rv32gc/-mabi=ilp32d' and `-mtune=sifive-5-series/-mmovcc/-mbranch-cost=8' DejaGNU board options. - The C language test suite has been run at significant points in the patch series with `-mtune=sifive-5-series' and (past 26/44) also with `-mtune=sifive-5-series/-mmovcc/-mbranch-cost=8', and selectively with `-mtune=sifive-7-series' and `-mtune=sifive-7-series/-mmovcc/-mbranch-cost=8' DejaGNU board options. Since this is huge and every test iteration takes a couple of hours I will continue running testing and may investigate running QEMU testing for the features the Unmatched does not support such as Zicond. I don't expect real issues however. There are a bunch of issues triggered with `-mmovcc/-mbranch-cost=8' or with lone `-mbranch-cost=8' even and the vector test cases, which are either due to match patterns expecting an assembly label that has been reordered or are similar to PR target/112092 and which are not a problem with this patch series, but rather one with the vector testsuite or code. Any questions, comments, or concerns? Otherwise OK to apply? Maciej