forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge ^/head r279893 through r279984.
- Loading branch information
Showing
204 changed files
with
1,926 additions
and
13,803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,22 @@ | ||
//===-- lib/fixdfsi.c - Double-precision -> integer conversion ----*- C -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is dual licensed under the MIT and the University of Illinois Open | ||
// Source Licenses. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file implements double-precision to integer conversion for the | ||
// compiler-rt library. No range checking is performed; the behavior of this | ||
// conversion is undefined for out of range values in the C standard. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/* ===-- fixdfsi.c - Implement __fixdfsi -----------------------------------=== | ||
* | ||
* The LLVM Compiler Infrastructure | ||
* | ||
* This file is dual licensed under the MIT and the University of Illinois Open | ||
* Source Licenses. See LICENSE.TXT for details. | ||
* | ||
* ===----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#define DOUBLE_PRECISION | ||
#include "fp_lib.h" | ||
|
||
#include "int_lib.h" | ||
typedef si_int fixint_t; | ||
typedef su_int fixuint_t; | ||
#include "fp_fixint_impl.inc" | ||
|
||
ARM_EABI_FNALIAS(d2iz, fixdfsi) | ||
|
||
COMPILER_RT_ABI int | ||
COMPILER_RT_ABI si_int | ||
__fixdfsi(fp_t a) { | ||
|
||
// Break a into sign, exponent, significand | ||
const rep_t aRep = toRep(a); | ||
const rep_t aAbs = aRep & absMask; | ||
const int sign = aRep & signBit ? -1 : 1; | ||
const int exponent = (aAbs >> significandBits) - exponentBias; | ||
const rep_t significand = (aAbs & significandMask) | implicitBit; | ||
|
||
// If 0 < exponent < significandBits, right shift to get the result. | ||
if ((unsigned int)exponent < significandBits) { | ||
return sign * (significand >> (significandBits - exponent)); | ||
} | ||
|
||
// If exponent is negative, the result is zero. | ||
else if (exponent < 0) { | ||
return 0; | ||
} | ||
|
||
// If significandBits < exponent, left shift to get the result. This shift | ||
// may end up being larger than the type width, which incurs undefined | ||
// behavior, but the conversion itself is undefined in that case, so | ||
// whatever the compiler decides to do is fine. | ||
else { | ||
return sign * (significand << (exponent - significandBits)); | ||
} | ||
return __fixint(a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,23 @@ | ||
/* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------=== | ||
* | ||
* The LLVM Compiler Infrastructure | ||
* The LLVM Compiler Infrastructure | ||
* | ||
* This file is dual licensed under the MIT and the University of Illinois Open | ||
* Source Licenses. See LICENSE.TXT for details. | ||
* | ||
* ===----------------------------------------------------------------------=== | ||
* | ||
* This file implements __fixsfdi for the compiler_rt library. | ||
* | ||
* ===----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#include "int_lib.h" | ||
|
||
/* Returns: convert a to a signed long long, rounding toward zero. */ | ||
|
||
/* Assumption: float is a IEEE 32 bit floating point type | ||
* su_int is a 32 bit integral type | ||
* value in float is representable in di_int (no range checking performed) | ||
*/ | ||
|
||
/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ | ||
#define SINGLE_PRECISION | ||
#include "fp_lib.h" | ||
|
||
ARM_EABI_FNALIAS(f2lz, fixsfdi) | ||
|
||
typedef di_int fixint_t; | ||
typedef du_int fixuint_t; | ||
#include "fp_fixint_impl.inc" | ||
|
||
COMPILER_RT_ABI di_int | ||
__fixsfdi(float a) | ||
{ | ||
float_bits fb; | ||
fb.f = a; | ||
int e = ((fb.u & 0x7F800000) >> 23) - 127; | ||
if (e < 0) | ||
return 0; | ||
di_int s = (si_int)(fb.u & 0x80000000) >> 31; | ||
di_int r = (fb.u & 0x007FFFFF) | 0x00800000; | ||
if (e > 23) | ||
r <<= (e - 23); | ||
else | ||
r >>= (23 - e); | ||
return (r ^ s) - s; | ||
__fixsfdi(fp_t a) { | ||
return __fixint(a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,22 @@ | ||
//===-- lib/fixsfsi.c - Single-precision -> integer conversion ----*- C -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is dual licensed under the MIT and the University of Illinois Open | ||
// Source Licenses. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file implements single-precision to integer conversion for the | ||
// compiler-rt library. No range checking is performed; the behavior of this | ||
// conversion is undefined for out of range values in the C standard. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/* ===-- fixsfsi.c - Implement __fixsfsi -----------------------------------=== | ||
* | ||
* The LLVM Compiler Infrastructure | ||
* | ||
* This file is dual licensed under the MIT and the University of Illinois Open | ||
* Source Licenses. See LICENSE.TXT for details. | ||
* | ||
* ===----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#define SINGLE_PRECISION | ||
#include "fp_lib.h" | ||
typedef si_int fixint_t; | ||
typedef su_int fixuint_t; | ||
#include "fp_fixint_impl.inc" | ||
|
||
ARM_EABI_FNALIAS(f2iz, fixsfsi) | ||
|
||
COMPILER_RT_ABI int | ||
COMPILER_RT_ABI si_int | ||
__fixsfsi(fp_t a) { | ||
// Break a into sign, exponent, significand | ||
const rep_t aRep = toRep(a); | ||
const rep_t aAbs = aRep & absMask; | ||
const int sign = aRep & signBit ? -1 : 1; | ||
const int exponent = (aAbs >> significandBits) - exponentBias; | ||
const rep_t significand = (aAbs & significandMask) | implicitBit; | ||
|
||
// If 0 < exponent < significandBits, right shift to get the result. | ||
if ((unsigned int)exponent < significandBits) { | ||
return sign * (significand >> (significandBits - exponent)); | ||
} | ||
|
||
// If exponent is negative, the result is zero. | ||
else if (exponent < 0) { | ||
return 0; | ||
} | ||
|
||
// If significandBits < exponent, left shift to get the result. This shift | ||
// may end up being larger than the type width, which incurs undefined | ||
// behavior, but the conversion itself is undefined in that case, so | ||
// whatever the compiler decides to do is fine. | ||
else { | ||
return sign * (significand << (exponent - significandBits)); | ||
} | ||
return __fixint(a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* ===-- fixtfdi.c - Implement __fixtfdi -----------------------------------=== | ||
* | ||
* The LLVM Compiler Infrastructure | ||
* | ||
* This file is dual licensed under the MIT and the University of Illinois Open | ||
* Source Licenses. See LICENSE.TXT for details. | ||
* | ||
* ===----------------------------------------------------------------------=== | ||
*/ | ||
|
||
#define QUAD_PRECISION | ||
#include "fp_lib.h" | ||
|
||
#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) | ||
typedef di_int fixint_t; | ||
typedef du_int fixuint_t; | ||
#include "fp_fixint_impl.inc" | ||
|
||
COMPILER_RT_ABI di_int | ||
__fixtfdi(fp_t a) { | ||
return __fixint(a); | ||
} | ||
#endif |
Oops, something went wrong.