Message ID | f913b618-f708-2018-898b-57a8b84bb07f@ventanamicro.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1697302vqr; Mon, 7 Aug 2023 13:37:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOKvwt8rBPoVC8ILaxgKrE1Z1zlfcD0mTWgPI+P+bekUYdAvbaPyd10M5RNqPVO2icxmVn X-Received: by 2002:aa7:da4a:0:b0:522:2af1:1ffe with SMTP id w10-20020aa7da4a000000b005222af11ffemr8442562eds.9.1691440631453; Mon, 07 Aug 2023 13:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691440631; cv=none; d=google.com; s=arc-20160816; b=HXGsB4r6yQJPatedzjWqw7o8Uyo15aKhcCtVRqAtedwaIOh1KMOxm5a4BfLog4H8sW KqQelEaZGm7HjUQYgMQI9+n0dFhG+Z4WLlsh2XUYHjoFslpN54csmIXV0Eb+1/l24uRh 4gXpUOyGsMIOVD5glmF9Cr8a0dbOlzB/5awslW0zTU4FcgoEFpuVqXDow3vIOivfyVMT Dr8H7cdgTiN+ixFYJZ3Wc5julubm95hn56eD+O/WwJompGVJKRuQ5m/eMuCEpXqOLktc Ew7bmKvMGO5EeSaM+n+usAFbXTl28pvnj+2O/Et14P6hxcq4CeROtQ79igMc028eLCmq 2WCQ== 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:subject:from:to :content-language:user-agent:mime-version:date:message-id :dkim-signature:dmarc-filter:delivered-to; bh=7FEETwbNRpqSJhaQB0VwEHGvzPE0G6owz67bXKAZ8Jc=; fh=XfztniJdlnJJI5goKEgZQuCSjgdXye833KYusDMmipc=; b=ZrRwNojM+hlNnOyD1KEZ0rMd5rTqsQgXeTIrmkJ5hRrkTLxI/RJGmlzoB+nzud/SC8 hZPV+4OYwd9h2vOZfSwT9bFS+t50HvjfhlbmJXphXo3lvBG+soFC/qqeNGvlmQl3HKKR oaXVnTAushWUz5xl1vGg5hqSUezu0De7iIeXpefUNe7oPp2zsAmoW75n+Hzoagg2IYY2 mDXy3P5PY2oml+Q1PRBdXguM1dQ2LI8kX55qqKombI53H1jstKQoWSV6c3HvCQomWR72 A9y7kHhWQGkPhH/XXTVs4lQmuPY+S9jm+0zSP61k9nMBNCqLhAG+zf9NZzhvlyy0aZ97 kH4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=b1FRAZVY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y10-20020aa7ccca000000b005233fec6feesi643007edt.427.2023.08.07.13.37.11 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 13:37:11 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=b1FRAZVY; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 167F83858005 for <ouuuleilei@gmail.com>; Mon, 7 Aug 2023 20:37:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id A6F743858D28 for <gcc-patches@gcc.gnu.org>; Mon, 7 Aug 2023 20:36:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6F743858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-268bc714ce0so4048764a91.0 for <gcc-patches@gcc.gnu.org>; Mon, 07 Aug 2023 13:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1691440599; x=1692045399; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=7FEETwbNRpqSJhaQB0VwEHGvzPE0G6owz67bXKAZ8Jc=; b=b1FRAZVYEDWYV2kHT71RwdlGdw0jY3sBSxKn/aTLwAlO7dp7HdvpMWLnAxQRMwGExQ 5Ld9uGCSCKxWQe1oWky5CbcG0yuA6EafuFSPdwG52W4tE0Q1B8dyxZ61sphWQMFGeDp/ 1Kegf3L8bn61tBN71FQjGwa0O/RUFfQOUAeH4LhMvH76zAVaQ4g7ciky1GYRU/vGJSvG 91n3B4RXS5azZuxHwnsGE4UHiYeFuGcKDliYvdjpfkK7Q3813RCN5N8Q1PKQMcNlL645 eyZvDNx3hmPbAz+pSv2bsMHz8Gh+lCaYg+FMAmm+P+ov+G0mSs8cU1vZQenSgaHZP/Qp sK3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691440599; x=1692045399; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7FEETwbNRpqSJhaQB0VwEHGvzPE0G6owz67bXKAZ8Jc=; b=g26eTTH57fLSK70SwsYq+bYmj4rvNmv1YPLcDsp7hDaU0njGkj3dFv802iWuDT9Btz GQa0clVq4hTCDu5IWwh8VUW7ZcThfraBnpoogNHjfGJFCU+RnxmzHkxLluXp5tJsbH8J z0DkdRKcPx8VhUGC40ZyMxfkHrgxE1GVmS2BT9H83a7heWILaw2Yr5UTjk23Th59sNp6 LnjARnKZUk2ESuz0OK9Teod3Po4ZhgUHFL1sRzQuk9rhkbhx720zQJbJBRBQllYRflwy tzn4MbSkZI72gWSlty7tMsdSlSn93L/ntBzz2lWxUHsqlTCY2XHYfMzH90BEFfdYIiSe jM4g== X-Gm-Message-State: AOJu0Yz640lF4rdhRmVx0lz6o5F9+APVMS0Q4t45njawQ4EB0ehpxq3/ 7dTogfnVp3N2I2lP+lm38YOCRw6hnt/A1HS0XYVISw== X-Received: by 2002:a17:90a:cb0d:b0:268:d716:4b69 with SMTP id z13-20020a17090acb0d00b00268d7164b69mr9684436pjt.22.1691440599114; Mon, 07 Aug 2023 13:36:39 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id b21-20020a17090acc1500b002633fa95ac2sm9068355pju.13.2023.08.07.13.36.38 for <gcc-patches@gcc.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Aug 2023 13:36:38 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------KfCJYMbHJ2148MgzJVoXiLjv" Message-ID: <f913b618-f708-2018-898b-57a8b84bb07f@ventanamicro.com> Date: Mon, 7 Aug 2023 14:36:37 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org> From: Jeff Law <jlaw@ventanamicro.com> Subject: [committed][RISC-V]Don't reject constants in cmov condition X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: INBOX X-GMAIL-THRID: 1773604051494003694 X-GMAIL-MSGID: 1773604051494003694 |
Series |
[committed,RISC-V] Don't reject constants in cmov condition
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jeff Law
Aug. 7, 2023, 8:36 p.m. UTC
This test is too aggressive. Constants have VOIDmode, so we need to let the through this phase of conditional move support. Fixes several missed conditional moves with the trunk. Committed to the trunk, Jeff commit 18c453f0e633abb9b317947b011ec6e07780fba8 Author: Jeff Law <jlaw@ventanamicro.com> Date: Mon Aug 7 14:34:40 2023 -0600 [committed][RISC-V]Don't reject constants in cmov condition This test is too aggressive. Constants have VOIDmode, so we need to let the through this phase of conditional move support. Fixes several missed conditional moves with the trunk. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Allow VOIDmode operands to conditional before canonicalization.
Comments
On 8/7/23 13:36, Jeff Law wrote:
> Fixes several missed conditional moves with the trunk.
I'm curious, how do you know what's missing. Does ifc have some stats
like autovec which explicitly reports missed opportunities ?
-Vineet
On 8/7/23 17:42, Vineet Gupta wrote: > > On 8/7/23 13:36, Jeff Law wrote: >> Fixes several missed conditional moves with the trunk. > > I'm curious, how do you know what's missing. Does ifc have some stats > like autovec which explicitly reports missed opportunities ? Xiao's testcases :-) I haven't even got to the point of trying our internal ones. yet. jeff
Hi Jeff, On 8/7/23 13:36, Jeff Law wrote: > > This test is too aggressive. Constants have VOIDmode, so we need to > let the through this phase of conditional move support. > > Fixes several missed conditional moves with the trunk. > > Committed to the trunk, As discussed this morning, this triggers an ICE when building glibc for rv64_zicond programs/ld-ctype.c:3977:1: error: unrecognizable insn: 3977 | } | ^ (insn 238 237 239 18 (set (reg:SI 727) (if_then_else:SI (eq:SI (reg:SI 725) (const_int 0 [0])) (const_int 0 [0]) (reg:SI 721))) -1 (nil)) during RTL pass: vregs programs/ld-ctype.c:3977:1: internal compiler error: in extract_insn, at recog.cc:2791 0x885de7 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) ../.././gcc/gcc/rtl-error.cc:108 0x885e09 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*) ../.././gcc/gcc/rtl-error.cc:116 0x8846f9 extract_insn(rtx_insn*) ../.././gcc/gcc/recog.cc:2791 0xcf77ae instantiate_virtual_regs_in_insn ../.././gcc/gcc/function.cc:1610 0xcf77ae instantiate_virtual_regs ../.././gcc/gcc/function.cc:1983 0xcf77ae execute ../.././gcc/gcc/function.cc:2030 Here's the reduced reproducer. a, c; long b; d() { for (;;) if (a & (b < 8 ?: 1 << b)) c = 1; } I'll try to muster a fix :-) Thx, -Vineet
On 8/8/23 11:21, Vineet Gupta wrote: > Hi Jeff, > > On 8/7/23 13:36, Jeff Law wrote: >> >> This test is too aggressive. Constants have VOIDmode, so we need to >> let the through this phase of conditional move support. >> >> Fixes several missed conditional moves with the trunk. >> >> Committed to the trunk, > > As discussed this morning, this triggers an ICE when building glibc for > rv64_zicond > > programs/ld-ctype.c:3977:1: error: unrecognizable insn: > 3977 | } > | ^ > (insn 238 237 239 18 (set (reg:SI 727) > (if_then_else:SI (eq:SI (reg:SI 725) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:SI 721))) -1 > (nil)) > during RTL pass: vregs > programs/ld-ctype.c:3977:1: internal compiler error: in extract_insn, at > recog.cc:2791 > 0x885de7 _fatal_insn(char const*, rtx_def const*, char const*, int, char > const*) ../.././gcc/gcc/rtl-error.cc:108 > 0x885e09 _fatal_insn_not_found(rtx_def const*, char const*, int, char > const*) ../.././gcc/gcc/rtl-error.cc:116 > 0x8846f9 extract_insn(rtx_insn*) ../.././gcc/gcc/recog.cc:2791 > 0xcf77ae instantiate_virtual_regs_in_insn ../.././gcc/gcc/function.cc:1610 > 0xcf77ae instantiate_virtual_regs ../.././gcc/gcc/function.cc:1983 > 0xcf77ae execute ../.././gcc/gcc/function.cc:2030 > > Here's the reduced reproducer. > > a, c; > long b; > d() { > for (;;) > if (a & (b < 8 ?: 1 << b)) > c = 1; > } > > I'll try to muster a fix :-) :-) That's even simpler than the one I just reduced. But I can see the same basic structure in my reduced case. I'll take it from here. I mucked something up, so I feel I ought to fix it. jeff
On 8/8/23 11:21, Vineet Gupta wrote: > Hi Jeff, > > On 8/7/23 13:36, Jeff Law wrote: >> >> This test is too aggressive. Constants have VOIDmode, so we need to >> let the through this phase of conditional move support. >> >> Fixes several missed conditional moves with the trunk. >> >> Committed to the trunk, > > As discussed this morning, this triggers an ICE when building glibc for > rv64_zicond > > programs/ld-ctype.c:3977:1: error: unrecognizable insn: > 3977 | } > | ^ > (insn 238 237 239 18 (set (reg:SI 727) > (if_then_else:SI (eq:SI (reg:SI 725) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:SI 721))) -1 > (nil)) > during RTL pass: vregs > programs/ld-ctype.c:3977:1: internal compiler error: in extract_insn, at > recog.cc:2791 > 0x885de7 _fatal_insn(char const*, rtx_def const*, char const*, int, char > const*) ../.././gcc/gcc/rtl-error.cc:108 > 0x885e09 _fatal_insn_not_found(rtx_def const*, char const*, int, char > const*) ../.././gcc/gcc/rtl-error.cc:116 > 0x8846f9 extract_insn(rtx_insn*) ../.././gcc/gcc/recog.cc:2791 > 0xcf77ae instantiate_virtual_regs_in_insn ../.././gcc/gcc/function.cc:1610 > 0xcf77ae instantiate_virtual_regs ../.././gcc/gcc/function.cc:1983 > 0xcf77ae execute ../.././gcc/gcc/function.cc:2030 > > Here's the reduced reproducer. > > a, c; > long b; > d() { > for (;;) > if (a & (b < 8 ?: 1 << b)) > c = 1; > } > > I'll try to muster a fix :-) Should be fixed now, with a regression test in the suite. Thanks, jeff
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 279304afc19..5248dd3febe 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -3582,7 +3582,8 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt) enforce that so that we don't strip away a sign_extension thinking it is unnecessary. We might consider using riscv_extend_operands if they are not already properly extended. */ - if (GET_MODE (op0) != word_mode || GET_MODE (op1) != word_mode) + if ((GET_MODE (op0) != word_mode && GET_MODE (op0) != VOIDmode) + || (GET_MODE (op1) != word_mode && GET_MODE (op1) != VOIDmode)) return false; /* Canonicalize the comparison. It must be an equality comparison