blob: 69a908a53c2dfbd769fb64bd8dfed0263e6dde31 (
plain)
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
|
/* { dg-do run { target { powerpc*-*-* } } } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-mdejagnu-cpu=power9 -save-temps" } */
#include <altivec.h>
#include <stdlib.h>
#if DEBUG
#include <stdio.h>
#endif
vector unsigned __int128
get_significand (__ieee128 *p)
{
__ieee128 source = *p;
return scalar_extract_sig_to_vec(source);
}
int
main ()
{
#define NOT_ZERO_OR_DENORMAL 0x1000000000000
union conv128_t
{
__ieee128 val_ieee128;
unsigned long long int val_ull[2];
unsigned __int128 val_uint128;
vector unsigned __int128 val_vuint128;
} source, result, exp_result;
/* Result is not zero or denormal. */
#ifdef _BIG_ENDIAN
exp_result.val_ull[0] = 0x00056789ABCDEF0ULL | NOT_ZERO_OR_DENORMAL;
exp_result.val_ull[1] = 0x123456789ABCDEFULL;
#else
exp_result.val_ull[1] = 0x00056789ABCDEF0ULL | NOT_ZERO_OR_DENORMAL;
exp_result.val_ull[0] = 0x123456789ABCDEFULL;
#endif
source.val_uint128 = 0x923456789ABCDEF0ULL;
source.val_uint128 = (source.val_uint128 << 64) | 0x123456789ABCDEFULL;
/* Note, bits[0:14] are set to 0, bit[15] is 0 if the input was zero or
Denormal, 1 otherwise. */
result.val_vuint128 = get_significand (&source.val_ieee128);
if ((result.val_ull[0] != exp_result.val_ull[0])
|| (result.val_ull[1] != exp_result.val_ull[1]))
#if DEBUG
{
printf("result[0] = 0x%llx; exp_result[0] = 0x%llx\n",
result.val_ull[0], exp_result.val_ull[0]);
printf("result[1] = 0x%llx; exp_result[1] = 0x%llx\n",
result.val_ull[1], exp_result.val_ull[1]);
}
#else
abort();
#endif
return 0;
}
/* Check that the expected extract significand instruction is generated. */
/* { dg-final { scan-assembler-times {\mxsxsigqp\M} 1 } } */
|