* gcc.c-torture/execute/20010129-1.c: Compile with -mtune=i686
[official-gcc.git] / gcc / testsuite / g++.dg / tm / template-1.C
blobcb6bb382fe3e0f1a2c4e4ed7a70c497e7a6e6bae
1 // { dg-do compile }
2 // { dg-options "-fgnu-tm -O -fdump-tree-tmmark" }
4 struct TrueFalse
6   static bool v() { return true; }
7 };
9 int global;
11 template<typename T> int foo()
13   __transaction_atomic { global += 2; }
14   return __transaction_atomic (global + 1);
17 template<typename T> int bar() __transaction_atomic
19   return global + 3;
22 template<typename T> void bar2() __transaction_atomic
24   global += 4;
27 int f1()
29   bar2<TrueFalse>();
30   return foo<TrueFalse>() + bar<TrueFalse>();
33 /* 4 transactions overall, two of them write to global:  */
34 /* { dg-final { scan-tree-dump-times "ITM_RU4\\s*\\(&global" 4 "tmmark" } } */
35 /* { dg-final { scan-tree-dump-times "ITM_WU4\\s*\\(&global" 2 "tmmark" } } */
36 /* { dg-final { cleanup-tree-dump "tmmark" } } */