1 #include <stdio.h> 2 #ifdef SUPPORTS_HTM 3 int __attribute__ ((noinline)) htm_begin (int r3, int r4) 4 { 5 int ret; 6 7 if (__builtin_tbegin (0)) { 8 ret = r3; 9 __builtin_tend (0); 10 } else { 11 ret = r4; 12 } return ret; 13 } 14 #endif 15 16 int main (void) { 17 #ifdef SUPPORTS_HTM 18 int ret; 19 ret = htm_begin (10, 20); 20 printf ("ret = %d, expected = 10\n", ret); 21 #else 22 printf ("No HTM support."); 23 #endif 24 return 0; 25 } 26