| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target hard_float } */ |
| 3 |
/* { dg-options "-O2 -save-temps" } */ |
| 4 |
|
| 5 |
/* Under lp64, parameter 'v' is in DI regs, then bitcast sub DI to SF. */ |
| 6 |
/* { dg-final { scan-assembler-times {\mxscvspdpn\M} 2 { target { lp64 && has_arch_pwr8 } } } } */ |
| 7 |
/* { dg-final { scan-assembler-times {\mmtvsrd\M} 2 { target { lp64 && { has_arch_pwr8 && { ! has_arch_pwr9 } } } } } } */ |
| 8 |
/* { dg-final { scan-assembler-times {\mmtvsrd\M} 1 { target { lp64 && has_arch_pwr9 } } } } */ |
| 9 |
/* { dg-final { scan-assembler-times {\mmtvsrws\M} 1 { target { lp64 && has_arch_pwr9 } } } } */ |
| 10 |
/* { dg-final { scan-assembler-times {\mrldicr\M} 1 { target { lp64 && has_arch_pwr8 } } } } */ |
| 11 |
/* { dg-final { scan-assembler-times {\msldi\M} 1 { target { lp64 && { has_arch_pwr8 && { ! has_arch_pwr9 } } } } } } */ |
| 12 |
|
| 13 |
struct di_sf_sf |
| 14 |
{ |
| 15 |
float f1; float f2; long long l; |
| 16 |
}; |
| 17 |
|
| 18 |
float __attribute__ ((noipa)) |
| 19 |
sf_from_high32bit_di (struct di_sf_sf v) |
| 20 |
{ |
| 21 |
#ifdef __LITTLE_ENDIAN__ |
| 22 |
return v.f2; |
| 23 |
#else |
| 24 |
return v.f1; |
| 25 |
#endif |
| 26 |
} |
| 27 |
|
| 28 |
float __attribute__ ((noipa)) |
| 29 |
sf_from_low32bit_di (struct di_sf_sf v) |
| 30 |
{ |
| 31 |
#ifdef __LITTLE_ENDIAN__ |
| 32 |
return v.f1; |
| 33 |
#else |
| 34 |
return v.f2; |
| 35 |
#endif |
| 36 |
} |
| 37 |
|
| 38 |
int main() |
| 39 |
{ |
| 40 |
struct di_sf_sf v; |
| 41 |
v.f1 = v.f2 = 0.0f; |
| 42 |
#ifdef __LITTLE_ENDIAN__ |
| 43 |
v.f1 = 1.0f; |
| 44 |
v.f2 = 2.0f; |
| 45 |
#else |
| 46 |
v.f1 = 2.0f; |
| 47 |
v.f2 = 1.0f; |
| 48 |
#endif |
| 49 |
if (sf_from_high32bit_di (v) != 2.0f || sf_from_low32bit_di (v) != 1.0f) |
| 50 |
__builtin_abort (); |
| 51 |
return 0; |
| 52 |
} |