| 1 |
/* { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } */ |
| 2 |
/* { dg-options "-fgnu-tm -O -msse2" } */ |
| 3 |
|
| 4 |
/* Test the TM vector logging functions. */ |
| 5 |
|
| 6 |
typedef int __attribute__((vector_size (16))) vectype; |
| 7 |
extern int something(void) __attribute__((transaction_safe)); |
| 8 |
extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe)); |
| 9 |
|
| 10 |
vectype vecky; |
| 11 |
|
| 12 |
vectype f() |
| 13 |
{ |
| 14 |
vectype *p; |
| 15 |
|
| 16 |
p = malloc (sizeof (*p) * 100); |
| 17 |
|
| 18 |
__transaction_atomic { |
| 19 |
/* p[5] is thread private, but not transaction local since the |
| 20 |
malloc is outside of the transaction. We can use the logging |
| 21 |
functions for this. */ |
| 22 |
p[5] = vecky; |
| 23 |
|
| 24 |
if (something()) |
| 25 |
__transaction_cancel; |
| 26 |
} |
| 27 |
return p[5]; |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-assembler "_ITM_LM128" } } */ |