* [patch] 10/n: trans-mem: compiler tests (1 of 3)
@ 2011-11-03 18:37 Aldy Hernandez
2011-11-03 20:33 ` Joseph S. Myers
0 siblings, 1 reply; 3+ messages in thread
From: Aldy Hernandez @ 2011-11-03 18:37 UTC (permalink / raw)
To: gcc-patches
Index: gcc/testsuite/gcc.dg/tm/irrevocable-5.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-5.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-5.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa -O" } */
+
+int a;
+
+void foo(void) __attribute__((transaction_safe));
+void bar(void) __attribute__((transaction_safe));
+void danger(void) __attribute__((transaction_unsafe));
+
+void wildthing()
+{
+ /* All blocks should be propagated as irrevocable. */
+ __transaction_relaxed {
+ if (a)
+ foo();
+ else
+ bar();
+ danger();
+ }
+}
+
+/* { dg-final { scan-ipa-dump-times "GTMA_DOES_GO_IRREVOCABLE" 1
"tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 3 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 4 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 5 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 6 goes irr" 1 "tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
Index: gcc/testsuite/gcc.dg/tm/20091221.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20091221.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20091221.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmedge" } */
+
+int i;
+extern void virgin () __attribute__((transaction_pure));
+
+foo()
+{
+ __transaction_atomic {
+ virgin(i);
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "readOnly" 1 "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/irrevocable-7.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-7.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-7.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa" } */
+
+extern void bark(void);
+
+__attribute__((transaction_callable))
+int foo()
+{
+ bark();
+}
+
+/* { dg-final { scan-ipa-dump-times "changeTransactionMode \\(0\\)" 1
"tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
Index: gcc/testsuite/gcc.dg/tm/props-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/props-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/props-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmedge -fdump-tree-tmlower" } */
+
+int global;
+
+foo(int local)
+{
+ __transaction_atomic {
+ local++;
+ if (++global == 10)
+ __transaction_cancel;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times " instrumentedCode" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "hasNoAbort" 0 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "GTMA_HAVE_ABORT" 1 "tmlower" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmlower" } } */
Index: gcc/testsuite/gcc.dg/tm/props-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/props-3.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/props-3.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa" } */
+
+/* Test that indirect calls set the irrevocable bit. */
+
+void (*indirect)(void);
+
+foo(){
+ __transaction_relaxed {
+ (*indirect)();
+ }
+}
+
+/* { dg-final { scan-ipa-dump-times "GTMA_MAY_ENTER_IRREVOCABLE" 1
"tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
Index: gcc/testsuite/gcc.dg/tm/ipa-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/ipa-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/ipa-2.c (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark-asmname" } */
+
+void foo(void);
+
+void bar(void)
+{
+ __transaction_relaxed {
+ foo();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "_ZGTt3foo" 0 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/wrap-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/wrap-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/wrap-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+#define W(X) __attribute__((transaction_wrap(X)))
+void f1(void);
+void f2(int);
+int i3;
+int f7(void);
+
+void g1(void) W(f1);
+void g2(void) W(f2); /* { dg-error "is not compatible" } */
+void g3(void) W(i3); /* { dg-error "is not a function" } */
+void g4(void) W(f4); /* { dg-error "is not a function" } */
+void g5(void) W(1); /* { dg-error "not an identifier" } */
+void g6(void) W("f1"); /* { dg-error "not an identifier" } */
+void g7(void) W(f7); /* { dg-error "is not compatible" } */
Index: gcc/testsuite/gcc.dg/tm/wrap-4.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/wrap-4.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/wrap-4.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-optimized -O2" } */
+
+static void candy() { candycane(); }
+
+static void tootsie_roll () __attribute__((transaction_wrap (candy)));
+static void tootsie_roll () { bark(); }
+
+void foo()
+{
+ __transaction_relaxed { candy(); }
+}
+
+/* { dg-final { scan-tree-dump-times "candy" 0 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-11.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-11.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-11.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+extern int something(void) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+int f()
+{
+ int *p;
+
+ p = malloc (sizeof (*p) * 100);
+ foo(p[5]);
+
+ __transaction_atomic {
+ /* p[5] is thread private, however the SSA_NAME that holds the
+ address dominates the entire transaction (transaction
+ invariant) so we can use a save/restore pair. */
+ p[5] = 123;
+
+ if (something())
+ __transaction_cancel;
+ }
+ return p[5];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_LU" 0 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "tm_save" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/nested-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/nested-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/nested-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void foobar(void)
+{
+ __transaction_atomic {
+ foobar();
+ }
+}
+
+void doit(void) __attribute__((transaction_safe));
+
+__attribute__((transaction_callable))
+void callable(void)
+{
+ __transaction_atomic {
+ doit();
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/unsafe.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/unsafe.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/unsafe.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+__attribute__((transaction_callable))
+static int func ()
+{
+ return 12345;
+}
+
+int main()
+{
+ __transaction_atomic { return func(); } /* { dg-error "unsafe
function call .func. " } */
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-13.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-13.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-13.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+struct large { int x[100]; };
+struct large large_global;
+extern struct large function (void) __attribute__((transaction_safe));
+
+void f()
+{
+ __transaction_atomic {
+ large_global = function();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(&large_global," 1
"tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/pr47520.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr47520.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr47520.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+struct ReadSeqVars
+{
+ int format;
+ char *ss;
+};
+
+void rms_feof(struct ReadSeqVars *);
+
+__attribute__((transaction_callable)) int ReadSeq(struct ReadSeqVars *V)
+{
+ if (V->format > 1)
+ {
+ if ((V->format != 2) && (V->ss != (void*)0) )
+ {
+ V->format = 3;
+ }
+ }
+ else
+ {
+ int i = 0;
+ for (i = 0; i < 1; i++)
+ {
+ }
+ rms_feof(V);
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-15.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-15.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-15.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { x86_64-*-linux* } } } */
+/* { dg-options "-fgnu-tm -O" } */
+
+/* Test the TM vector logging functions. */
+
+typedef int __attribute__((vector_size (16))) vectype;
+extern int something(void) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+vectype vecky;
+
+vectype f()
+{
+ vectype *p;
+
+ p = malloc (sizeof (*p) * 100);
+
+ __transaction_atomic {
+ /* p[5] is thread private, but not transaction local since the
+ malloc is outside of the transaction. We can use the logging
+ functions for this. */
+ p[5] = vecky;
+
+ if (something())
+ __transaction_cancel;
+ }
+ return p[5];
+}
+
+/* { dg-final { scan-assembler "_ITM_LM128" } } */
Index: gcc/testsuite/gcc.dg/tm/pr46654.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr46654.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr46654.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+extern void baz(int);
+
+int y;
+void foo(volatile int x)
+{
+ __transaction_atomic {
+ x = 5; /* { dg-error "invalid volatile use of 'x' inside
transaction" } */
+ x += y;
+ y++;
+ }
+ baz(x);
+}
+
+
+volatile int i = 0;
+
+void george()
+{
+ __transaction_atomic {
+ if (i == 2) /* { dg-error "invalid volatile use of 'i' inside
transaction" } */
+ i = 1;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/pr47905.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr47905.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr47905.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile }
+ { dg-options "-fgnu-tm" } */
+
+void funcA();
+void funcB();
+
+void *thread()
+{
+ __transaction_relaxed
+ {
+ funcA();
+ };
+ funcB();
+}
Index: gcc/testsuite/gcc.dg/tm/20110216.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20110216.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20110216.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int george;
+
+__attribute__((transaction_callable))
+void q1()
+{
+ __transaction_atomic {
+ george=999;
+ }
+ q1();
+}
+
+/* { dg-final { scan-assembler-not "_ITM_getTMCloneOrIrrevocable" } } */
Index: gcc/testsuite/gcc.dg/tm/20100615-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100615-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100615-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+__attribute__((transaction_safe))
+void Info_RemoveKey (char *s)
+{
+ char *o = 0;
+ while (1)
+ {
+ s++;
+ while (*s)
+ {
+ if (!*s)
+ return;
+ *o++ = *s++;
+ }
+ *o = 0;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/20100615.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100615.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100615.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+/* Since the non TM version of new_node() gets optimized away, it
+ shouldn't appear in the clone table either. */
+/* { dg-final { scan-assembler-not "tm_clone_table" } } */
+
+#define NULL 0
+extern void *malloc (__SIZE_TYPE__);
+
+__attribute__((transaction_pure))
+void exit(int status);
+
+typedef struct node {
+} node_t;
+
+__attribute__((transaction_safe))
+static node_t *new_node(node_t *next)
+{
+ node_t *node;
+ node = (node_t *)malloc(sizeof(node_t));
+ if (node == NULL) {
+ exit(1);
+ }
+ return NULL;
+}
+
+static node_t *set_new()
+{
+ node_t *min, *max;
+ __transaction_atomic {
+ max = new_node(NULL);
+ min = new_node(max);
+ }
+ return min;
+}
+
+int main(int argc, char **argv)
+{
+ set_new();
+ return 0;
+}
Index: gcc/testsuite/gcc.dg/tm/20091013.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20091013.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20091013.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O2" } */
+
+extern long ringo(long int);
+int g,i;
+
+f()
+{
+ __transaction_relaxed {
+ for (i=0; i < 10; ++i)
+ ringo(g);
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmemopt" } */
+
+long g, xxx, yyy;
+extern george() __attribute__((transaction_callable));
+extern ringo(long int);
+int i;
+
+f()
+{
+ __transaction_relaxed {
+ g = 666;
+ george();
+ if (i == 9)
+ goto bye;
+ xxx=8;
+ yyy=9;
+ for (i=0; i < 10; ++i)
+ ringo(g);
+ bye:
+ ringo(g);
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "transforming: .*_ITM_RaWU8
\\(&g\\);" 1 "tmmemopt" } } */
+/* { dg-final { scan-tree-dump-times "transforming: .*_ITM_WaRU4
\\(&i," 1 "tmmemopt" } } */
+/* { dg-final { scan-tree-dump-times "transforming: .*_ITM_RaWU4
\\(&i\\);" 1 "tmmemopt" } } */
+/* { dg-final { scan-tree-dump-times "transforming: .*_ITM_WaWU4
\\(&i," 1 "tmmemopt" } } */
+/* { dg-final { cleanup-tree-dump "tmmemopt" } } */
Index: gcc/testsuite/gcc.dg/tm/vector-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/vector-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/vector-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O3" } */
+
+/* On x86-64, the vectorizer creates V2DI uses which we must handle.
+ Similarly for other vector architectures. */
+
+void ** newElements;
+
+__attribute__((transaction_safe))
+long
+TMqueue_push (void** queuePtr)
+{
+ long src;
+ for (src = 1; src < 9; src++) {
+ newElements[src+1] = queuePtr[src];
+ }
+ return 1;
+}
Index: gcc/testsuite/gcc.dg/tm/opt-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/opt-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/opt-2.c (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O2" } */
+
+int foo(int *arr, int v)
+{
+ int r = 0;
+ int i;
+ __transaction_atomic {
+ for (i = 0; i < 10; ++i)
+ if (arr[i] < 27)
+ r += arr[i] += v;
+ }
+ return r;
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-3.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-3.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+struct large { int x[100]; };
+extern int test(void) __attribute__((transaction_safe));
+
+int f()
+{
+ int i = readint();
+ struct large lala = { 0 };
+ __transaction_atomic {
+ lala.x[i] = 666;
+ if (test())
+ __transaction_cancel;
+ }
+ return lala.x[0];
+}
+
+/* { dg-final { scan-tree-dump-times "logging: lala.x\\\[i_1\\\]" 1
"tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/20100519.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100519.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100519.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+typedef struct coordinate {
+ double x;
+} coordinate_t;
+
+coordinate_t elementPtrC[3];
+
+__attribute__((transaction_safe))
+void TMelement_alloc (coordinate_t* coordinates, int numCoordinate)
+{
+ int i;
+ for (i = 0; i < numCoordinate; i++) {
+ elementPtrC[i] = coordinates[i];
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-5.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-5.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-5.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmedge --param
tm-max-aggregate-size=1" } */
+
+/* Test thread-local memory optimizations: logging function. */
+
+struct large { int x[100]; };
+struct large bark();
+extern int test (void) __attribute__((transaction_safe));
+
+int f()
+{
+ int i = readint();
+ struct large lala = bark();
+ __transaction_atomic {
+ lala.x[55] = 666;
+ if (test())
+ __transaction_cancel;
+ }
+ return lala.x[i];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_LU\[0-9\]
\\\(&lala.x\\\[55\\\]" 1 "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-7.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-7.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-7.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmedge --param
tm-max-aggregate-size=999" } */
+
+/* Test save/restore pairs for aggregates. */
+
+struct large { int x[100]; };
+extern struct large foobie (void) __attribute__((transaction_safe));
+int asdf;
+
+int f()
+{
+ struct large lala;
+ struct large lacopy = foobie();
+ __transaction_atomic {
+ lala = lacopy;
+ }
+ return lala.x[asdf];
+}
+
+/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala" 1
"tmedge" } } */
+/* { dg-final { scan-tree-dump-times "lala = tm_save" 1 "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-9.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-9.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-9.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+extern int something(void) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+struct large { int foo[500]; };
+
+int f()
+{
+ int *p;
+ struct large *lp;
+
+ __transaction_atomic {
+ p = malloc (sizeof (*p) * 100);
+ lp = malloc (sizeof (*lp) * 100);
+
+ /* No instrumentation necessary; P and LP are transaction local. */
+ p[5] = 123;
+ lp->foo[66] = 123;
+
+ if (something())
+ __transaction_cancel;
+ }
+ return p[5];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/data-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/data-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/data-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+/* Test read and write on all basic types. */
+
+static char gc;
+static signed char gsc;
+static unsigned char guc;
+
+static short gs;
+static unsigned short gus;
+
+static int gi;
+static unsigned int gui;
+
+static long gl;
+static unsigned long gul;
+
+static long long gll;
+static unsigned long long gull;
+
+static float gf;
+static double gd;
+static long double gld;
+
+void f(void)
+{
+ __transaction_atomic {
+ gc++;
+ gsc++;
+ guc++;
+
+ gs++;
+ gus++;
+
+ gi++;
+ gui++;
+
+ gl++;
+ gul++;
+
+ gll++;
+ gull++;
+
+ gf++;
+ gd++;
+ gld++;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/alias-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/alias-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/alias-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
+
+#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long long ptrcast;
+#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long ptrcast;
+#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
+typedef unsigned int ptrcast;
+#else
+#error Add target support here
+#endif
+
+#if (__SIZEOF_POINTER__ == 4)
+#define TM_LOAD __builtin__ITM_RU4
+#define TM_STORE __builtin__ITM_WU4
+#elif (__SIZEOF_POINTER__ == 8)
+#define TM_LOAD __builtin__ITM_RU8
+#define TM_STORE __builtin__ITM_WU8
+#else
+#error Add target support here
+#endif
+
+struct mystruct_type {
+ ptrcast *ptr;
+} *mystruct;
+
+ptrcast *someptr, **pp;
+ptrcast ui;
+
+void f(void)
+{
+ __transaction_atomic {
+ ui = TM_LOAD (&mystruct);
+ mystruct = (struct mystruct_type *) ui;
+ ui = TM_LOAD (&someptr);
+ someptr = (ptrcast *) ui;
+ ui = (ptrcast) someptr;
+ pp = &mystruct->ptr;
+ TM_STORE (pp, ui);
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "mystruct = \{ .*ESCAPED" 1
"ealias" } } */
+/* { dg-final { scan-tree-dump-times "someptr = same as mystruct" 1
"ealias" } } */
+/* { dg-final { scan-tree-dump-times "ui\..* = same as mystruct" 1
"ealias" } } */
+/* { dg-final { scan-tree-dump-times "pp\..* = same as mystruct" 1
"ealias" } } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
Index: gcc/testsuite/gcc.dg/tm/pr47690.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr47690.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr47690.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int george;
+
+void q1()
+{
+ __transaction_atomic {
+ george=999;
+ }
+ q1();
+}
+
+/* { dg-final { scan-assembler-not "ZGTt2q1" } } */
Index: gcc/testsuite/gcc.dg/tm/20100603.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100603.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100603.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-optimized" } */
+
+int jj;
+
+__attribute__((transaction_safe))
+static void poof ()
+{
+ if (jj)
+ return;
+ poof();
+}
+
+__attribute__((transaction_safe))
+void TMlist_free ()
+{
+ poof();
+}
+
+/* { dg-final { scan-tree-dump-times "Function poof ._ZGTt4poof" 1
"optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tm/irrevocable-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmedge" } */
+
+/* Test that a direct call to __builtin__ITM_changeTransactionMode()
+ sets the irrevocable bit. */
+
+int global;
+int george;
+
+foo()
+{
+ __transaction_relaxed {
+ global++;
+ __builtin__ITM_changeTransactionMode (0);
+ george++;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "doesGoIrrevocable" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "hasNoIrrevocable" 0 "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/pr46567.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr46567.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr46567.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,18 @@
+__attribute__((transaction_callable))
+static void SeqfileGetLine ()
+{
+ SSIGetFilePosition ();
+}
+
+__attribute__((transaction_callable))
+static void readLoop (int addfirst)
+{
+ if (!addfirst)
+ {
+ if (!addfirst)
+ {
+ SSIGetFilePosition ();
+ }
+ SeqfileGetLine ();
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/irrevocable-4.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-4.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-4.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
+
+void orig(void);
+void xyz(void) __attribute__((transaction_wrap (orig)));
+
+
+foo()
+{
+ __transaction_relaxed {
+ orig();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "GTMA_MAY_ENTER_IRREVOCABLE" 1
"tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/irrevocable-6.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-6.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-6.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa -O" } */
+
+int a, trxn, eee;
+
+void foo(void) __attribute__((transaction_safe));
+void bar(void) __attribute__((transaction_safe));
+void danger(void) __attribute__((transaction_unsafe));
+
+void wildthing()
+{
+ /* All blocks should be propagated as irrevocable. */
+ __transaction_relaxed {
+ if (eee) {
+ if (a)
+ foo();
+ else
+ bar();
+ danger();
+ } else {
+ danger();
+ }
+ }
+}
+
+/* { dg-final { scan-ipa-dump-times "GTMA_DOES_GO_IRREVOCABLE" 1
"tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 3 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 4 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 5 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 6 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 7 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 8 goes irr" 1 "tmipa" } } */
+/* { dg-final { scan-ipa-dump-times "bb 9 goes irr" 1 "tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
Index: gcc/testsuite/gcc.dg/tm/20100609.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100609.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100609.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+extern void funcNoReturn() __attribute__ ((__noreturn__));
+
+int later;
+
+void MyFunc()
+{
+ __transaction_relaxed {
+ funcNoReturn();
+ later=8;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/props-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/props-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/props-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-ipa-tmipa" } */
+
+/* Test that irrevocability gets set for the obvious case. */
+
+int global;
+int george;
+
+extern crap() __attribute__((transaction_unsafe));
+
+foo(){
+ __transaction_relaxed {
+ global++;
+ crap();
+ george++;
+ }
+}
+
+/* { dg-final { scan-ipa-dump-times "GTMA_MAY_ENTER_IRREVOCABLE" 1
"tmipa" } } */
+/* { dg-final { cleanup-ipa-dump "tmipa" } } */
Index: gcc/testsuite/gcc.dg/tm/unused.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/unused.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/unused.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -Wall" } */
+
+__attribute__((transaction_safe))
+static int unused_func () /* { dg-warning "defined but not used" } */
+{
+ return 12345;
+}
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler "_ZGTt11unused_func:" } } */
Index: gcc/testsuite/gcc.dg/tm/props-4.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/props-4.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/props-4.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmedge -fdump-tree-tmmark" } */
+
+int a, b;
+
+void __attribute((transaction_may_cancel_outer,noinline)) cancel1()
+{
+ __transaction_cancel [[outer]];
+}
+
+void
+foo(void)
+{
+ __transaction_atomic [[outer]] {
+ a = 2;
+ __transaction_atomic {
+ b = 2;
+ cancel1();
+ }
+ }
+}
+
+/* { dg-final { scan-tree-dump-times " instrumentedCode" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "hasNoAbort" 0 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "LABEL=<L0>" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/ipa-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/ipa-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/ipa-1.c (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark-asmname" } */
+
+void foo(void) __attribute__((transaction_safe));
+
+void bar(void)
+{
+ __transaction_atomic {
+ foo();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "_ZGTt3foo" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/ipa-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/ipa-3.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/ipa-3.c (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+static int x;
+
+void __attribute__((transaction_callable))
+foo(void)
+{
+ x++;
+}
+
+/* { dg-final { scan-assembler "_ZGTt3foo" } } */
Index: gcc/testsuite/gcc.dg/tm/wrap-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/wrap-3.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/wrap-3.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-optimized" } */
+
+void free (void *);
+void wrapper (void *) __attribute__((transaction_wrap (free)));
+void *p;
+
+void foo()
+{
+ __transaction_relaxed { free (p); }
+}
+
+/* { dg-final { scan-tree-dump-times "free" 0 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-10.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-10.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-10.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+extern int something(void) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+int f()
+{
+ int *p;
+
+ p = malloc (sizeof (*p) * 100);
+
+ __transaction_atomic {
+ /* p[5] is thread private, but not transaction local since the
+ malloc is outside of the transaction. We can use the logging
+ functions for this. */
+ p[5] = 123;
+
+ if (something())
+ __transaction_cancel;
+ }
+ return p[5];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_LU" 0 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times "tm_save" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/nested-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/nested-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/nested-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+extern int foo(int) __attribute__((transaction_safe));
+void bar(void)
+{
+ __transaction_atomic {
+ if (foo(1))
+ __transaction_atomic {
+ if (foo(2))
+ __transaction_atomic {
+ if (foo(3))
+ __transaction_atomic {
+ if (foo(4))
+ foo(5);
+ else
+ __transaction_cancel;
+ }
+ else
+ __transaction_cancel;
+ }
+ else
+ __transaction_cancel;
+ }
+ else
+ __transaction_cancel;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-12.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-12.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-12.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+extern int test(void) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+struct large { int foo[500]; };
+
+int f()
+{
+ int *p1, *p2, *p3;
+
+ p1 = malloc (sizeof (*p1)*5000);
+ __transaction_atomic {
+ *p1 = 0;
+
+ p2 = malloc (sizeof (*p2)*6000);
+ *p2 = 1;
+
+ /* p3 = PHI (p1, p2) */
+ if (test())
+ p3 = p1;
+ else
+ p3 = p2;
+
+ /* Since both p1 and p2 are thread-private, we can inherit the
+ logging already done. No ITM_W* instrumentation necessary. */
+ *p3 = 555;
+ }
+ return p3[something()];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/debug-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/debug-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/debug-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O0 -fdump-tree-tmmark-lineno" } */
+
+/* Test that instrumented statements have correct location info. */
+
+int a,b, c, z;
+
+testing(){
+ c=9;
+}
+
+main() {
+ b = 9898;
+ __transaction_relaxed {
+ z = c;
+ a = 888;
+ testing();
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times ": 13:.*b = 9898" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times ": 14:.*__transaction" 1 "tmmark"
} } */
+/* { dg-final { scan-tree-dump-times ": 15:.*ITM_WU. \\(&z" 1 "tmmark"
} } */
+/* { dg-final { scan-tree-dump-times ": 16:.*ITM_WU. \\(&a" 1 "tmmark"
} } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/20100610.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100610.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100610.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,90 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O3" } */
+
+/* The function calculateCircumCircle() should get inlined into the TM
+ clone for TMelement_alloc(), so we don't need to generate a TM
+ clone for calculateCircumCircle(). We also don't need to put its
+ entry into the clone table since it's static. */
+
+/* { dg-final { scan-assembler-not "ZGTt21calculateCircumCircle" } } */
+
+extern double sqrt(double) __attribute__((transaction_pure));
+extern void *xmalloc(int) __attribute__((transaction_safe));
+
+typedef struct coordinate {
+ double x;
+ double y;
+} coordinate_t;
+typedef struct element {
+ coordinate_t coordinates[3];
+ long numCoordinate;
+ coordinate_t circumCenter;
+ double circumRadius;
+} element_t;
+
+__attribute__((transaction_safe))
+double
+coordinate_distance (coordinate_t* coordinatePtr, coordinate_t* aPtr)
+{
+ return sqrt( coordinatePtr->x );
+}
+
+__attribute__((transaction_safe))
+static void
+calculateCircumCircle (element_t* elementPtr)
+{
+ long numCoordinate = elementPtr->numCoordinate;
+ coordinate_t* coordinates = elementPtr->coordinates;
+ coordinate_t* circumCenterPtr = &elementPtr->circumCenter;
+ ((void) (0));
+ if (numCoordinate == 2) {
+ circumCenterPtr->x = (coordinates[0].x + coordinates[1].x) / 2.0;
+ circumCenterPtr->y = (coordinates[0].y + coordinates[1].y) / 2.0;
+ }
+ else {
+ double ax = coordinates[0].x;
+ double ay = coordinates[0].y;
+ double bx = coordinates[1].x;
+ double by = coordinates[1].y;
+ double cx = coordinates[2].x;
+ double cy = coordinates[2].y;
+ double bxDelta = bx - ax;
+ double byDelta = by - ay;
+ double cxDelta = cx - ax;
+ double cyDelta = cy - ay;
+ double bDistance2 = (bxDelta * bxDelta) + (byDelta * byDelta);
+ double cDistance2 = (cxDelta * cxDelta) + (cyDelta * cyDelta);
+ double xNumerator = (byDelta * cDistance2) - (cyDelta *
bDistance2);
+ double yNumerator = (bxDelta * cDistance2) - (cxDelta *
bDistance2);
+ double denominator = 2 * ((bxDelta * cyDelta) - (cxDelta *
byDelta));
+ double rx = ax - (xNumerator / denominator);
+ double ry = ay + (yNumerator / denominator);
+ circumCenterPtr->x = rx;
+ circumCenterPtr->y = ry;
+ }
+ elementPtr->circumRadius = coordinate_distance(circumCenterPtr,
+ &coordinates[0]);
+}
+
+element_t*
+element_alloc (coordinate_t* coordinates, long numCoordinate)
+{
+ element_t* elementPtr;
+ elementPtr = (element_t*)xmalloc(sizeof(element_t));
+ if (elementPtr) {
+ calculateCircumCircle(elementPtr);
+ }
+ return elementPtr;
+}
+
+__attribute__((transaction_safe))
+element_t*
+TMelement_alloc (coordinate_t* coordinates, long numCoordinate)
+{
+ element_t* elementPtr;
+ elementPtr = (element_t*)xmalloc(sizeof(element_t));
+ if (elementPtr) {
+ calculateCircumCircle(elementPtr);
+ }
+ return elementPtr;
+}
Index: gcc/testsuite/gcc.dg/tm/tm.exp
===================================================================
--- gcc/testsuite/gcc.dg/tm/tm.exp (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/tm.exp (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,39 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Run the tests that are shared with C++ testing.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/tm/*c]] \
+ "" $DEFAULT_CFLAGS
+# Run the C-only tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
Index: gcc/testsuite/gcc.dg/tm/indirect-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/indirect-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/indirect-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void foo(void (*fn)(void))
+{
+ __transaction_relaxed {
+ fn();
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmemopt" } */
+
+char c;
+
+void f(void)
+{
+ __transaction_atomic {
+ ++c;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "transforming.*RfWU1 \\(&c" 1
"tmmemopt" } } */
+/* { dg-final { scan-tree-dump-times "transforming.*WaWU1 \\(&c" 1
"tmmemopt" } } */
+/* { dg-final { cleanup-tree-dump "tmmemopt" } } */
Index: gcc/testsuite/gcc.dg/tm/opt-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/opt-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/opt-1.c (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+extern void usleep (int) __attribute__((transaction_pure));
+extern int rand(void) __attribute__((pure, transaction_pure));
+extern int printf (const char *, ...);
+extern void *malloc (__SIZE_TYPE__) __attribute__((malloc));
+extern void xyzzy (void * (*)(void *));
+
+typedef struct
+{
+ int id;
+} parm;
+
+int gvar;
+
+void *hello(void *arg)
+{
+ parm *p=(parm *)arg;
+ int tmp = p->id;
+ int tmp3;
+ printf ("Thread reads %d.\n", tmp);
+ __transaction_atomic
+ {
+ int tmp2 = gvar;
+ usleep ((int) (10.0*rand()/(10+1.0))/100);
+ gvar = tmp + tmp2;
+ tmp3 = gvar;
+ }
+ printf("tmp3 = %d\n", tmp3);
+ return 0;
+}
+
+int
+main()
+{
+ int i, n = rand();
+
+ for (i=0; i<n; i++)
+ xyzzy (hello);
+
+ return 0;
+}
Index: gcc/testsuite/gcc.dg/tm/pr45985.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr45985.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr45985.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+__attribute__((transaction_unsafe))
+void illegal();
+
+static int a = 0;
+void func()
+{
+ __transaction_relaxed {
+ if( a == 0)
+ illegal();
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/memopt-4.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-4.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-4.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmedge" } */
+
+/* Test thread-local memory optimizations: save/restore pairs. */
+
+struct large { int x[100]; };
+struct large bark();
+extern int test (void) __attribute__((transaction_safe));
+
+int f()
+{
+ int i = readint();
+ struct large lala = bark();
+ __transaction_atomic {
+ lala.x[55] = 666;
+ if (test())
+ __transaction_cancel;
+ }
+ return lala.x[i];
+}
+
+/* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ =
lala.x\\\[55\\\]" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "lala.x\\\[55\\\] = tm_save" 1
"tmedge" } } */
+/* { dg-final { cleanup-tree-dump "tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-6.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-6.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-6.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmedge --param
tm-max-aggregate-size=1" } */
+
+struct large { int x[100]; };
+struct large bark();
+extern int test (void) __attribute__((transaction_safe));
+struct large lacopy;
+
+int f()
+{
+ int i = readint();
+ struct large lala = bark();
+ __transaction_atomic {
+ lala.x[55] = 666;
+ lala = lacopy; /* Aggregate instrumentation. */
+ }
+ return lala.x[i];
+}
+
+/* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(&lala, &lacopy" 1
"tmedge" } } */
Index: gcc/testsuite/gcc.dg/tm/memopt-8.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memopt-8.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memopt-8.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+extern int something(void) __attribute__((transaction_safe));
+extern int escape(int *) __attribute__((transaction_safe));
+extern void *malloc (__SIZE_TYPE__)
__attribute__((malloc,transaction_safe));
+
+int f()
+{
+ int *p;
+
+ __transaction_atomic {
+ p = malloc (sizeof (*p) * 100);
+ escape (p);
+
+ /* This should be instrumented because P escapes. */
+ p[5] = 123;
+
+ if (something())
+ __transaction_cancel;
+ }
+ return p[5];
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_WU" 1 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/data-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/data-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/data-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+/* Test read and write on all basic types. */
+
+struct S
+{
+ int x[10];
+};
+
+static struct S g;
+
+extern void fill (struct S *);
+
+void f(void)
+{
+ struct S l;
+ fill(&l);
+
+ __transaction_atomic {
+ g = l;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/alias-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/alias-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/alias-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
+
+#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long long ptrcast;
+#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
+typedef unsigned long ptrcast;
+#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
+typedef unsigned int ptrcast;
+#else
+#error Add target support here
+#endif
+
+#if (__SIZEOF_POINTER__ == 4)
+#define TM_LOAD __builtin__ITM_RU4
+#define TM_STORE __builtin__ITM_WU4
+#elif (__SIZEOF_POINTER__ == 8)
+#define TM_LOAD __builtin__ITM_RU8
+#define TM_STORE __builtin__ITM_WU8
+#else
+#error Add target support here
+#endif
+
+void candy ();
+
+struct mystruct_type {
+ ptrcast *ptr;
+} *mystruct, *mystruct2;
+
+ptrcast *someptr, **pp;
+ptrcast ui;
+
+void tootsie_roll () __attribute__((transaction_wrap (candy)));
+void tootsie_roll ()
+{
+ ui = TM_LOAD (&mystruct);
+ mystruct2 = (struct mystruct_type *) ui;
+
+ pp = &mystruct2->ptr;
+}
+
+void foo()
+{
+ candy();
+}
+
+/* { dg-final { scan-tree-dump-times "ui\..* = same as mystruct" 1
"ealias" } } */
+/* { dg-final { scan-tree-dump-times "mystruct.*ESCAPED" 1 "ealias" } } */
+/* { dg-final { scan-tree-dump-times "pp = same as mystruct" 1 "ealias"
} } */
+/* { dg-final { cleanup-tree-dump "ealias" } } */
Index: gcc/testsuite/gcc.dg/tm/memset-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memset-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memset-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmlower" } */
+
+char array[4];
+
+void *memset(void *s, int c, __SIZE_TYPE__);
+
+int main()
+{
+ __transaction_atomic {
+ memset(array, 'b', sizeof(4));
+ }
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "GTMA_HAVE_STORE" 1 "tmlower" } } */
+/* { dg-final { cleanup-tree-dump "tmlower" } } */
Index: gcc/testsuite/gcc.dg/tm/20100125.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100125.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100125.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O -fdump-tree-tmmark" } */
+
+/* Test that the call to george() doesn't end up inside the
transaction. */
+
+int trxn;
+
+void set_remove(int * val)
+{
+ __transaction_atomic {
+ trxn = 5;
+ }
+ george();
+}
+
+/* { dg-final { scan-tree-dump-times "getTMCloneOrIrrevocable" 0
"tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/gcc.dg/tm/memset.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/memset.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/memset.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+extern void *memset (void *, int, __SIZE_TYPE__);
+
+char array[4] = "aaaa";
+
+__attribute__((transaction_safe))
+void *my_memset()
+{
+ return memset(array,'b',4);
+}
+
+
+int main()
+{
+
+ __transaction_atomic {
+ my_memset();
+ }
+ return 0;
+}
+
+/* { dg-final { scan-assembler "_ITM_memsetW" } } */
Index: gcc/testsuite/gcc.dg/tm/irrevocable-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-1.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-1.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+int global;
+int george;
+
+extern crap() __attribute__((transaction_unsafe));
+
+foo()
+{
+ __transaction_relaxed {
+ global++;
+ crap();
+ george++;
+ }
+}
Index: gcc/testsuite/gcc.dg/tm/20100524-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/20100524-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/20100524-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O0" } */
+
+typedef struct {
+ int value[5];
+} type_t;
+
+__attribute__((transaction_safe))
+type_t func_move ();
+
+__attribute__((transaction_safe))
+type_t func_push (int type)
+{
+ type_t trace;
+
+ if (type == 9)
+ trace = func_move();
+
+ return trace;
+}
Index: gcc/testsuite/gcc.dg/tm/pr46567-2.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/pr46567-2.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/pr46567-2.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int funky();
+int global;
+
+void SeqfileGetLine()
+{
+ funky();
+}
+
+__attribute__((transaction_callable)) void readLoop()
+{
+ SeqfileGetLine();
+ if (global)
+ funky();
+
+}
Index: gcc/testsuite/gcc.dg/tm/irrevocable-3.c
===================================================================
--- gcc/testsuite/gcc.dg/tm/irrevocable-3.c (.../trunk) (revision 0)
+++ gcc/testsuite/gcc.dg/tm/irrevocable-3.c
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
+
+extern void bar(void) __attribute__((transaction_callable));
+
+foo()
+{
+ __transaction_relaxed {
+ bar();
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "GTMA_MAY_ENTER_IRREVOCABLE" 1
"tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
Index: gcc/testsuite/g++.dg/dg.exp
===================================================================
--- gcc/testsuite/g++.dg/dg.exp (.../trunk) (revision 180744)
+++ gcc/testsuite/g++.dg/dg.exp (.../branches/transactional-memory)
(revision 180773)
@@ -47,6 +47,7 @@ set tests [prune $tests $srcdir/$subdir/
set tests [prune $tests $srcdir/$subdir/tree-prof/*]
set tests [prune $tests $srcdir/$subdir/torture/*]
set tests [prune $tests $srcdir/$subdir/graphite/*]
+set tests [prune $tests $srcdir/$subdir/tm/*]
set tests [prune $tests $srcdir/$subdir/guality/*]
# Main loop.
Index: gcc/testsuite/g++.dg/tm/vector-1.C
===================================================================
--- gcc/testsuite/g++.dg/tm/vector-1.C (.../trunk) (revision 0)
+++ gcc/testsuite/g++.dg/tm/vector-1.C
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O3" }
+
+class HashTree
+{
+ __attribute__((transaction_safe)) void rehash();
+ HashTree **Hash_table;
+ int Hash_function;
+};
+
+__attribute__((transaction_safe)) void HashTree::rehash()
+{
+ for (int i=0; i < Hash_function; i++)
+ Hash_table[i] = 0;
+}
Index: gcc/testsuite/g++.dg/tm/opt-1.C
===================================================================
--- gcc/testsuite/g++.dg/tm/opt-1.C (.../trunk) (revision 0)
+++ gcc/testsuite/g++.dg/tm/opt-1.C (.../branches/transactional-memory)
(revision 180773)
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O" }
+
+struct S
+{
+ virtual void f() __attribute__((transaction_safe));
+};
+
+void f(S *s) { __transaction_atomic { s->f(); } }
Index: gcc/testsuite/g++.dg/tm/20100429.C
===================================================================
--- gcc/testsuite/g++.dg/tm/20100429.C (.../trunk) (revision 0)
+++ gcc/testsuite/g++.dg/tm/20100429.C
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm" }
+
+int foo(int a);
+int foo(float a);
+int
+bar(int a)
+{
+ int r;
+ __transaction_atomic
+ {
+ r = foo(a); // { dg-error "unsafe function call 'int foo\\(int\\)'" }
+ }
+ return r;
+}
Index: gcc/testsuite/g++.dg/tm/20100727.C
===================================================================
--- gcc/testsuite/g++.dg/tm/20100727.C (.../trunk) (revision 0)
+++ gcc/testsuite/g++.dg/tm/20100727.C
(.../branches/transactional-memory) (revision 180773)
@@ -0,0 +1,796 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm" }
+
+typedef long int ptrdiff_t;
+typedef long unsigned int size_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::ptrdiff_t;
+ using::size_t;
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ struct input_iterator_tag
+ {
+ };
+ struct output_iterator_tag
+ {
+ };
+ struct forward_iterator_tag:public input_iterator_tag
+ {
+ };
+ struct bidirectional_iterator_tag:public forward_iterator_tag
+ {
+ };
+ struct random_access_iterator_tag:public bidirectional_iterator_tag
+ {
+ };
+ template < typename _Category, typename _Tp, typename _Distance =
+ ptrdiff_t, typename _Pointer = _Tp *, typename _Reference =
+ _Tp & >struct iterator
+ {
+ typedef _Category iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+ };
+ template < typename _Iterator > struct iterator_traits
+ {
+ typedef typename _Iterator::iterator_category iterator_category;
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+ };
+ template < typename _Tp > struct iterator_traits <_Tp * >
+ {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp *pointer;
+ typedef _Tp & reference;
+ };
+ template < typename _Tp > struct iterator_traits <const _Tp *>
+ {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp *pointer;
+ typedef const _Tp & reference;
+ };
+ template < typename _Iter > inline typename iterator_traits <
+ _Iter >::iterator_category __iterator_category (const _Iter &)
+ {
+ return typename iterator_traits < _Iter >::iterator_category ();
+ }
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _Iterator > class reverse_iterator:public iterator
< typename iterator_traits < _Iterator >::iterator_category,
+ typename iterator_traits < _Iterator >::value_type,
+ typename iterator_traits < _Iterator >::difference_type,
+ typename iterator_traits < _Iterator >::pointer,
+ typename iterator_traits < _Iterator >::reference >
+ {
+ protected:_Iterator current;
+ typedef iterator_traits < _Iterator > __traits_type;
+ public:typedef _Iterator iterator_type;
+ typedef typename __traits_type::difference_type difference_type;
+ typedef typename __traits_type::pointer pointer;
+ typedef typename __traits_type::reference reference;
+ reverse_iterator ():current ()
+ {
+ } explicit reverse_iterator (iterator_type __x):current (__x)
+ {
+ } reverse_iterator (const reverse_iterator & __x):current (__x.current)
+ {
+ } template < typename _Iter > reverse_iterator (const
reverse_iterator <
+ _Iter >
+ &__x):current (__x.
+ base ())
+ {
+ } iterator_type base () const
+ {
+ return current;
+ }
+ reference operator* () const
+ {
+ _Iterator __tmp = current;
+ return *--__tmp;
+ }
+ pointer operator-> () const
+ {
+ return &(operator* ());
+ }
+ reverse_iterator & operator++ ()
+ {
+ --current;
+ return *this;
+ }
+ reverse_iterator operator++ (int)
+ {
+ reverse_iterator __tmp = *this;
+ --current;
+ return __tmp;
+ }
+ reverse_iterator & operator-- ()
+ {
+ ++current;
+ return *this;
+ }
+ reverse_iterator operator-- (int)
+ {
+ reverse_iterator __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+ reverse_iterator operator+ (difference_type __n) const
+ {
+ return reverse_iterator (current - __n);
+ }
+ reverse_iterator & operator+= (difference_type __n)
+ {
+ current -= __n;
+ return *this;
+ }
+ reverse_iterator operator- (difference_type __n) const
+ {
+ return reverse_iterator (current + __n);
+ }
+ reverse_iterator & operator-= (difference_type __n)
+ {
+ current += __n;
+ return *this;
+ }
+ reference operator[] (difference_type __n) const
+ {
+ return *(*this + __n);
+ }
+ };
+ template < typename _Iterator >
+ inline bool operator== (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return __x.base () == __y.base ();
+ }
+ template < typename _Iterator >
+ inline bool operator< (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return __y.base () < __x.base ();
+ }
+ template < typename _Iterator >
+ inline bool operator!= (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return !(__x == __y);
+ }
+ template < typename _Iterator >
+ inline bool operator> (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return __y < __x;
+ }
+ template < typename _Iterator >
+ inline bool operator<= (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return !(__y < __x);
+ }
+ template < typename _Iterator >
+ inline bool operator>= (const reverse_iterator < _Iterator > &__x,
+ const reverse_iterator < _Iterator > &__y)
+ {
+ return !(__x < __y);
+ }
+ template < typename _Iterator > inline typename reverse_iterator <
+ _Iterator >::difference_type operator- (const reverse_iterator <
+ _Iterator > &__x,
+ const reverse_iterator <
+ _Iterator > &__y)
+ {
+ return __y.base () - __x.base ();
+ }
+ template < typename _Iterator > inline reverse_iterator < _Iterator >
+ operator+ (typename reverse_iterator < _Iterator >::difference_type
__n,
+ const reverse_iterator < _Iterator > &__x)
+ {
+ return reverse_iterator < _Iterator > (__x.base () - __n);
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator== (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return __x.base () == __y.base ();
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator< (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return __y.base () < __x.base ();
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator!= (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return !(__x == __y);
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator> (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return __y < __x;
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator<= (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return !(__y < __x);
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline bool operator>= (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return !(__x < __y);
+ }
+ template < typename _IteratorL,
+ typename _IteratorR > inline typename reverse_iterator <
+ _IteratorL >::difference_type operator- (const reverse_iterator <
+ _IteratorL > &__x,
+ const reverse_iterator <
+ _IteratorR > &__y)
+ {
+ return __y.base () - __x.base ();
+ }
+template < typename _Container > class back_insert_iterator:public
iterator < output_iterator_tag, void, void, void,
+ void >
+ {
+ protected:_Container * container;
+ public:typedef _Container container_type;
+ explicit back_insert_iterator (_Container & __x):container (&__x)
+ {
+ } back_insert_iterator & operator= (typename _Container::
+ const_reference __value)
+ {
+ container->push_back (__value);
+ return *this;
+ }
+ back_insert_iterator & operator* ()
+ {
+ return *this;
+ }
+ back_insert_iterator & operator++ ()
+ {
+ return *this;
+ }
+ back_insert_iterator operator++ (int)
+ {
+ return *this;
+ }
+ };
+ template < typename _Container > inline back_insert_iterator <
_Container >
+ back_inserter (_Container & __x)
+ {
+ return back_insert_iterator < _Container > (__x);
+ }
+template < typename _Container > class front_insert_iterator:public
iterator < output_iterator_tag, void, void, void,
+ void >
+ {
+ protected:_Container * container;
+ public:typedef _Container container_type;
+ explicit front_insert_iterator (_Container & __x):container (&__x)
+ {
+ } front_insert_iterator & operator= (typename _Container::
+ const_reference __value)
+ {
+ container->push_front (__value);
+ return *this;
+ }
+ front_insert_iterator & operator* ()
+ {
+ return *this;
+ }
+ front_insert_iterator & operator++ ()
+ {
+ return *this;
+ }
+ front_insert_iterator operator++ (int)
+ {
+ return *this;
+ }
+ };
+ template < typename _Container > inline front_insert_iterator <
_Container >
+ front_inserter (_Container & __x)
+ {
+ return front_insert_iterator < _Container > (__x);
+ }
+template < typename _Container > class insert_iterator:public iterator
< output_iterator_tag, void, void, void,
+ void >
+ {
+ protected:_Container * container;
+ typename _Container::iterator iter;
+ public:typedef _Container container_type;
+ insert_iterator (_Container & __x,
+ typename _Container::iterator __i):container (&__x),
+ iter (__i)
+ {
+ } insert_iterator & operator= (typename _Container::
+ const_reference __value)
+ {
+ iter = container->insert (iter, __value);
+ ++iter;
+ return *this;
+ }
+ insert_iterator & operator* ()
+ {
+ return *this;
+ }
+ insert_iterator & operator++ ()
+ {
+ return *this;
+ }
+ insert_iterator & operator++ (int)
+ {
+ return *this;
+ }
+ };
+ template < typename _Container,
+ typename _Iterator > inline insert_iterator < _Container >
+ inserter (_Container & __x, _Iterator __i)
+ {
+ return insert_iterator < _Container > (__x,
+ typename _Container::
+ iterator (__i));
+ }
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ using std::size_t;
+ using std::ptrdiff_t;
+ template < typename _Tp > class new_allocator
+ {
+ public:typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp *pointer;
+ typedef const _Tp *const_pointer;
+ typedef _Tp & reference;
+ typedef const _Tp & const_reference;
+ typedef _Tp value_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef new_allocator < _Tp1 > other;
+ };
+ new_allocator ()throw ()
+ {
+ } new_allocator (const new_allocator &) throw ()
+ {
+ } template < typename _Tp1 > new_allocator (const new_allocator <
_Tp1 >
+ &) throw ()
+ {
+ } ~new_allocator ()throw ()
+ {
+ } pointer address (reference __x) const
+ {
+ return &__x;
+ }
+ const_pointer address (const_reference __x) const
+ {
+ return &__x;
+ }
+ pointer allocate (size_type __n, const void * = 0)
+ {
+ return static_cast < _Tp * >(::operator new (__n * sizeof (_Tp)));
+ }
+ void deallocate (pointer __p, size_type)
+ {
+ ::operator delete (__p);
+ } size_type max_size () const throw ()
+ {
+ return size_t (-1) / sizeof (_Tp);
+ }
+ void construct (pointer __p, const _Tp & __val)
+ {
+ ::new ((void *) __p) _Tp (__val);
+ } void destroy (pointer __p)
+ {
+ __p->~_Tp ();
+ }};
+ template < typename _Tp > inline bool operator== (const new_allocator <
+ _Tp > &,
+ const new_allocator <
+ _Tp > &)
+ {
+ return true;
+ }
+ template < typename _Tp > inline bool operator!= (const new_allocator <
+ _Tp > &,
+ const new_allocator <
+ _Tp > &)
+ {
+ return false;
+ }
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp > class allocator;
+ template <> class allocator < void >
+ {
+ public:typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void *pointer;
+ typedef const void *const_pointer;
+ typedef void value_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef allocator < _Tp1 > other;
+ };
+ };
+template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
+ _Tp >
+ {
+ public:typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp *pointer;
+ typedef const _Tp *const_pointer;
+ typedef _Tp & reference;
+ typedef const _Tp & const_reference;
+ typedef _Tp value_type;
+ template < typename _Tp1 > struct rebind
+ {
+ typedef allocator < _Tp1 > other;
+ };
+ allocator ()throw ()
+ {
+ } allocator (const allocator & __a) throw ():__gnu_cxx::new_allocator <
+ _Tp > (__a)
+ {
+ } template < typename _Tp1 > allocator (const allocator < _Tp1 >
+ &) throw ()
+ {
+ } ~allocator ()throw ()
+ {
+ }};
+ template < typename _T1,
+ typename _T2 > inline bool operator== (const allocator < _T1 > &,
+ const allocator < _T2 > &)
+ {
+ return true;
+ }
+ template < typename _Tp > inline bool operator== (const allocator <
_Tp > &,
+ const allocator < _Tp > &)
+ {
+ return true;
+ }
+ template < typename _T1,
+ typename _T2 > inline bool operator!= (const allocator < _T1 > &,
+ const allocator < _T2 > &)
+ {
+ return false;
+ }
+ template < typename _Tp > inline bool operator!= (const allocator <
_Tp > &,
+ const allocator < _Tp > &)
+ {
+ return false;
+ }
+ template < typename _Alloc, bool = __is_empty (_Alloc) > struct
__alloc_swap
+ {
+ static void _S_do_it (_Alloc &, _Alloc &)
+ {
+ }};
+ template < typename _Alloc > struct __alloc_swap <_Alloc, false >
+ {
+ static void _S_do_it (_Alloc & __one, _Alloc & __two)
+ {
+ if (__one != __two)
+ swap (__one, __two);
+ }
+ };
+ template < typename _Alloc, bool = __is_empty (_Alloc) > struct
__alloc_neq
+ {
+ static bool _S_do_it (const _Alloc &, const _Alloc &)
+ {
+ return false;
+ }
+ };
+ template < typename _Alloc > struct __alloc_neq <_Alloc, false >
+ {
+ static bool _S_do_it (const _Alloc & __one, const _Alloc & __two)
+ {
+ return __one != __two;
+ }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ struct _List_node_base
+ {
+ _List_node_base *_M_next;
+ _List_node_base *_M_prev;
+ static void swap (_List_node_base & __x, _List_node_base & __y)
throw ();
+ void _M_transfer (_List_node_base * const __first,
+ _List_node_base * const __last) throw ();
+ void _M_reverse () throw ();
+ void _M_hook (_List_node_base * const __position) throw ();
+ void _M_unhook () throw ();
+ };
+ template < typename _Tp > struct _List_node:public _List_node_base
+ {
+ _Tp _M_data;
+ };
+ template < typename _Tp > struct _List_iterator
+ {
+ typedef _List_iterator < _Tp > _Self;
+ typedef _List_node < _Tp > _Node;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Tp *pointer;
+ typedef _Tp & reference;
+ _List_iterator ():_M_node ()
+ {
+ } explicit _List_iterator (_List_node_base * __x):_M_node (__x)
+ {
+ } reference operator* () const
+ {
+ return static_cast < _Node * >(_M_node)->_M_data;
+ }
+ pointer operator-> () const
+ {
+ return &static_cast < _Node * >(_M_node)->_M_data;
+ }
+ _Self & operator++ ()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+ _Self operator++ (int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+ _Self & operator-- ()
+ {
+ _M_node = _M_node->_M_prev;
+ return *this;
+ }
+ _Self operator-- (int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_prev;
+ return __tmp;
+ }
+ bool operator== (const _Self & __x) const
+ {
+ return _M_node == __x._M_node;
+ }
+ bool operator!= (const _Self & __x) const
+ {
+ return _M_node != __x._M_node;
+ }
+ _List_node_base *_M_node;
+ };
+ template < typename _Tp > struct _List_const_iterator
+ {
+ typedef _List_const_iterator < _Tp > _Self;
+ typedef const _List_node < _Tp > _Node;
+ typedef _List_iterator < _Tp > iterator;
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef const _Tp *pointer;
+ typedef const _Tp & reference;
+ _List_const_iterator ():_M_node ()
+ {
+ } explicit _List_const_iterator (const _List_node_base *
+ __x):_M_node (__x)
+ {
+ } _List_const_iterator (const iterator & __x):_M_node (__x._M_node)
+ {
+ } reference operator* () const
+ {
+ return static_cast < _Node * >(_M_node)->_M_data;
+ }
+ pointer operator-> () const
+ {
+ return &static_cast < _Node * >(_M_node)->_M_data;
+ }
+ _Self & operator++ ()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+ _Self operator++ (int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+ _Self & operator-- ()
+ {
+ _M_node = _M_node->_M_prev;
+ return *this;
+ }
+ _Self operator-- (int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_prev;
+ return __tmp;
+ }
+ bool operator== (const _Self & __x) const
+ {
+ return _M_node == __x._M_node;
+ }
+ bool operator!= (const _Self & __x) const
+ {
+ return _M_node != __x._M_node;
+ }
+ const _List_node_base *_M_node;
+ };
+ template < typename _Tp, typename _Alloc > class _List_base
+ {
+ protected:typedef typename _Alloc::template rebind < _List_node < _Tp >
+ >::other _Node_alloc_type;
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ struct _List_impl:public _Node_alloc_type
+ {
+ _List_node_base _M_node;
+ _List_impl ():_Node_alloc_type (), _M_node ()
+ {
+ } _List_impl (const _Node_alloc_type & __a):_Node_alloc_type (__a),
+ _M_node ()
+ {
+ }};
+ _List_impl _M_impl;
+ _List_node < _Tp > *_M_get_node ()
+ {
+ return _M_impl._Node_alloc_type::allocate (1);
+ }
+ void _M_put_node (_List_node < _Tp > *__p)
+ {
+ _M_impl._Node_alloc_type::deallocate (__p, 1);
+ } public:typedef _Alloc allocator_type;
+ _Node_alloc_type & _M_get_Node_allocator ()
+ {
+ return *static_cast < _Node_alloc_type * >(&this->_M_impl);
+ }
+ const _Node_alloc_type & _M_get_Node_allocator () const
+ {
+ return *static_cast < const _Node_alloc_type *>(&this->_M_impl);
+ } _Tp_alloc_type _M_get_Tp_allocator () const
+ {
+ return _Tp_alloc_type (_M_get_Node_allocator ());
+ }
+ allocator_type get_allocator () const
+ {
+ return allocator_type (_M_get_Node_allocator ());
+ }
+ _List_base ():_M_impl ()
+ {
+ _M_init ();
+ }
+ _List_base (const allocator_type & __a):_M_impl (__a)
+ {
+ _M_init ();
+ } ~_List_base ()
+ {
+ _M_clear ();
+ } void _M_clear ();
+ void _M_init ()
+ {
+ this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
+ this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
+ }};
+template < typename _Tp, typename _Alloc = std::allocator < _Tp >
>class list:protected _List_base < _Tp,
+ _Alloc
+ >
+ {
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ typedef _List_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ public:typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef _List_iterator < _Tp > iterator;
+ typedef _List_const_iterator < _Tp > const_iterator;
+ typedef std::reverse_iterator < const_iterator >
const_reverse_iterator;
+ typedef std::reverse_iterator < iterator > reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+ protected:typedef _List_node < _Tp > _Node;
+ using _Base::_M_impl;
+ using _Base::_M_put_node;
+ using _Base::_M_get_node;
+ using _Base::_M_get_Tp_allocator;
+ using _Base::_M_get_Node_allocator;
+ public:iterator begin ()
+ {
+ return iterator (this->_M_impl._M_node._M_next);
+ }
+ const_iterator begin () const
+ {
+ return const_iterator (this->_M_impl._M_node._M_next);
+ }
+ iterator end ()
+ {
+ return iterator (&this->_M_impl._M_node);
+ }
+ void remove (const _Tp & __value);
+ template < typename _Predicate > void remove_if (_Predicate);
+ void _M_erase (iterator __position)
+ {
+ __position._M_node->_M_unhook ();
+ _Node *__n = static_cast < _Node * >(__position._M_node);
+ _M_get_Tp_allocator ().destroy (&__n->_M_data);
+ _M_put_node (__n);
+ } void _M_check_equal_allocators (list & __x)
+ {
+ if (std::__alloc_neq <
+ typename _Base::_Node_alloc_type >::
+ _S_do_it (_M_get_Node_allocator (), __x._M_get_Node_allocator ()));
+ }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Tp, typename _Alloc > void list < _Tp,
+ _Alloc >::remove (const value_type & __value)
+ {
+ iterator __first = begin ();
+ iterator __last = end ();
+ iterator __extra = __last;
+ while (__first != __last)
+ {
+ iterator __next = __first;
+ ++__next;
+ if (*__first == __value)
+ {
+ if (&*__first != &__value)
+ _M_erase (__first);
+ else
+ __extra = __first;
+ }
+ __first = __next;
+ }
+ if (__extra != __last)
+ _M_erase (__extra);
+ }
+}
+
+class Unit
+{
+public:int dummy;
+};
+class Building
+{
+public:__attribute__ ((transaction_callable)) void removeUnitFromInside
(Unit *
+ unit);
+ std::list < Unit * >unitsInside;
+};
+void
+Building::removeUnitFromInside (Unit * unit)
+{
+ unitsInside.remove (unit);
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] 10/n: trans-mem: compiler tests (1 of 3)
2011-11-03 18:37 [patch] 10/n: trans-mem: compiler tests (1 of 3) Aldy Hernandez
@ 2011-11-03 20:33 ` Joseph S. Myers
2011-11-03 22:06 ` Aldy Hernandez
0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2011-11-03 20:33 UTC (permalink / raw)
To: Aldy Hernandez; +Cc: gcc-patches
On Thu, 3 Nov 2011, Aldy Hernandez wrote:
> +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
> +typedef unsigned long long ptrcast;
> +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
> +typedef unsigned long ptrcast;
> +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
> +typedef unsigned int ptrcast;
> +#else
> +#error Add target support here
> +#endif
Using __UINTPTR_TYPE__ (or including <stdint.h> and using uintptr_t) would
seem better.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] 10/n: trans-mem: compiler tests (1 of 3)
2011-11-03 20:33 ` Joseph S. Myers
@ 2011-11-03 22:06 ` Aldy Hernandez
0 siblings, 0 replies; 3+ messages in thread
From: Aldy Hernandez @ 2011-11-03 22:06 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
On 11/03/11 15:22, Joseph S. Myers wrote:
> On Thu, 3 Nov 2011, Aldy Hernandez wrote:
>
>> +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
>> +typedef unsigned long long ptrcast;
>> +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
>> +typedef unsigned long ptrcast;
>> +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
>> +typedef unsigned int ptrcast;
>> +#else
>> +#error Add target support here
>> +#endif
>
> Using __UINTPTR_TYPE__ (or including<stdint.h> and using uintptr_t) would
> seem better.
>
Fixed and committed to branch.
Thanks.
[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1507 bytes --]
* testsuite/gcc.dg/alias-1.c: Use __UINTPTR_TYPE__.
* testsuite/gcc.dg/alias-2.c: Use __UINTPTR_TYPE__.
Index: testsuite/gcc.dg/tm/alias-1.c
===================================================================
--- testsuite/gcc.dg/tm/alias-1.c (revision 180744)
+++ testsuite/gcc.dg/tm/alias-1.c (working copy)
@@ -1,15 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
-#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
-typedef unsigned long long ptrcast;
-#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
-typedef unsigned long ptrcast;
-#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
-typedef unsigned int ptrcast;
-#else
-#error Add target support here
-#endif
+typedef __UINTPTR_TYPE__ ptrcast;
#if (__SIZEOF_POINTER__ == 4)
#define TM_LOAD __builtin__ITM_RU4
Index: testsuite/gcc.dg/tm/alias-2.c
===================================================================
--- testsuite/gcc.dg/tm/alias-2.c (revision 180744)
+++ testsuite/gcc.dg/tm/alias-2.c (working copy)
@@ -1,15 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
-#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
-typedef unsigned long long ptrcast;
-#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
-typedef unsigned long ptrcast;
-#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
-typedef unsigned int ptrcast;
-#else
-#error Add target support here
-#endif
+typedef __UINTPTR_TYPE__ ptrcast;
#if (__SIZEOF_POINTER__ == 4)
#define TM_LOAD __builtin__ITM_RU4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-03 21:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 18:37 [patch] 10/n: trans-mem: compiler tests (1 of 3) Aldy Hernandez
2011-11-03 20:33 ` Joseph S. Myers
2011-11-03 22:06 ` Aldy Hernandez
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).