| 1 |
/* Test float on alpha. */ |
| 2 |
|
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "-mieee" } */ |
| 5 |
|
| 6 |
extern void abort(void); |
| 7 |
extern int printf(const char *, ...); |
| 8 |
|
| 9 |
typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; |
| 10 |
typedef union |
| 11 |
{ |
| 12 |
float value; |
| 13 |
int32_t word; |
| 14 |
} ieee_float_shape_type; |
| 15 |
|
| 16 |
int isinff(float x) |
| 17 |
{ |
| 18 |
int32_t ix,t; |
| 19 |
ieee_float_shape_type gf_u; |
| 20 |
gf_u.value = x; |
| 21 |
ix = gf_u.word; |
| 22 |
printf ("%x\n", ix); |
| 23 |
t = ix & 0x7fffffff; |
| 24 |
t ^= 0x7f800000; |
| 25 |
t |= -t; |
| 26 |
return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30)); |
| 27 |
} |
| 28 |
|
| 29 |
int main () |
| 30 |
{ |
| 31 |
float x = 1.0 / 0.0; |
| 32 |
int i = isinff (x); |
| 33 |
|
| 34 |
if (i == 0) |
| 35 |
abort (); |
| 36 |
|
| 37 |
printf ("%d\n", i); |
| 38 |
return 0; |
| 39 |
} |