public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR testsuite/52011: add regparm to LTO/TM tests
@ 2012-01-27 15:14 Aldy Hernandez
  2012-01-27 16:01 ` Patrick Marlier
  2012-01-27 19:43 ` Richard Henderson
  0 siblings, 2 replies; 6+ messages in thread
From: Aldy Hernandez @ 2012-01-27 15:14 UTC (permalink / raw)
  To: gcc-patches, Richard Henderson

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

The LTO/TM tests are failing with a type mismatch on x86-32 because of 
the missing regparm on the prototype.

I have added the regparm, and abstracted things a bit so we don't have 
to keep multiple copies.  It's bad enough that we have to reproduce this 
once...

OK?

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 4187 bytes --]

testsuite/
	PR testsuite/52011
	* gcc.dg/lto/trans-mem.h: New file.
	* gcc.dg/lto/trans-mem-2_0.c: Include it.
	* gcc.dg/lto/trans-mem-1_1.c: Same.
	* gcc.dg/lto/trans-mem-4_1.c: Same.
	* gcc.dg/lto/trans-mem-3_1.c: Same.

Index: testsuite/gcc.dg/lto/trans-mem-2_0.c
===================================================================
--- testsuite/gcc.dg/lto/trans-mem-2_0.c	(revision 183537)
+++ testsuite/gcc.dg/lto/trans-mem-2_0.c	(working copy)
@@ -2,19 +2,10 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target stdint_types } */
 
-#include <stdint.h>
+#include "trans-mem.h"
 
 extern void foobar() __attribute__((transaction_callable));
 
-#define noinline __attribute__((noinline,noclone,used))
-
-noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(""); }
-noinline void _ITM_commitTransaction (void) { asm(""); }
-noinline void _ITM_WU4 (void *a, uint32_t b) { asm(""); }
-noinline void _ITM_WU8 (void *a, uint64_t b) { asm(""); }
-noinline void _ITM_registerTMCloneTable (void) { asm(""); }
-noinline void _ITM_deregisterTMCloneTable (void) { asm(""); }
-
 main()
 {
   __transaction_relaxed
Index: testsuite/gcc.dg/lto/trans-mem-4_1.c
===================================================================
--- testsuite/gcc.dg/lto/trans-mem-4_1.c	(revision 183537)
+++ testsuite/gcc.dg/lto/trans-mem-4_1.c	(working copy)
@@ -1,14 +1,6 @@
-#include <stdint.h>
+#include "trans-mem.h"
 
 __attribute__((transaction_safe))
 void foo() 
 {
 }
-
-uint32_t _ITM_beginTransaction(uint32_t prop, ...)
-{
-}
-
-void __builtin__ITM_commitTransaction (void)
-{
-}
Index: testsuite/gcc.dg/lto/trans-mem.h
===================================================================
--- testsuite/gcc.dg/lto/trans-mem.h	(revision 0)
+++ testsuite/gcc.dg/lto/trans-mem.h	(revision 0)
@@ -0,0 +1,22 @@
+#include <stdint.h>
+
+/* Dummy declarations for common TM supporting functions.  */
+
+/* These must be in sync with both libitm/libitm.h and the TM builtin
+   definitions in gcc/gtm-builtins.def.  */
+
+#define noinline __attribute__((noinline,noclone,used))
+
+#ifdef __i386__
+/* Only for 32-bit x86.  */
+# define ITM_REGPARM	__attribute__((regparm(2)))
+#else
+# define ITM_REGPARM
+#endif
+
+ITM_REGPARM noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(""); }
+ITM_REGPARM noinline void _ITM_commitTransaction (void) { asm(""); }
+ITM_REGPARM noinline void _ITM_WU4 (void *a, uint32_t b) { asm(""); }
+ITM_REGPARM noinline void _ITM_WU8 (void *a, uint64_t b) { asm(""); }
+noinline void _ITM_registerTMCloneTable (void) { asm(""); }
+noinline void _ITM_deregisterTMCloneTable (void) { asm(""); }
Index: testsuite/gcc.dg/lto/trans-mem-1_1.c
===================================================================
--- testsuite/gcc.dg/lto/trans-mem-1_1.c	(revision 183537)
+++ testsuite/gcc.dg/lto/trans-mem-1_1.c	(working copy)
@@ -1,10 +1 @@
-#include <stdint.h>
-
-#define noinline __attribute__((noinline,noclone,used))
-
-noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(""); }
-noinline void _ITM_commitTransaction (void) { asm(""); }
-noinline void _ITM_WU4 (void *a, uint32_t b) { asm(""); }
-noinline void _ITM_WU8 (void *a, uint64_t b) { asm(""); }
-noinline void _ITM_registerTMCloneTable (void) { asm(""); }
-noinline void _ITM_deregisterTMCloneTable (void) { asm(""); }
+#include "trans-mem.h"
Index: testsuite/gcc.dg/lto/trans-mem-3_1.c
===================================================================
--- testsuite/gcc.dg/lto/trans-mem-3_1.c	(revision 183537)
+++ testsuite/gcc.dg/lto/trans-mem-3_1.c	(working copy)
@@ -1,6 +1,6 @@
 /* { dg-options "-fgnu-tm" } */
 
-#include <stdint.h>
+#include "trans-mem.h"
 
 extern int i;
 
@@ -8,12 +8,3 @@ main()
 {
   __transaction_atomic { i = 0; }
 }
-
-#define noinline __attribute__((noinline,noclone,used))
-
-noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(""); }
-noinline void _ITM_commitTransaction (void) { asm(""); }
-noinline void _ITM_WU4 (void *a, uint32_t b) { asm(""); }
-noinline void _ITM_WU8 (void *a, uint64_t b) { asm(""); }
-noinline void _ITM_registerTMCloneTable (void) { asm(""); }
-noinline void _ITM_deregisterTMCloneTable (void) { asm(""); }

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

* Re: PR testsuite/52011: add regparm to LTO/TM tests
  2012-01-27 15:14 PR testsuite/52011: add regparm to LTO/TM tests Aldy Hernandez
@ 2012-01-27 16:01 ` Patrick Marlier
  2012-01-27 16:02   ` Aldy Hernandez
  2012-01-27 19:43 ` Richard Henderson
  1 sibling, 1 reply; 6+ messages in thread
From: Patrick Marlier @ 2012-01-27 16:01 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: gcc-patches, Richard Henderson

On 01/27/2012 10:14 AM, Aldy Hernandez wrote:
> +ITM_REGPARM noinline uint32_t _ITM_beginTransaction(uint32_t a, ...) { asm(""); }

No ITM_REGPARM here. It should be also removed from libitm.h.

--
Patrick.

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

* Re: PR testsuite/52011: add regparm to LTO/TM tests
  2012-01-27 16:01 ` Patrick Marlier
@ 2012-01-27 16:02   ` Aldy Hernandez
  2012-01-27 16:11     ` Patrick Marlier
  0 siblings, 1 reply; 6+ messages in thread
From: Aldy Hernandez @ 2012-01-27 16:02 UTC (permalink / raw)
  To: Patrick Marlier; +Cc: gcc-patches, Richard Henderson

On 01/27/12 10:00, Patrick Marlier wrote:
> On 01/27/2012 10:14 AM, Aldy Hernandez wrote:
>> +ITM_REGPARM noinline uint32_t _ITM_beginTransaction(uint32_t a, ...)
>> { asm(""); }
>
> No ITM_REGPARM here. It should be also removed from libitm.h.
>
> --
> Patrick.
>

I'm ok either way.  I'm just trying to get 32-bits to pass the tests.

If you all agree to remove ITM_REGPARM from libitm.h, then the tests on 
x86-32 will work.  What is the status of this-- was there agreement on 
removing regparm?

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

* Re: PR testsuite/52011: add regparm to LTO/TM tests
  2012-01-27 16:02   ` Aldy Hernandez
@ 2012-01-27 16:11     ` Patrick Marlier
  2012-01-27 19:43       ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Marlier @ 2012-01-27 16:11 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: gcc-patches, Richard Henderson

On 01/27/2012 11:02 AM, Aldy Hernandez wrote:
> If you all agree to remove ITM_REGPARM from libitm.h, then the tests on
> x86-32 will work.  What is the status of this-- was there agreement on
> removing regparm?

Note that I meant only for _ITM_beginTransaction. Indeed, regparm is 
ignored with variadic functions.
See discussion here:
http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00933.html
http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00924.html

Patrick.

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

* Re: PR testsuite/52011: add regparm to LTO/TM tests
  2012-01-27 15:14 PR testsuite/52011: add regparm to LTO/TM tests Aldy Hernandez
  2012-01-27 16:01 ` Patrick Marlier
@ 2012-01-27 19:43 ` Richard Henderson
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2012-01-27 19:43 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: gcc-patches

On 01/28/2012 02:14 AM, Aldy Hernandez wrote:
> testsuite/
> 	PR testsuite/52011
> 	* gcc.dg/lto/trans-mem.h: New file.
> 	* gcc.dg/lto/trans-mem-2_0.c: Include it.
> 	* gcc.dg/lto/trans-mem-1_1.c: Same.
> 	* gcc.dg/lto/trans-mem-4_1.c: Same.
> 	* gcc.dg/lto/trans-mem-3_1.c: Same.

Ok.


r~

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

* Re: PR testsuite/52011: add regparm to LTO/TM tests
  2012-01-27 16:11     ` Patrick Marlier
@ 2012-01-27 19:43       ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2012-01-27 19:43 UTC (permalink / raw)
  To: Patrick Marlier; +Cc: Aldy Hernandez, gcc-patches

On 01/28/2012 03:11 AM, Patrick Marlier wrote:
> On 01/27/2012 11:02 AM, Aldy Hernandez wrote:
>> If you all agree to remove ITM_REGPARM from libitm.h, then the tests on
>> x86-32 will work.  What is the status of this-- was there agreement on
>> removing regparm?
> 
> Note that I meant only for _ITM_beginTransaction. Indeed, regparm is ignored with variadic functions.
> See discussion here:
> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00933.html
> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00924.html

It's ignored.  It's not actively wrong.
I'm for leaving it alone, actually.


r~

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

end of thread, other threads:[~2012-01-27 19:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27 15:14 PR testsuite/52011: add regparm to LTO/TM tests Aldy Hernandez
2012-01-27 16:01 ` Patrick Marlier
2012-01-27 16:02   ` Aldy Hernandez
2012-01-27 16:11     ` Patrick Marlier
2012-01-27 19:43       ` Richard Henderson
2012-01-27 19:43 ` Richard Henderson

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