public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed][nvptx] Use '%' as register prefix
@ 2022-03-22 13:42 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-03-22 13:42 UTC (permalink / raw)
  To: gcc-patches

Hi,

The percentage sign as first character of a ptx identifier can be used to
avoid name conflicts, e.g., between user-defined variable names and
compiler-generated names.

The insn nvptx_uniform_warp_check contains register names without '%' prefix,
which potentially could lead to name conflicts with user-defined variable
names.

Fix this by adding a '%' prefix, more specifically a '%r_' prefix to avoid a
name conflict with ptx special registers.

Tested on x86_64 with nvptx accelerator.

Committed to trunk.

Thanks,
- Tom

[nvptx] Use '%' as register prefix

gcc/ChangeLog:

2022-03-20  Tom de Vries  <tdevries@suse.de>

	PR target/104925
	* config/nvptx/nvptx.md (define_insn "nvptx_uniform_warp_check"):
	Use % as register prefix.

---
 gcc/config/nvptx/nvptx.md | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 5550ce25513..8ed685027b5 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -2280,13 +2280,14 @@ (define_insn "nvptx_uniform_warp_check"
   {
     const char *insns[] = {
       "{",
-      "\\t"	      ".reg.b32"	"\\t" "act;",
-      "%.\\t"	      "vote.ballot.b32" "\\t" "act,1;",
-      "\\t"	      ".reg.pred"	"\\t" "do_abort;",
-      "\\t"	      "mov.pred"	"\\t" "do_abort,0;",
-      "%.\\t"	      "setp.ne.b32"	"\\t" "do_abort,act,0xffffffff;",
-      "@ do_abort\\t" "trap;",
-      "@ do_abort\\t" "exit;",
+      "\\t"		  ".reg.b32"	    "\\t" "%%r_act;",
+      "%.\\t"		  "vote.ballot.b32" "\\t" "%%r_act,1;",
+      "\\t"		  ".reg.pred"	    "\\t" "%%r_do_abort;",
+      "\\t"		  "mov.pred"	    "\\t" "%%r_do_abort,0;",
+      "%.\\t"		  "setp.ne.b32"	    "\\t" "%%r_do_abort,%%r_act,"
+						  "0xffffffff;",
+      "@ %%r_do_abort\\t" "trap;",
+      "@ %%r_do_abort\\t" "exit;",
       "}",
       NULL
     };

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-22 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 13:42 [committed][nvptx] Use '%' as register prefix Tom de Vries

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).