| 1 |
/* { dg-do run { target { powerpc*-*-* } } } */ |
| 2 |
/* { dg-require-effective-target lp64 } */ |
| 3 |
/* { dg-require-effective-target p9vector_hw } */ |
| 4 |
/* { dg-options "-mdejagnu-cpu=power9 -save-temps" } */ |
| 5 |
|
| 6 |
#include <altivec.h> |
| 7 |
#include <stdlib.h> |
| 8 |
|
| 9 |
#if DEBUG |
| 10 |
#include <stdio.h> |
| 11 |
#endif |
| 12 |
|
| 13 |
vector unsigned __int128 |
| 14 |
get_significand (__ieee128 *p) |
| 15 |
{ |
| 16 |
__ieee128 source = *p; |
| 17 |
|
| 18 |
return scalar_extract_sig_to_vec(source); |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
main () |
| 23 |
{ |
| 24 |
#define NOT_ZERO_OR_DENORMAL 0x1000000000000 |
| 25 |
|
| 26 |
union conv128_t |
| 27 |
{ |
| 28 |
__ieee128 val_ieee128; |
| 29 |
unsigned long long int val_ull[2]; |
| 30 |
unsigned __int128 val_uint128; |
| 31 |
vector unsigned __int128 val_vuint128; |
| 32 |
} source, result, exp_result; |
| 33 |
|
| 34 |
/* Result is not zero or denormal. */ |
| 35 |
#ifdef _BIG_ENDIAN |
| 36 |
exp_result.val_ull[0] = 0x00056789ABCDEF0ULL | NOT_ZERO_OR_DENORMAL; |
| 37 |
exp_result.val_ull[1] = 0x123456789ABCDEFULL; |
| 38 |
#else |
| 39 |
exp_result.val_ull[1] = 0x00056789ABCDEF0ULL | NOT_ZERO_OR_DENORMAL; |
| 40 |
exp_result.val_ull[0] = 0x123456789ABCDEFULL; |
| 41 |
#endif |
| 42 |
source.val_uint128 = 0x923456789ABCDEF0ULL; |
| 43 |
source.val_uint128 = (source.val_uint128 << 64) | 0x123456789ABCDEFULL; |
| 44 |
|
| 45 |
/* Note, bits[0:14] are set to 0, bit[15] is 0 if the input was zero or |
| 46 |
Denormal, 1 otherwise. */ |
| 47 |
result.val_vuint128 = get_significand (&source.val_ieee128); |
| 48 |
|
| 49 |
if ((result.val_ull[0] != exp_result.val_ull[0]) |
| 50 |
|| (result.val_ull[1] != exp_result.val_ull[1])) |
| 51 |
#if DEBUG |
| 52 |
{ |
| 53 |
printf("result[0] = 0x%llx; exp_result[0] = 0x%llx\n", |
| 54 |
result.val_ull[0], exp_result.val_ull[0]); |
| 55 |
printf("result[1] = 0x%llx; exp_result[1] = 0x%llx\n", |
| 56 |
result.val_ull[1], exp_result.val_ull[1]); |
| 57 |
} |
| 58 |
#else |
| 59 |
abort(); |
| 60 |
#endif |
| 61 |
return 0; |
| 62 |
} |
| 63 |
|
| 64 |
/* Check that the expected extract significand instruction is generated. */ |
| 65 |
/* { dg-final { scan-assembler-times {\mxsxsigqp\M} 1 } } */ |