//=-lib/fp_extend_impl.inc - low precision -> high precision conversion -*-- -// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements a fairly generic conversion from a narrower to a wider // IEEE-754 floating-point type. The constants and types defined following the // includes below parameterize the conversion. // // It does not support types that don't use the usual IEEE-754 interchange // formats; specifically, some work would be needed to adapt it to // (for example) the Intel 80-bit format or PowerPC double-double format. // // Note please, however, that this implementation is only intended to support // *widening* operations; if you need to convert to a *narrower* floating-point // type (e.g. double -> float), then this routine will not do what you want it // to. // // It also requires that integer types at least as large as both formats // are available on the target platform; this may pose a problem when trying // to add support for quad on some 32-bit systems, for example. You also may // run into trouble finding an appropriate CLZ function for wide source types; // you will likely need to roll your own on some platforms. // // Finally, the following assumptions are made: // // 1. Floating-point types and integer types have the same endianness on the // target platform. // // 2. Quiet NaNs, if supported, are indicated by the leading bit of the // significand field being set. // //===----------------------------------------------------------------------===// #include "fp_extend.h" // The source type may use a usual IEEE-754 interchange format or Intel 80-bit // format. In particular, for the source type srcSigFracBits may be not equal to // srcSigBits. The destination type is assumed to be one of IEEE-754 standard // types. static __inline dst_t __extendXfYf2__(src_t a) { … }