1 //===-- int_to_fp.h - integer to floating point conversion ----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Set source and destination defines in order to use a correctly
10 // parameterised floatXiYf implementation.
12 //===----------------------------------------------------------------------===//
20 typedef int64_t src_t
;
21 typedef uint64_t usrc_t
;
22 static __inline
int clzSrcT(usrc_t x
) { return __builtin_clzll(x
); }
25 typedef uint64_t src_t
;
26 typedef uint64_t usrc_t
;
27 static __inline
int clzSrcT(usrc_t x
) { return __builtin_clzll(x
); }
29 #elif defined SRC_I128
30 typedef __int128_t src_t
;
31 typedef __uint128_t usrc_t
;
32 static __inline
int clzSrcT(usrc_t x
) { return __clzti2(x
); }
34 #elif defined SRC_U128
35 typedef __uint128_t src_t
;
36 typedef __uint128_t usrc_t
;
37 static __inline
int clzSrcT(usrc_t x
) { return __clzti2(x
); }
40 #error Source should be a handled integer type.
43 #if defined DST_SINGLE
45 typedef uint32_t dst_rep_t
;
46 #define DST_REP_C UINT32_C
52 #elif defined DST_DOUBLE
54 typedef uint64_t dst_rep_t
;
55 #define DST_REP_C UINT64_C
61 #elif defined DST_QUAD
62 typedef tf_float dst_t
;
63 typedef __uint128_t dst_rep_t
;
64 #define DST_REP_C (__uint128_t)
71 #error Destination should be a handled floating point type
74 static __inline dst_t
dstFromRep(dst_rep_t x
) {