111
|
1 /* { dg-lto-do link } */
|
|
2 /* { dg-lto-options { { -O3 -flto } } } */
|
|
3
|
|
4 typedef unsigned int UINT32;
|
|
5 typedef unsigned long long UINT64;
|
|
6 typedef struct { UINT64 w[2]; } UINT128;
|
|
7 void _bid_to_dpd128 (UINT128 *, UINT128 *);
|
|
8 static const int short_recip_scale[] = {
|
|
9 1,
|
|
10 65 - 64,
|
|
11 69 - 64,
|
|
12 71 - 64,
|
|
13 75 - 64,
|
|
14 78 - 64,
|
|
15 81 - 64,
|
|
16 85 - 64,
|
|
17 88 - 64,
|
|
18 91 - 64,
|
|
19 95 - 64,
|
|
20 98 - 64,
|
|
21 101 - 64,
|
|
22 105 - 64,
|
|
23 108 - 64,
|
|
24 111 - 64,
|
|
25 115 - 64,
|
|
26 118 - 64
|
|
27 };
|
|
28
|
|
29 void _bid_to_dpd128 (UINT128 *, UINT128 *);
|
|
30
|
|
31 void
|
|
32 _bid_to_dpd128 (UINT128 *pres, UINT128 *px) {
|
|
33 UINT128 res;
|
|
34 unsigned int comb;
|
|
35 UINT128 bcoeff;
|
|
36 UINT128 BH;
|
|
37 UINT64 BL, d109;
|
|
38 unsigned int amount;
|
|
39 UINT128 x = *px;
|
|
40
|
|
41 comb = (x.w[1] ) >> 46;
|
|
42 if ((comb & 0x1e000) == 0x1e000) {
|
|
43 res = x;
|
|
44 } else {
|
|
45 bcoeff.w[1] = (x.w[1] & 0x0001ffffffffffffull);
|
|
46 bcoeff.w[0] = x.w[0];
|
|
47 amount = 9;
|
|
48 BH.w[0] = (BH.w[0] >> amount) | (BH.w[1] << (64 - amount));
|
|
49 BL = bcoeff.w[0] - BH.w[0] * 1000000000000000000ull;
|
|
50 d109 = 0x3333333333333334ull;
|
|
51 { UINT64 CXH, CXL, CYH,CYL,PL,PH,PM,PM2; CXH = (BH.w[0]) >> 32; CXL = (UINT32)(BH.w[0]); CYH = (d109) >> 32; CYL = (UINT32)(d109); PM = CXH*CYL; PH = CXH*CYH; PL = CXL*CYL; PM2 = CXL*CYH; PH += (PM>>32); PM = (UINT64)((UINT32)PM)+PM2+(PL>>32); };
|
|
52 { UINT64 CXH, CXL, CYH,CYL,PL,PH,PM,PM2; CXH = (BL) >> 32; CXL = (UINT32)(BL); CYH = (d109) >> 32; CYL = (UINT32)(d109); PM = CXH*CYL; PH = CXH*CYH; PL = CXL*CYL; PM2 = CXL*CYH; PH += (PM>>32); PM = (UINT64)((UINT32)PM)+PM2+(PL>>32); };
|
|
53 }
|
|
54 *pres = res;
|
|
55 }
|
|
56
|
|
57 int main() { return 0; }
|