public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@vnet.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: David Edelsohn <dje.gcc@gmail.com>,
	       Tulio Magno Quites Machado Filho
	<tuliom@linux.vnet.ibm.com>,
	       "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
Subject: [PATCH, rs6000] Fix source operand contraints for tabort. pattern
Date: Mon, 03 Aug 2015 19:39:00 -0000	[thread overview]
Message-ID: <1438630768.5030.8.camel@otta> (raw)

This patch fixes an oversight in the tabort. pattern (only generated via
the __builtin_tabort (cause) builtin), which currently allows using r0.
The problem is that if r0 is used, the "cause" argument value passed in
by the user will be ignored, since using r0 means the value zero and not
the contents of r0 (similar to base registers in loads/stores, addi, etc.).
This patch restricts the tabort. pattern to only use base registers.

This has passed bootstrapping and regtesting on trunk.  Ok for mainline?

I'd like to also backport this to the release branches.  Is this ok for
them once bootstrapping and regtesting are complete on them?

Peter

gcc/
	* config/rs6000/htm.md (tabort.): Restrict the source operand to
	using a base register.

gcc/testsuite/
	* gcc.target/powerpc/htm-tabort-no-r0.c: New test.


Index: gcc/config/rs6000/htm.md
===================================================================
--- gcc/config/rs6000/htm.md	(revision 226516)
+++ gcc/config/rs6000/htm.md	(working copy)
@@ -48,7 +48,7 @@
 
 (define_insn "tabort"
   [(set (match_operand:CC 1 "cc_reg_operand" "=x")
-	(unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
+	(unspec_volatile:CC [(match_operand:SI 0 "base_reg_operand" "b")]
 			    UNSPECV_HTM_TABORT))]
   "TARGET_HTM"
   "tabort. %0"
Index: gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c	(working copy)
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_htm_ok } */
+/* { dg-options "-O2 -mhtm -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12" } */
+
+/* { dg-final { scan-assembler-not "tabort\\.\[ \t\]0" } } */
+
+int
+foo (void)
+{
+  return __builtin_tabort (10);
+}


             reply	other threads:[~2015-08-03 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 19:39 Peter Bergner [this message]
2015-08-03 20:27 ` David Edelsohn
2015-08-04  2:40   ` Peter Bergner

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=1438630768.5030.8.camel@otta \
    --to=bergner@vnet.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=murphyp@linux.vnet.ibm.com \
    --cc=tuliom@linux.vnet.ibm.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).