public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@embecosm.com>
To: gcc-patches@gcc.gnu.org
Cc: Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>,
	 Kito Cheng <kito.cheng@gmail.com>,
	Palmer Dabbelt <palmer@dabbelt.com>
Subject: [PATCH 1/2] RISC-V/testsuite: Add RTL pr105314.c testcase variants
Date: Wed, 24 Jan 2024 11:16:42 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.20.2401241105360.14163@tpp.orcam.me.uk> (raw)
In-Reply-To: <alpine.DEB.2.20.2401241102150.14163@tpp.orcam.me.uk>

Add a pair of RTL tests, for RV64 and RV32 respectively, corresponding 
to the existing pr105314.c test.  They have been produced from RTL code 
as at the entry of the "ce1" pass for pr105314.c compiled at -O3.

	gcc/testsuite/
	* gcc.target/riscv/pr105314-rtl.c: New file.
	* gcc.target/riscv/pr105314-rtl32.c: New file.
---
 gcc/testsuite/gcc.target/riscv/pr105314-rtl.c   |   78 ++++++++++++++++++++++++
 gcc/testsuite/gcc.target/riscv/pr105314-rtl32.c |   78 ++++++++++++++++++++++++
 2 files changed, 156 insertions(+)

gcc-test-riscv-pr105314-rtl.diff
Index: gcc/gcc/testsuite/gcc.target/riscv/pr105314-rtl.c
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/gcc.target/riscv/pr105314-rtl.c
@@ -0,0 +1,78 @@
+/* PR rtl-optimization/105314 */
+/* { dg-do compile } */
+/* { dg-require-effective-target rv64 } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-fdump-rtl-ce1" } */
+
+long __RTL (startwith ("ce1"))
+foo (long a, long b, long c)
+{
+(function "foo"
+  (param "a"
+    (DECL_RTL (reg/v:DI <1> [ a ]))
+    (DECL_RTL_INCOMING (reg:DI a0 [ a ])))
+  (param "b"
+    (DECL_RTL (reg/v:DI <2> [ b ]))
+    (DECL_RTL_INCOMING (reg:DI a1 [ b ])))
+  (param "c"
+    (DECL_RTL (reg/v:DI <3> [ c ]))
+    (DECL_RTL_INCOMING (reg:DI a2 [ c ])))
+  (insn-chain
+    (block 2
+      (edge-from entry (flags "FALLTHRU"))
+      (cnote 8 [bb 2] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 2 (set (reg/v:DI <1> [ a ])
+                    (reg:DI a0 [ a ])) "pr105314.c":8:1
+               (expr_list:REG_DEAD (reg:DI a0 [ a ])))
+      (cinsn 4 (set (reg/v:DI <3> [ c ])
+                    (reg:DI a2 [ c ])) "pr105314.c":8:1
+               (expr_list:REG_DEAD (reg:DI a2 [ c ])))
+      (cnote 5 NOTE_INSN_FUNCTION_BEG)
+      (cjump_insn 10 (set (pc)
+                          (if_then_else (ne (reg/v:DI <3> [ c ])
+                                            (const_int 0))
+                                        (label_ref:DI 23)
+                                        (pc))) "pr105314.c":9:6
+                     (expr_list:REG_DEAD (reg/v:DI <3> [ c ])
+                                         (int_list:REG_BR_PROB 536870916)))
+      (edge-to 4)
+      (edge-to 3 (flags "FALLTHRU"))
+    ) ;; block 2
+    (block 3
+      (edge-from 2 (flags "FALLTHRU"))
+      (cnote 11 [bb 3] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 6 (set (reg/v:DI <0> [ <retval> ])
+                    (reg/v:DI <1> [ a ])) "pr105314.c":9:6
+               (expr_list:REG_DEAD (reg/v:DI <1> [ a ])))
+      (edge-to 5 (flags "FALLTHRU"))
+    ) ;; block 3
+    (block 4
+      (edge-from 2)
+      (clabel 23 3)
+      (cnote 22 [bb 4] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 7 (set (reg/v:DI <0> [ <retval> ])
+                    (const_int 0)) "pr105314.c":10:7)
+      (edge-to 5 (flags "FALLTHRU"))
+    ) ;; block 4
+    (block 5
+      (edge-from 4 (flags "FALLTHRU"))
+      (edge-from 3 (flags "FALLTHRU"))
+      (clabel 16 1)
+      (cnote 19 [bb 5] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 17 (set (reg/i:DI a0)
+                     (reg/v:DI <0> [ <retval> ])) "pr105314.c":12:1
+                (expr_list:REG_DEAD (reg/v:DI <0> [ <retval> ])))
+      (cinsn 18 (use (reg/i:DI a0)) "pr105314.c":12:1)
+      (edge-to exit (flags "FALLTHRU"))
+    ) ;; block 5
+  ) ;; insn-chain
+  (crtl
+    (return_rtx
+      (reg/i:DI a0)
+    ) ;; return_rtx
+  ) ;; crtl
+) ;; function "foo"
+}
+
+/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_store_flag_mask" 1 "ce1" } } */
+/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */
Index: gcc/gcc/testsuite/gcc.target/riscv/pr105314-rtl32.c
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/gcc.target/riscv/pr105314-rtl32.c
@@ -0,0 +1,78 @@
+/* PR rtl-optimization/105314 */
+/* { dg-do compile } */
+/* { dg-require-effective-target rv32 } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" "-flto" } } */
+/* { dg-options "-fdump-rtl-ce1" } */
+
+long __RTL (startwith ("ce1"))
+foo (long a, long b, long c)
+{
+(function "foo"
+  (param "a"
+    (DECL_RTL (reg/v:SI <1> [ a ]))
+    (DECL_RTL_INCOMING (reg:SI a0 [ a ])))
+  (param "b"
+    (DECL_RTL (reg/v:SI <2> [ b ]))
+    (DECL_RTL_INCOMING (reg:SI a1 [ b ])))
+  (param "c"
+    (DECL_RTL (reg/v:SI <3> [ c ]))
+    (DECL_RTL_INCOMING (reg:SI a2 [ c ])))
+  (insn-chain
+    (block 2
+      (edge-from entry (flags "FALLTHRU"))
+      (cnote 8 [bb 2] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 2 (set (reg/v:SI <1> [ a ])
+                    (reg:SI a0 [ a ])) "pr105314.c":8:1
+               (expr_list:REG_DEAD (reg:SI a0 [ a ])))
+      (cinsn 4 (set (reg/v:SI <3> [ c ])
+                    (reg:SI a2 [ c ])) "pr105314.c":8:1
+               (expr_list:REG_DEAD (reg:SI a2 [ c ])))
+      (cnote 5 NOTE_INSN_FUNCTION_BEG)
+      (cjump_insn 10 (set (pc)
+                          (if_then_else (ne (reg/v:SI <3> [ c ])
+                                            (const_int 0))
+                                        (label_ref:SI 23)
+                                        (pc))) "pr105314.c":9:6
+                     (expr_list:REG_DEAD (reg/v:SI <3> [ c ])
+                                         (int_list:REG_BR_PROB 536870916)))
+      (edge-to 4)
+      (edge-to 3 (flags "FALLTHRU"))
+    ) ;; block 2
+    (block 3
+      (edge-from 2 (flags "FALLTHRU"))
+      (cnote 11 [bb 3] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 6 (set (reg/v:SI <0> [ <retval> ])
+                    (reg/v:SI <1> [ a ])) "pr105314.c":9:6
+               (expr_list:REG_DEAD (reg/v:SI <1> [ a ])))
+      (edge-to 5 (flags "FALLTHRU"))
+    ) ;; block 3
+    (block 4
+      (edge-from 2)
+      (clabel 23 3)
+      (cnote 22 [bb 4] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 7 (set (reg/v:SI <0> [ <retval> ])
+                    (const_int 0)) "pr105314.c":10:7)
+      (edge-to 5 (flags "FALLTHRU"))
+    ) ;; block 4
+    (block 5
+      (edge-from 4 (flags "FALLTHRU"))
+      (edge-from 3 (flags "FALLTHRU"))
+      (clabel 16 1)
+      (cnote 19 [bb 5] NOTE_INSN_BASIC_BLOCK)
+      (cinsn 17 (set (reg/i:SI a0)
+                     (reg/v:SI <0> [ <retval> ])) "pr105314.c":12:1
+                (expr_list:REG_DEAD (reg/v:SI <0> [ <retval> ])))
+      (cinsn 18 (use (reg/i:SI a0)) "pr105314.c":12:1)
+      (edge-to exit (flags "FALLTHRU"))
+    ) ;; block 5
+  ) ;; insn-chain
+  (crtl
+    (return_rtx
+      (reg/i:SI a0)
+    ) ;; return_rtx
+  ) ;; crtl
+) ;; function "foo"
+}
+
+/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_store_flag_mask" 1 "ce1" } } */
+/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */

       reply	other threads:[~2024-01-24 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.DEB.2.20.2401241102150.14163@tpp.orcam.me.uk>
2024-01-24 11:16 ` Maciej W. Rozycki [this message]
2024-01-24 17:09   ` Jeff Law
2024-01-24 11:16 ` [PATCH 2/2] RISC-V/testsuite: Add RTL cset-sext.c " Maciej W. Rozycki
2024-01-24 17:10   ` 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=alpine.DEB.2.20.2401241105360.14163@tpp.orcam.me.uk \
    --to=macro@embecosm.com \
    --cc=andrew@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.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).