public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick O'Neill <patrick@rivosinc.com>
To: Jeff Law <jlaw@ventanamicro.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] RISC-V: Make stack_save_restore tests more robust
Date: Fri, 27 Oct 2023 10:34:57 -0700	[thread overview]
Message-ID: <e4e3846b-dacd-435c-b6c1-305b91e22f94@rivosinc.com> (raw)
In-Reply-To: <10382874-cea3-93d3-de15-bc3b7383cd61@ventanamicro.com>

[-- Attachment #1: Type: text/plain, Size: 4958 bytes --]


On 8/25/23 15:36, Jeff Law wrote:
> Spurred by Jivan's patch and a desire for cleaner testresults, I went 
> ahead and make the stack_save_restore tests independent of the precise 
> stack size by using a regexp.
>
> Pushed to the trunk.
>
> Jeff

Hi Jeff, A recent change that I'm still bisecting [1] caused 
stack_save_restore_2.c to start failing.

Debug log:

Executing on host: /github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/build/build-gcc-linux-stage2/gcc/xgcc -B/github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/build/build-gcc-linux-stage2/gcc/  /github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/gcc/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c  -march=rv32gcv -mabi=ilp32d -mcmodel=medlow   -fdiagnostics-plain-output    -O0  -march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto -S   -o stack_save_restore_2.s    (timeout = 600)
spawn -ignore SIGHUP /github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/build/build-gcc-linux-stage2/gcc/xgcc -B/github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/build/build-gcc-linux-stage2/gcc/ /github/patrick-postcommit-runner-1/_work/gcc-postcommit-ci/gcc-postcommit-ci/riscv-gnu-toolchain/gcc/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c -march=rv32gcv -mabi=ilp32d -mcmodel=medlow -fdiagnostics-plain-output -O0 -march=rv32imafc -mabi=ilp32f -msave-restore -O2 -fno-schedule-insns -fno-schedule-insns2 -fno-unroll-loops -fno-peel-loops -fno-lto -S -o stack_save_restore_2.s
PASS: gcc.target/riscv/stack_save_restore_2.c   -O0  (test for excess errors)
body: \tcall	t0,__riscv_save_(3|4)
\taddi	sp,sp,-[0-9]+
.*\tli	t0,-[0-9]+
\tadd	sp,sp,t0
.*\tli	t0,[0-9]+
\tadd	sp,sp,t0
.*\taddi	sp,sp,[0-9]+
\ttail	__riscv_restore_(3|4)

against: 	call	t0,__riscv_save_5
	addi	sp,sp,-2016
	fsw	fs0,2012(sp)
	fsw	fs1,2008(sp)
	fsw	fs2,2004(sp)
	fsw	fs3,2000(sp)
	fsw	fs4,1996(sp)
	li	t0,-12288
	add	sp,sp,t0
	call	getf
	fmv.s	fs1,fa0
	call	getf
	fmv.s	fs4,fa0
	call	getf
	fmv.s	fs3,fa0
	call	getf
	fmv.s	fs2,fa0
	li	s0,0
	fmv.s.x	fs0,zero
	lui	a5,%hi(.LC0)
	lw	s2,%lo(.LC0)(a5)
	lw	s3,%lo(.LC0+4)(a5)
	addi	s4,sp,1984
	li	s1,4096
	addi	s1,s1,-528
	call	my_getchar
	call	__floatsidf
	mv	a2,s2
	mv	a3,s3
	call	__muldf3
	call	__truncdfsf2
	slli	a5,s0,2
	add	a5,s4,a5
	fsw	fa0,-1984(a5)
	flw	fa5,-1984(a5)
	fadd.s	fs0,fs0,fa5
	addi	s0,s0,1
	bne	s0,s1,.L2
	fadd.s	fa5,fs1,fs0
	fadd.s	fa5,fa5,fs4
	fadd.s	fa5,fa5,fs3
	fadd.s	fa5,fa5,fs2
	fcvt.w.s a0,fa5,rtz
	li	t0,12288
	add	sp,sp,t0
	flw	fs0,2012(sp)
	flw	fs1,2008(sp)
	flw	fs2,2004(sp)
	flw	fs3,2000(sp)
	flw	fs4,1996(sp)
	addi	sp,sp,2016
	tail	__riscv_restore_5

FAIL: gcc.target/riscv/stack_save_restore_2.c   -O0   check-function-bodies bar

It looks like the issue is that your regex matches
__riscv_save_(3|4) where now gcc emits __riscv_restore_5.

Would it be OK to update the regex to also accept 5 (& are we going to 
bump into this again)?

diff --git a/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c 
b/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
index 4c549cb11ae..bc95736cf8e 100644
--- a/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
+++ b/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
@@ -7,7 +7,7 @@ float getf();

  /*
  ** bar:
-**     call    t0,__riscv_save_(3|4)
+**     call    t0,__riscv_save_(3|4|5)
  **     addi    sp,sp,-[0-9]+
  **     ...
  **     li      t0,-[0-9]+
@@ -17,7 +17,7 @@ float getf();
  **     add     sp,sp,t0
  **     ...
  **     addi    sp,sp,[0-9]+
-**     tail    __riscv_restore_(3|4)
+**     tail    __riscv_restore_(3|4|5)
  */
  int bar()
  {

If we're going to run into this again, it might make sense to allow a 
wider range of numbers (up to 9):

diff --git a/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c 
b/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
index 4c549cb11ae..1d5b950130e 100644
--- a/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
+++ b/gcc/testsuite/gcc.target/riscv/stack_save_restore_2.c
@@ -7,7 +7,7 @@ float getf();

  /*
  ** bar:
-**     call    t0,__riscv_save_(3|4)
+**     call    t0,__riscv_save_([3-9])
  **     addi    sp,sp,-[0-9]+
  **     ...
  **     li      t0,-[0-9]+
@@ -17,7 +17,7 @@ float getf();
  **     add     sp,sp,t0
  **     ...
  **     addi    sp,sp,[0-9]+
-**     tail    __riscv_restore_(3|4)
+**     tail    __riscv_restore_([3-9])
  */
  int bar()
  {

Patrick

[1] The commit is in this range:
https://github.com/gcc-mirror/gcc/compare/a4ca8691333344cecc595d1af8b21e51f588e2f2...4d49685d671e4e604b2b873ada65aaac89348794

  reply	other threads:[~2023-10-27 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 22:36 Jeff Law
2023-10-27 17:34 ` Patrick O'Neill [this message]
2023-10-27 17:42   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4e3846b-dacd-435c-b6c1-305b91e22f94@rivosinc.com \
    --to=patrick@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jlaw@ventanamicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).