| 1 |
/* Check that vcvt is used for fixed and float data conversions. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-require-effective-target arm_vfp3_ok } */ |
| 4 |
/* { dg-options "-O1" } */ |
| 5 |
/* { dg-add-options arm_vfp3 } */ |
| 6 |
/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ |
| 7 |
|
| 8 |
float |
| 9 |
fixed_to_float (int i) |
| 10 |
{ |
| 11 |
return ((float) i / (1 << 16)); |
| 12 |
} |
| 13 |
|
| 14 |
int |
| 15 |
float_to_fixed (float f) |
| 16 |
{ |
| 17 |
return ((int) (f * (1 << 16))); |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-final { scan-assembler "vcvt.f32.s32" } } */ |
| 21 |
/* { dg-final { scan-assembler "vcvt.s32.f32" } } */ |