]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tm/memopt-4.c
Merge from transactional-memory branch.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tm / memopt-4.c
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O -fdump-tree-tmedge" } */
3
4 /* Test thread-local memory optimizations: save/restore pairs. */
5
6 struct large { int x[100]; };
7 struct large bark();
8 extern int test (void) __attribute__((transaction_safe));
9
10 int f()
11 {
12 int i = readint();
13 struct large lala = bark();
14 __transaction_atomic {
15 lala.x[55] = 666;
16 if (test())
17 __transaction_cancel;
18 }
19 return lala.x[i];
20 }
21
22 /* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala.x\\\[55\\\]" 1 "tmedge" { xfail *-*-* } } } */
23 /* { dg-final { scan-tree-dump-times "lala.x\\\[55\\\] = tm_save" 1 "tmedge" { xfail *-*-* } } } */
24 /* { dg-final { cleanup-tree-dump "tmedge" } } */