From patchwork Sun Nov 19 05:35:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 16751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1504696vqn; Sat, 18 Nov 2023 21:35:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8xrgE/eeXvmQaXKeVrwTAs6K/31Sqd+DqskdmZcNnpv71NMWiDPdL3liMp9a+7ev9Z/W0 X-Received: by 2002:a37:e30b:0:b0:778:9156:3f07 with SMTP id y11-20020a37e30b000000b0077891563f07mr4473183qki.24.1700372144196; Sat, 18 Nov 2023 21:35:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372144; cv=pass; d=google.com; s=arc-20160816; b=kbx2Dte0MK4Wt0hrsheivWy2K3Ce15Qk1VjrXxNkd7cxmlFuUObcFyDan1ggyr3dAk AApeIIF671xZRPgpn+2jQK4j5E2nNT6ZEvqTRzBdJs3RWB5iE5c+3CaNNm31WA6aJTZa YsTC5CqgsDKxtARzDx67pnzDuxPf1k5QrFjR38MqpiwvIWuFRJogPjhQyQs0L9COoViF gBjYMWp8qUNCHD6tG3gdRkakEsV1tV4mq6DI4BGjQBGNDF0p2B4s/Mg5AQOxEScatyv1 G232XNiOxrB2h7dB7ANYmFkFSkwDkLgf5vXQafuQE0EJeIPhiEUQ20hawEwYS56lhFr/ EwmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:subject:cc:to:from:date:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=xUckQAHqFPux0WnaoYwdzWJRAv9n4QzJnECH4j7oJsA=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=SO0kXcVrC+QH3IPMImbwt4i8ZFa3LK35wvgZmrLgUNfJv9OCRNO3mG9nmDolEGEpLh rtarswSdD1pm1SshbD6HYoIHtDZmRdaLOaLP2I5jeJCu+jlJ+wah19h7DyVVgNgJ6YwZ S0SGxDloQbJYNv2FG9gdpDo0dXlJYJCK/5jLHSxsq3ofe4CtMtws8Vd/XK2j6sgkZG9l DgTtS9pdXEFF7tW62zVtVnF9OGQIxAFpgelNZOCuP4PPiEGjet2nR0RL4gGbzFzVSb+0 es3VUUaFGkCn+q1sY8Je9P7cKk75O/yykkuSOm8C38jZp2zu7tbKJtW3K3w9s+7m3hf/ 5luQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=B7c8+sel; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 15-20020a05620a04cf00b00778914a69acsi4835667qks.569.2023.11.18.21.35.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:35:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=B7c8+sel; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9FA538582A1 for ; Sun, 19 Nov 2023 05:35:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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-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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782969421924997989 X-GMAIL-MSGID: 1782969421924997989 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