| 1 |
/* Functional tests for the "target" attribute and pragma. */ |
| 2 |
|
| 3 |
/* { dg-do compile { target { lp64 } } } */ |
| 4 |
/* { dg-require-effective-target dfp } */ |
| 5 |
/* { dg-require-effective-target target_attribute } */ |
| 6 |
/* { dg-options "-march=z13 -std=gnu99 -mno-hard-dfp" } */ |
| 7 |
|
| 8 |
#pragma GCC target("hard-dfp") |
| 9 |
_Decimal64 p1(_Decimal64 f, _Decimal64 g) |
| 10 |
{ |
| 11 |
return f * g; |
| 12 |
/* { dg-final { scan-assembler-times "\tmdtr\t" 1 } } */ |
| 13 |
} |
| 14 |
#pragma GCC reset_options |
| 15 |
|
| 16 |
#pragma GCC target("no-hard-dfp") |
| 17 |
_Decimal64 p0(_Decimal64 f, _Decimal64 g) |
| 18 |
{ |
| 19 |
return f / 2; |
| 20 |
/* { dg-final { scan-assembler-not "\tddtr\t" } } */ |
| 21 |
} |
| 22 |
#pragma GCC reset_options |
| 23 |
|
| 24 |
__attribute__ ((target("hard-dfp"))) |
| 25 |
_Decimal64 a1(_Decimal64 f, _Decimal64 g) |
| 26 |
{ |
| 27 |
/* { dg-final { scan-assembler-times "\tadtr\t" 1 } } */ |
| 28 |
return f + g; |
| 29 |
} |
| 30 |
|
| 31 |
__attribute__ ((target("no-hard-dfp"))) |
| 32 |
_Decimal64 a0(_Decimal64 f, _Decimal64 g) |
| 33 |
{ |
| 34 |
return f - g; |
| 35 |
/* { dg-final { scan-assembler-not "\tsdtr\t" } } */ |
| 36 |
} |
| 37 |
|
| 38 |
_Decimal64 d(_Decimal64 f, _Decimal64 g) |
| 39 |
{ |
| 40 |
return f - g; |
| 41 |
/* { dg-final { scan-assembler-not "\tsdtr\t" } } */ |
| 42 |
} |