Message ID | 20230718074249.236825-1-lehua.ding@rivai.ai |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1570862vqt; Tue, 18 Jul 2023 00:44:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlGinJQK+SF6UCWV+5b8EakXW89mCRF7esJ0SPZpOuPLuhzA37AFgMV6rGTen6P96oMtTcr1 X-Received: by 2002:aa7:d64c:0:b0:51b:ebd7:641a with SMTP id v12-20020aa7d64c000000b0051bebd7641amr12852119edr.7.1689666254445; Tue, 18 Jul 2023 00:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689666254; cv=none; d=google.com; s=arc-20160816; b=rmZbfAkuqBYRiY8HTWrcX2xZ/ZLKs4ULkPii0Y9veEow7AwMR4IZ4ooCDHCNlPpflS COFR86VDbka+jHRRaRdIxQ9gQlUOJvdDanzmTpoQZaP5iPG/EE+yvUb3kkrGNd1O1ZM/ /3smQeD2m9yw71g8z3NLi2Zr0My6/kV9OoO6nquKVek0i1/8pNIAtR9Yi+1to4MO4Vu2 MT/pweqFDuiqr4Hod11G7duGi/Q0Lp2EM8Um9TaYz6kRoPQYCYqnvHfLN3SGthmyj9Du AwrRToiAe1iB9492x4Zv8RDNP5KGmaLcRylHXoz00AFhWlL/dc4PmYxkQaxn5ONQnPut YFfg== 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:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=/xKxyMu1DUoS+ZRc6Ntogx7HT4obY/WSuhlCErxjddE=; fh=gTyau+cNmEmsMakPG5hn1BgV9dZ8F3BLCRVmJIys8DA=; b=aWPzQ8G6zOTv9eT4TctXZ8E96YGY293z/m4dGZsmsZZCOpwjhDNd4dcNavcbLEhasr qNKgDdYo7n9FUstwuu8+dPcd9X2rVPgayITVr81+71Za6sKQQ4s0MLtOBzBIR2QU+9/Z eG+JJNKUz6wGMZj1FVem4Wz0z2b3YWIh2ICoSCCtB4Rc9ywHyWS0YNLBcwzd3nxH3qRy Gy4pU3xjIwNxgCt0TloBWy2QI812RsI9boPHWqSKHhWdLW7zhBcn58ZP9/M2u2D/i9QY OlRjZHlnfUyUdI+pWxN83xNU9X4H6c8Vss4gfgiHciC50NCFRiWJakbEOXxA6e3GKNix MKJw== ARC-Authentication-Results: i=1; mx.google.com; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e2-20020a056402148200b0051e3c92a1f9si807873edv.675.2023.07.18.00.44.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 00:44:14 -0700 (PDT) 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; 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 275AA385C6DD for <ouuuleilei@gmail.com>; Tue, 18 Jul 2023 07:43:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by sourceware.org (Postfix) with ESMTPS id 1869D38582A1 for <gcc-patches@gcc.gnu.org>; Tue, 18 Jul 2023 07:42:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1869D38582A1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp84t1689666170tjal16oq Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 18 Jul 2023 15:42:49 +0800 (CST) X-QQ-SSF: 01400000000000B0F000000A0000000 X-QQ-FEAT: y0qVOEbMWtdD7V7UhsKV0AeHs8dnCthhzREIPSZ6eUmTvsQxJON9UL/6D2Q5t M2LQIAMPfdRGKIPKWFyCejcpJiJpl7K5Rd9xKfDxKizoeGZ1gbvBebLHZiRMPE1P4VlmkGR j2EnwAueUI/pRG4mr46vPsjW7V1AQgv5ZUxp9/pHx5SpdOANy9Az3fdxqkhIR581UErFKf9 J/ebR8T1TB6xpGDNoXSt9rlW6TAQoJ7+75S/TL754tXnPFawlk5m6q6V6QpMnO+RP1bgvks +x5OHt/bBUjvVmVYoNxQQRpDthJdzUnr3ziTCZE2oZtM/c+m9BbffbG/O2OyWqG+oprd9l+ /cN1cLRuoqPxz3d6M2kQjJfBJlv7GRQZS89OYMdyWm/KBwzn1R46Y7y5q05HMJ7JFqXIviz X-QQ-GoodBg: 2 X-BIZMAIL-ID: 11176714498835685664 From: Lehua Ding <lehua.ding@rivai.ai> To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, rdapp.gcc@gmail.com, kito.cheng@gmail.com, palmer@rivosinc.com, jeffreyalaw@gmail.com Subject: [PATCH] RISC-V: Fix testcase failed when default -mcmodel=medany Date: Tue, 18 Jul 2023 15:42:49 +0800 Message-Id: <20230718074249.236825-1-lehua.ding@rivai.ai> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz6a-0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_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.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: 1771743482322322946 X-GMAIL-MSGID: 1771743482322322946 |
Series |
RISC-V: Fix testcase failed when default -mcmodel=medany
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Lehua Ding
July 18, 2023, 7:42 a.m. UTC
Hi, This patch fix testcase failed when I build RISC-V GCC with -mcmodel=medany as default. If set to medany, stack_save_restore.c testcase will fail because of the reduced use of s3 registers in assembly (thus calling __riscv_save/store_3 instead of __riscv_save/store_4). Explicitly add -mcmodel=medlow to solve this problem. Best, Lehua gcc/testsuite/ChangeLog: * gcc.target/riscv/stack_save_restore.c: Add -mcmodel=medlow --- gcc/testsuite/gcc.target/riscv/stack_save_restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Not familiar with this stuff.
I leave it other RISC-V folks to review.
juzhe.zhong@rivai.ai
From: Lehua Ding
Date: 2023-07-18 15:42
To: gcc-patches
CC: juzhe.zhong; rdapp.gcc; kito.cheng; palmer; jeffreyalaw
Subject: [PATCH] RISC-V: Fix testcase failed when default -mcmodel=medany
Hi,
This patch fix testcase failed when I build RISC-V GCC with -mcmodel=medany
as default. If set to medany, stack_save_restore.c testcase will fail because of
the reduced use of s3 registers in assembly (thus calling __riscv_save/store_3
instead of __riscv_save/store_4). Explicitly add -mcmodel=medlow to solve this
problem.
Best,
Lehua
gcc/testsuite/ChangeLog:
* gcc.target/riscv/stack_save_restore.c: Add -mcmodel=medlow
---
gcc/testsuite/gcc.target/riscv/stack_save_restore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.target/riscv/stack_save_restore.c b/gcc/testsuite/gcc.target/riscv/stack_save_restore.c
index 522e706cfbf..a2430783474 100644
--- a/gcc/testsuite/gcc.target/riscv/stack_save_restore.c
+++ b/gcc/testsuite/gcc.target/riscv/stack_save_restore.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto" } */
+/* { dg-options "-march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto -mcmodel=medlow" } */
/* { dg-final { check-function-bodies "**" "" } } */
char my_getchar();
--
2.36.1
Hi Lehua, > This patch fix testcase failed when I build RISC-V GCC with -mcmodel=medany > as default. If set to medany, stack_save_restore.c testcase will fail because of > the reduced use of s3 registers in assembly (thus calling __riscv_save/store_3 > instead of __riscv_save/store_4). Explicitly add -mcmodel=medlow to solve this > problem. Wouldn't you rather want to adjust the test to not check for one register number but 3 or 4 instead? There might be future changes in default behavior that would invalidate the test as well. Regards Robin
Hi Robin, > Wouldn't you rather want to adjust the test to not check for one register > number but 3 or 4 instead? I think the purpose of this testcase is to check whether the modifications to the stack frame are as expected, so it is necessary to specify exactly whether three or four registers are saved. But I think its need to add another testcase which use another option -mcmodel=medany for coverage. > There might be future changes in default behavior > that would invalidate the test as well. Because -mcmodel is explicitly specified in the testcase, future changes to the default value of -mcmodel will not cause the test case to fail. Best, Lehua
Hi Lehua, > I think the purpose of this testcase is to check whether the modifications to > the stack frame are as expected, so it is necessary to specify exactly whether > three or four registers are saved. But I think its need to add another testcase > which use another option -mcmodel=medany for coverage. In general I'm fine with this small change of course, I just wonder if the test case is not brittle anyway. From what I can tell the respective change is independent of the actual number of registers so maybe it's enough to not compare the fully body but just make sure the addis are not present? That way, the test could also work for -march=rv64 (which saves one register less anyway regardless of mcmodel - but the change still helps) or maybe even with instruction scheduling. Would you mind checking this still? Thanks. If it turns out not to be possible, let's stick with the medany fix for now and add a TODO. Regards Robin
diff --git a/gcc/testsuite/gcc.target/riscv/stack_save_restore.c b/gcc/testsuite/gcc.target/riscv/stack_save_restore.c index 522e706cfbf..a2430783474 100644 --- a/gcc/testsuite/gcc.target/riscv/stack_save_restore.c +++ b/gcc/testsuite/gcc.target/riscv/stack_save_restore.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto" } */ +/* { dg-options "-march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto -mcmodel=medlow" } */ /* { dg-final { check-function-bodies "**" "" } } */ char my_getchar();