1 /* { dg-do assemble { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_htm_ok } */
4 /* { dg-options "-O2 -mhtm -save-temps" } */
5 
6 /* { dg-final { scan-assembler-times "tbegin\\." 1 } } */
7 /* { dg-final { scan-assembler-times "tend\\." 2 } } */
8 /* { dg-final { scan-assembler-times "tabort\\." 2 } } */
9 /* { dg-final { scan-assembler-times "tabortdc\\." 1 { target lp64 } } } */
10 /* { dg-final { scan-assembler-times "tabortdci\\." 1 { target lp64 } } } */
11 /* { dg-final { scan-assembler-times "tabortwc\\." 1 } } */
12 /* { dg-final { scan-assembler-times "tabortwci\\." 2 } } */
13 /* { dg-final { scan-assembler-times "tcheck" 1 } } */
14 /* { dg-final { scan-assembler-times "trechkpt\\." 1 } } */
15 /* { dg-final { scan-assembler-times "treclaim\\." 1 } } */
16 /* { dg-final { scan-assembler-times "tsr\\." 3 } } */
17 /* { dg-final { scan-assembler-times "mfspr" 4 } } */
18 /* { dg-final { scan-assembler-times "mtspr" 4 } } */
19 
use_builtins(long * p,char code,long * a,long * b)20 void use_builtins (long *p, char code, long *a, long *b)
21 {
22   p[0] = __builtin_tbegin (0);
23   p[1] = __builtin_tend (0);
24   p[2] = __builtin_tendall ();
25   p[3] = __builtin_tabort (0);
26   p[4] = __builtin_tabort (code);
27 
28 #ifdef __powerpc64__
29   p[5] = __builtin_tabortdc (0xf, a[5], b[5]);
30   p[6] = __builtin_tabortdci (0xf, a[6], 13);
31 #endif
32   p[7] = __builtin_tabortwc (0xf, a[7], b[7]);
33   p[8] = __builtin_tabortwci (0xf, a[8], 13);
34 
35   p[9] = __builtin_tcheck ();
36   p[10] = __builtin_trechkpt ();
37   p[11] = __builtin_treclaim (0);
38   p[12] = __builtin_tresume ();
39   p[13] = __builtin_tsuspend ();
40   p[14] = __builtin_tsr (0);
41   p[15] = __builtin_ttest (); /* This expands to a tabortwci.  */
42 
43 
44   p[16] = __builtin_get_texasr ();
45   p[17] = __builtin_get_texasru ();
46   p[18] = __builtin_get_tfhar ();
47   p[19] = __builtin_get_tfiar ();
48 
49   __builtin_set_texasr (a[20]);
50   __builtin_set_texasru (a[21]);
51   __builtin_set_tfhar (a[22]);
52   __builtin_set_tfiar (a[23]);
53 }
54