Message ID | 20230210224150.2801962-8-philipp.tomsich@vrull.eu |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1214546wrn; Fri, 10 Feb 2023 14:47:22 -0800 (PST) X-Google-Smtp-Source: AK7set/3xREG0AM/sTSQFGjrhh/oMUVl5PnTNZGcaPJU7cEBExPIoChWOe9zuLwIquVt/eYqU1X8 X-Received: by 2002:a17:907:7628:b0:887:ebaa:7adb with SMTP id jy8-20020a170907762800b00887ebaa7adbmr16895960ejc.12.1676069242209; Fri, 10 Feb 2023 14:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676069242; cv=none; d=google.com; s=arc-20160816; b=Ir8NtWNyM5y5DF8yyKuBTs54CvLSkCJ7AkufoKotz/eb1LvIi3L9QMZ4UeIHpt40Fr miO271Vnj2inz1Wv6OneNV2v9RhC+Q8xqaZV4+7+v9MFJb10i309v8lvkzr6SO8WZeCk 7VI7UuLU3o4y/I5GQjwYvQGuKJseuF1VtgvMGm2CmimJ3HyH5Y7z0lefbNmcaAJQDvtq zjYcZT8aLXXOMfsh21psWhovORE0wxlyzL/+UUh8mcGRAy7lmPo3LEPT9p1I67BmT2Or ECdesxjUTgEV0xsRyG7+wCF1E8yt1ZcIOhDRy9HBKhAD92U41GCNiVUob9Ut+cuzq3rT tFUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=+mVEWzBYbxNsPTC4LhYIO4HlW1rrZO7Aog0YjWTPMts=; b=i9IeQe4VC+uQXeKtaR1k/rblT7uW0PWgCBsxWaEIXC4l0WAsl4pMVhC9VxrM47CzBF 0KQbnhUeTS8taX8k7/VYB0vifTnFj99MVL85jYRAECRebneKYIk+a4xaF/3h9nZPGyQN RNE8BQXvVcv411qAAT0jRfvxYsJYucDxFjAVpm7fzmf97WV5j9Fag9A1HxPqwDtHr7Zt OnPMasPTZ7uC7cnaTGayB9918V4bqOJZlUNCBbsdaSq+a+d6Rh6hELoxDlHJ0J8726qN p7HvbS+PTOTTkqE45H8STJa9AiVhZR1f13ym7I7GPIG24aWUgoLP36MeZySZSSmlQn7B m2nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=ROirhVAI; 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 sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j6-20020a170906534600b008aac09413a6si7764975ejo.968.2023.02.10.14.47.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 14:47:22 -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=@vrull.eu header.s=google header.b=ROirhVAI; 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 5EFE23889E12 for <ouuuleilei@gmail.com>; Fri, 10 Feb 2023 22:43:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 639A0383FB93 for <gcc-patches@gcc.gnu.org>; Fri, 10 Feb 2023 22:42:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 639A0383FB93 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-ej1-x634.google.com with SMTP id lu11so19518664ejb.3 for <gcc-patches@gcc.gnu.org>; Fri, 10 Feb 2023 14:42:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+mVEWzBYbxNsPTC4LhYIO4HlW1rrZO7Aog0YjWTPMts=; b=ROirhVAIz8uqA84Qt95R2421SNkVmw34wUpW0WUlbOoTcFuDx4KXHXTJDlF9lhO4Hx QoHNfhS0SHfL9KS3p4HywlkbDh/KGCLYBs+LmDDsRZWUHhzF04bBG77NujUIXDdtHIIN zHXChfbSXU1jHpe1v6mJDu2ub1NgiPD6yM/5XuM8lSTS59q11i8RLLeqsxWRa8VBVU2M NwnUNu0eIs5LTL/pMK9W8q9ZUDXCNU0QngJ4RLxcXVS7b1EU1AQo+huZTMgTWXc4exUW WAc7wZDulEWBRBzsQ0eVpKw613gDNNdsAHlqwbEV3Fz2M3oChCTkBYug+FmWBjgART5u UuOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+mVEWzBYbxNsPTC4LhYIO4HlW1rrZO7Aog0YjWTPMts=; b=vaGypflCQd9z5zepa5+HUlwpPxP2o8h1J43q/b92otPa3N16ebU55VnekrMKpS44Ns 5TlCpom+xWkvS15antbob8BMUl7qgx3s0d2EP/uP/YyyzM2NARvsRF1pnj65+JTX9jH0 7Sq2WL8iSxFkrQv8IIwit3N6gauMlT7uWI+mziasUzCPwvZb5gpXo5iMI8PIZ2I2pfI8 8mrSpj5k2+H9W6qisT/WSeSOh9v9iumlF10qbAFe2dm2KzovbbM5yzEDh2eGZ5yjgnth eJGRtjcuXp4i1+/SeII3DxYX3Yi9wznX0g+kG7eUyCS3pvtkmm9pEva6utCtmzVNKJEA MnKA== X-Gm-Message-State: AO0yUKUISghNJVB6zzfEqnk+ekJ8gcZxK71ivUjA4poivArICaSNCjyy KvXoiLQcXC4NPFeJ9RWlwoSpCCiz+KKZG6TnUIY= X-Received: by 2002:a17:907:208c:b0:878:8249:bef6 with SMTP id pv12-20020a170907208c00b008788249bef6mr15201303ejb.59.1676068920774; Fri, 10 Feb 2023 14:42:00 -0800 (PST) Received: from ubuntu-focal.. ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id c15-20020a17090603cf00b0088bd62b1cbbsm2976956eja.192.2023.02.10.14.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 14:42:00 -0800 (PST) From: Philipp Tomsich <philipp.tomsich@vrull.eu> To: gcc-patches@gcc.gnu.org Cc: Kito Cheng <kito.cheng@gmail.com>, Christoph Muellner <christoph.muellner@vrull.eu>, Palmer Dabbelt <palmer@rivosinc.com>, Andrew Waterman <andrew@sifive.com>, Vineet Gupta <vineetg@rivosinc.com>, Philipp Tomsich <philipp.tomsich@vrull.eu> Subject: [RFC PATCH v1 07/10] RISC-V: Recognize bexti in negated if-conversion Date: Fri, 10 Feb 2023 23:41:47 +0100 Message-Id: <20230210224150.2801962-8-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230210224150.2801962-1-philipp.tomsich@vrull.eu> References: <20230210224150.2801962-1-philipp.tomsich@vrull.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757485981728475857?= X-GMAIL-MSGID: =?utf-8?q?1757485981728475857?= |
Series |
RISC-V: Support the Zicond (conditional-operations) extension
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Philipp Tomsich
Feb. 10, 2023, 10:41 p.m. UTC
While the positive case "if ((bits >> SHAMT) & 1)" for SHAMT 0..10 can
trigger conversion into efficient branchless sequences
- with Zbs (bexti + neg + and)
- with Zicond (andi + czero.nez)
the inverted/negated case results in
andi a5,a0,1024
seqz a5,a5
neg a5,a5
and a5,a5,a1
due to how the sequence presents to the combine pass.
This adds an additional splitter to reassociate the polarity reversed
case into bexti + addi, if Zbs is present.
gcc/ChangeLog:
* config/riscv/zicond.md: Add split to reassociate
"andi + seqz + neg" into "bexti + addi".
Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
---
gcc/config/riscv/zicond.md | 10 ++++++++++
1 file changed, 10 insertions(+)
Comments
On 2/10/23 15:41, Philipp Tomsich wrote: > While the positive case "if ((bits >> SHAMT) & 1)" for SHAMT 0..10 can > trigger conversion into efficient branchless sequences > - with Zbs (bexti + neg + and) > - with Zicond (andi + czero.nez) > the inverted/negated case results in > andi a5,a0,1024 > seqz a5,a5 > neg a5,a5 > and a5,a5,a1 > due to how the sequence presents to the combine pass. > > This adds an additional splitter to reassociate the polarity reversed > case into bexti + addi, if Zbs is present. > > gcc/ChangeLog: > > * config/riscv/zicond.md: Add split to reassociate > "andi + seqz + neg" into "bexti + addi". OK. jeff
diff --git a/gcc/config/riscv/zicond.md b/gcc/config/riscv/zicond.md index 15fdaa539f1..0aad61c7009 100644 --- a/gcc/config/riscv/zicond.md +++ b/gcc/config/riscv/zicond.md @@ -143,3 +143,13 @@ (define_split { operands[2] = GEN_INT(1 << UINTVAL(operands[2])); }) + +(define_split + [(set (match_operand:X 0 "register_operand") + (neg:X (eq:X (zero_extract:X (match_operand:X 1 "register_operand") + (const_int 1) + (match_operand 2 "immediate_operand")) + (const_int 0))))] + "!TARGET_ZICOND && TARGET_ZBS" + [(set (match_dup 0) (zero_extract:X (match_dup 1) (const_int 1) (match_dup 2))) + (set (match_dup 0) (plus:X (match_dup 0) (const_int -1)))])