1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/*
* Require float128 support because __ibm128 currently is not enabled unless we
* also have __float128 support. We require software IEEE 128-bit support,
* which will work on power8. If we have hardware IEEE 128-bit support (power9
* or power10), ppc_float128_sw will still enable running the test.
*/
/* { dg-do run } */
/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-options "-O2 -mvsx -mfloat128" } */
/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */
/*
* PR target/104253
*
* Verify that the various conversions to and from __ibm128 work. When the
* default for long double is changed to IEEE 128-bit, originally GCC would
* call the functions using an 'if' name instead of 'tf' name.
*/
#include <stdlib.h>
extern float ibm128_to_sf (__ibm128) __attribute__((noinline));
extern double ibm128_to_df (__ibm128) __attribute__((noinline));
extern int ibm128_to_si (__ibm128) __attribute__((noinline));
extern long long ibm128_to_di (__ibm128) __attribute__((noinline));
extern unsigned int ibm128_to_usi (__ibm128) __attribute__((noinline));
extern unsigned long long ibm128_to_udi (__ibm128) __attribute__((noinline));
extern __ibm128 sf_to_ibm128 (float) __attribute__((noinline));
extern __ibm128 df_to_ibm128 (double) __attribute__((noinline));
extern __ibm128 si_to_ibm128 (int) __attribute__((noinline));
extern __ibm128 di_to_ibm128 (long long) __attribute__((noinline));
extern __ibm128 usi_to_ibm128 (unsigned int) __attribute__((noinline));
extern __ibm128 udi_to_ibm128 (unsigned long long) __attribute__((noinline));
float
ibm128_to_sf (__ibm128 x)
{
return x;
}
double
ibm128_to_df (__ibm128 x)
{
return x;
}
int
ibm128_to_si (__ibm128 x)
{
return x;
}
long long
ibm128_to_di (__ibm128 x)
{
return x;
}
unsigned int
ibm128_to_usi (__ibm128 x)
{
return x;
}
unsigned long long
ibm128_to_udi (__ibm128 x)
{
return x;
}
__ibm128
sf_to_ibm128 (float x)
{
return x;
}
__ibm128
df_to_ibm128 (double x)
{
return x;
}
__ibm128
si_to_ibm128 (int x)
{
return x;
}
__ibm128
di_to_ibm128 (long long x)
{
return x;
}
__ibm128
usi_to_ibm128 (unsigned int x)
{
return x;
}
__ibm128
udi_to_ibm128 (unsigned long long x)
{
return x;
}
volatile float seven_sf = 7.0f;
volatile double seven_df = 7.0;
volatile int seven_si = 7;
volatile long long seven_di = 7LL;
volatile unsigned int seven_usi = 7U;
volatile unsigned long long seven_udi = 7ULL;
volatile __ibm128 seven_ibm128 = 7.0;
int
main (void)
{
if (seven_ibm128 != sf_to_ibm128 (seven_sf))
abort ();
if (seven_ibm128 != df_to_ibm128 (seven_df))
abort ();
if (seven_ibm128 != si_to_ibm128 (seven_si))
abort ();
if (seven_ibm128 != di_to_ibm128 (seven_di))
abort ();
if (seven_ibm128 != usi_to_ibm128 (seven_usi))
abort ();
if (seven_ibm128 != udi_to_ibm128 (seven_udi))
abort ();
if (seven_sf != ibm128_to_sf (seven_ibm128))
abort ();
if (seven_df != ibm128_to_df (seven_ibm128))
abort ();
if (seven_si != ibm128_to_si (seven_ibm128))
abort ();
if (seven_di != ibm128_to_di (seven_ibm128))
abort ();
if (seven_usi != ibm128_to_usi (seven_ibm128))
abort ();
if (seven_udi != ibm128_to_udi (seven_ibm128))
abort ();
return 0;
}
|