public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Fix source operand contraints for tabort. pattern
@ 2015-08-03 19:39 Peter Bergner
  2015-08-03 20:27 ` David Edelsohn
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Bergner @ 2015-08-03 19:39 UTC (permalink / raw)
  To: GCC Patches
  Cc: David Edelsohn, Tulio Magno Quites Machado Filho, Paul E. Murphy

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);
+}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, rs6000] Fix source operand contraints for tabort. pattern
  2015-08-03 19:39 [PATCH, rs6000] Fix source operand contraints for tabort. pattern Peter Bergner
@ 2015-08-03 20:27 ` David Edelsohn
  2015-08-04  2:40   ` Peter Bergner
  0 siblings, 1 reply; 3+ messages in thread
From: David Edelsohn @ 2015-08-03 20:27 UTC (permalink / raw)
  To: Peter Bergner
  Cc: GCC Patches, Tulio Magno Quites Machado Filho, Paul E. Murphy

On Mon, Aug 3, 2015 at 3:39 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> 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.

Okay.

Thanks, David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, rs6000] Fix source operand contraints for tabort. pattern
  2015-08-03 20:27 ` David Edelsohn
@ 2015-08-04  2:40   ` Peter Bergner
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Bergner @ 2015-08-04  2:40 UTC (permalink / raw)
  To: David Edelsohn
  Cc: GCC Patches, Tulio Magno Quites Machado Filho, Paul E. Murphy

On Mon, 2015-08-03 at 16:27 -0400, David Edelsohn wrote:
> On Mon, Aug 3, 2015 at 3:39 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> > 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?
[snip]
> Okay.

Thanks, I have now committed this to trunk and the 4.9 and 5 branches.

Peter



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-04  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 19:39 [PATCH, rs6000] Fix source operand contraints for tabort. pattern Peter Bergner
2015-08-03 20:27 ` David Edelsohn
2015-08-04  2:40   ` Peter Bergner

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