| 1 |
/* Verify that the fmac insn is used for the standard fmaf function. */ |
| 2 |
/* { dg-do compile { target { any_fpu } } } */ |
| 3 |
/* { dg-options "-O2" } */ |
| 4 |
/* { dg-final { scan-assembler-times "fpul" 8 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "\tflds\tfr" 2 } } */ |
| 6 |
/* { dg-final { scan-assembler-times "\tsts\tfpul" 2 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "\tlds\tr" 2 } } */ |
| 8 |
/* { dg-final { scan-assembler-times "\tfsts\tfpul" 2 } } */ |
| 9 |
/* { dg-final { scan-assembler-not "mov" } } */ |
| 10 |
|
| 11 |
int |
| 12 |
test_00 (float val) |
| 13 |
{ |
| 14 |
char valbytes[sizeof (float)]; |
| 15 |
__builtin_memcpy (valbytes, &val, sizeof (float)); |
| 16 |
|
| 17 |
int result; |
| 18 |
__builtin_memcpy (&result, valbytes, sizeof (int)); |
| 19 |
|
| 20 |
return result; |
| 21 |
} |
| 22 |
|
| 23 |
float |
| 24 |
test_01 (int val) |
| 25 |
{ |
| 26 |
char valbytes[sizeof (int)]; |
| 27 |
__builtin_memcpy (valbytes, &val, sizeof (int)); |
| 28 |
|
| 29 |
float result; |
| 30 |
__builtin_memcpy (&result, valbytes, sizeof (float)); |
| 31 |
|
| 32 |
return result; |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
test_02 (float val) |
| 37 |
{ |
| 38 |
union { int i; float f; } tmp; |
| 39 |
tmp.f = val; |
| 40 |
return tmp.i; |
| 41 |
} |
| 42 |
|
| 43 |
float |
| 44 |
test_03 (int val) |
| 45 |
{ |
| 46 |
union { int i; float f; } tmp; |
| 47 |
tmp.i = val; |
| 48 |
return tmp.f; |
| 49 |
} |