head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.1
	netbsd-11-0-RC3:1.1.1.1
	netbsd-11-0-RC2:1.1.1.1
	netbsd-11-0-RC1:1.1.1.1
	perseant-exfatfs-base-20250801:1.1.1.1
	netbsd-11:1.1.1.1.0.60
	netbsd-11-base:1.1.1.1
	netbsd-10-1-RELEASE:1.1.1.1
	perseant-exfatfs-base-20240630:1.1.1.1
	perseant-exfatfs:1.1.1.1.0.58
	perseant-exfatfs-base:1.1.1.1
	netbsd-8-3-RELEASE:1.1.1.1
	netbsd-9-4-RELEASE:1.1.1.1
	netbsd-10-0-RELEASE:1.1.1.1
	netbsd-10-0-RC6:1.1.1.1
	netbsd-10-0-RC5:1.1.1.1
	netbsd-10-0-RC4:1.1.1.1
	netbsd-10-0-RC3:1.1.1.1
	netbsd-10-0-RC2:1.1.1.1
	thorpej-ifq:1.1.1.1.0.56
	thorpej-ifq-base:1.1.1.1
	thorpej-altq-separation:1.1.1.1.0.54
	thorpej-altq-separation-base:1.1.1.1
	netbsd-10-0-RC1:1.1.1.1
	netbsd-10:1.1.1.1.0.52
	netbsd-10-base:1.1.1.1
	bouyer-sunxi-drm:1.1.1.1.0.50
	bouyer-sunxi-drm-base:1.1.1.1
	netbsd-9-3-RELEASE:1.1.1.1
	thorpej-i2c-spi-conf2:1.1.1.1.0.48
	thorpej-i2c-spi-conf2-base:1.1.1.1
	thorpej-futex2:1.1.1.1.0.46
	thorpej-futex2-base:1.1.1.1
	thorpej-cfargs2:1.1.1.1.0.44
	thorpej-cfargs2-base:1.1.1.1
	cjep_sun2x-base1:1.1.1.1
	cjep_sun2x:1.1.1.1.0.42
	cjep_sun2x-base:1.1.1.1
	cjep_staticlib_x-base1:1.1.1.1
	netbsd-9-2-RELEASE:1.1.1.1
	cjep_staticlib_x:1.1.1.1.0.40
	cjep_staticlib_x-base:1.1.1.1
	thorpej-i2c-spi-conf:1.1.1.1.0.38
	thorpej-i2c-spi-conf-base:1.1.1.1
	thorpej-cfargs:1.1.1.1.0.36
	thorpej-cfargs-base:1.1.1.1
	thorpej-futex:1.1.1.1.0.34
	thorpej-futex-base:1.1.1.1
	netbsd-9-1-RELEASE:1.1.1.1
	bouyer-xenpvh-base2:1.1.1.1
	phil-wifi-20200421:1.1.1.1
	bouyer-xenpvh-base1:1.1.1.1
	phil-wifi-20200411:1.1.1.1
	bouyer-xenpvh:1.1.1.1.0.32
	bouyer-xenpvh-base:1.1.1.1
	is-mlppp:1.1.1.1.0.30
	is-mlppp-base:1.1.1.1
	phil-wifi-20200406:1.1.1.1
	netbsd-8-2-RELEASE:1.1.1.1
	ad-namecache-base3:1.1.1.1
	netbsd-9-0-RELEASE:1.1.1.1
	netbsd-9-0-RC2:1.1.1.1
	ad-namecache-base2:1.1.1.1
	ad-namecache-base1:1.1.1.1
	ad-namecache:1.1.1.1.0.28
	ad-namecache-base:1.1.1.1
	netbsd-9-0-RC1:1.1.1.1
	phil-wifi-20191119:1.1.1.1
	netbsd-9:1.1.1.1.0.26
	netbsd-9-base:1.1.1.1
	phil-wifi-20190609:1.1.1.1
	netbsd-8-1-RELEASE:1.1.1.1
	netbsd-8-1-RC1:1.1.1.1
	isaki-audio2:1.1.1.1.0.24
	isaki-audio2-base:1.1.1.1
	pgoyette-compat-merge-20190127:1.1.1.1
	pgoyette-compat-20190127:1.1.1.1
	pgoyette-compat-20190118:1.1.1.1
	compiler-rt-350590:1.1.1.1
	pgoyette-compat-1226:1.1.1.1
	pgoyette-compat-1126:1.1.1.1
	pgoyette-compat-1020:1.1.1.1
	pgoyette-compat-0930:1.1.1.1
	pgoyette-compat-0906:1.1.1.1
	pgoyette-compat-0728:1.1.1.1
	netbsd-8-0-RELEASE:1.1.1.1
	phil-wifi:1.1.1.1.0.22
	phil-wifi-base:1.1.1.1
	pgoyette-compat-0625:1.1.1.1
	netbsd-8-0-RC2:1.1.1.1
	pgoyette-compat-0521:1.1.1.1
	pgoyette-compat-0502:1.1.1.1
	pgoyette-compat-0422:1.1.1.1
	netbsd-8-0-RC1:1.1.1.1
	pgoyette-compat-0415:1.1.1.1
	pgoyette-compat-0407:1.1.1.1
	pgoyette-compat-0330:1.1.1.1
	pgoyette-compat-0322:1.1.1.1
	pgoyette-compat-0315:1.1.1.1
	pgoyette-compat:1.1.1.1.0.20
	pgoyette-compat-base:1.1.1.1
	tls-maxphys:1.1.1.1.0.18
	tls-maxphys-base-20171202:1.1.1.1
	matt-nb8-mediatek:1.1.1.1.0.16
	matt-nb8-mediatek-base:1.1.1.1
	nick-nhusb-base-20170825:1.1.1.1
	perseant-stdc-iso10646:1.1.1.1.0.14
	perseant-stdc-iso10646-base:1.1.1.1
	netbsd-8:1.1.1.1.0.12
	netbsd-8-base:1.1.1.1
	prg-localcount2-base3:1.1.1.1
	prg-localcount2-base2:1.1.1.1
	prg-localcount2-base1:1.1.1.1
	prg-localcount2:1.1.1.1.0.10
	prg-localcount2-base:1.1.1.1
	pgoyette-localcount-20170426:1.1.1.1
	bouyer-socketcan-base1:1.1.1.1
	jdolecek-ncq:1.1.1.1.0.8
	jdolecek-ncq-base:1.1.1.1
	pgoyette-localcount-20170320:1.1.1.1
	nick-nhusb-base-20170204:1.1.1.1
	bouyer-socketcan:1.1.1.1.0.6
	bouyer-socketcan-base:1.1.1.1
	pgoyette-localcount-20170107:1.1.1.1
	nick-nhusb-base-20161204:1.1.1.1
	pgoyette-localcount-20161104:1.1.1.1
	nick-nhusb-base-20161004:1.1.1.1
	localcount-20160914:1.1.1.1
	pgoyette-localcount-20160806:1.1.1.1
	pgoyette-localcount-20160726:1.1.1.1
	pgoyette-localcount:1.1.1.1.0.4
	pgoyette-localcount-base:1.1.1.1
	nick-nhusb-base-20160907:1.1.1.1
	nick-nhusb-base-20160529:1.1.1.1
	nick-nhusb-base-20160422:1.1.1.1
	nick-nhusb:1.1.1.1.0.2
	nick-nhusb-base-20160319:1.1.1.1
	compiler-rt-259194:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2016.02.27.18.59.30;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	G0OqhIEjDuqpqAWy;

1.1.1.1
date	2016.02.27.18.59.30;	author joerg;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.18.1;
next	;
commitid	G0OqhIEjDuqpqAWy;

1.1.1.1.2.1
date	2016.02.27.18.59.30;	author skrll;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	2PHKtPSg1vDV9fZy;

1.1.1.1.2.2
date	2016.03.19.11.30.26;	author skrll;	state Exp;
branches;
next	;
commitid	2PHKtPSg1vDV9fZy;

1.1.1.1.18.1
date	2016.02.27.18.59.30;	author jdolecek;	state dead;
branches;
next	1.1.1.1.18.2;
commitid	XcIYRZTAh1LmerhA;

1.1.1.1.18.2
date	2017.12.03.11.37.46;	author jdolecek;	state Exp;
branches;
next	;
commitid	XcIYRZTAh1LmerhA;


desc
@@


1.1
log
@Initial revision
@
text
@//===-- 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 float to unsigned integer conversion for the
// compiler-rt library.
//
//===----------------------------------------------------------------------===//

#include "fp_lib.h"

static __inline fixuint_t __fixuint(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 either the value or the exponent is negative, the result is zero.
    if (sign == -1 || exponent < 0)
        return 0;

    // If the value is too large for the integer type, saturate.
    if ((unsigned)exponent >= sizeof(fixuint_t) * CHAR_BIT)
        return ~(fixuint_t)0;

    // If 0 <= exponent < significandBits, right shift to get the result.
    // Otherwise, shift left.
    if (exponent < significandBits)
        return significand >> (significandBits - exponent);
    else
        return (fixuint_t)significand << (exponent - significandBits);
}
@


1.1.1.1
log
@Import compiler-rt r259194. Primary changes are better support for
128bit long double and a number of refinements in the profiling backend.
@
text
@@


1.1.1.1.18.1
log
@file fp_fixuint_impl.inc was added on branch tls-maxphys on 2017-12-03 11:37:46 +0000
@
text
@d1 39
@


1.1.1.1.18.2
log
@update from HEAD
@
text
@a0 39
//===-- 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 float to unsigned integer conversion for the
// compiler-rt library.
//
//===----------------------------------------------------------------------===//

#include "fp_lib.h"

static __inline fixuint_t __fixuint(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 either the value or the exponent is negative, the result is zero.
    if (sign == -1 || exponent < 0)
        return 0;

    // If the value is too large for the integer type, saturate.
    if ((unsigned)exponent >= sizeof(fixuint_t) * CHAR_BIT)
        return ~(fixuint_t)0;

    // If 0 <= exponent < significandBits, right shift to get the result.
    // Otherwise, shift left.
    if (exponent < significandBits)
        return significand >> (significandBits - exponent);
    else
        return (fixuint_t)significand << (exponent - significandBits);
}
@


1.1.1.1.2.1
log
@file fp_fixuint_impl.inc was added on branch nick-nhusb on 2016-03-19 11:30:26 +0000
@
text
@d1 39
@


1.1.1.1.2.2
log
@Sync with HEAD
@
text
@a0 39
//===-- 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 float to unsigned integer conversion for the
// compiler-rt library.
//
//===----------------------------------------------------------------------===//

#include "fp_lib.h"

static __inline fixuint_t __fixuint(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 either the value or the exponent is negative, the result is zero.
    if (sign == -1 || exponent < 0)
        return 0;

    // If the value is too large for the integer type, saturate.
    if ((unsigned)exponent >= sizeof(fixuint_t) * CHAR_BIT)
        return ~(fixuint_t)0;

    // If 0 <= exponent < significandBits, right shift to get the result.
    // Otherwise, shift left.
    if (exponent < significandBits)
        return significand >> (significandBits - exponent);
    else
        return (fixuint_t)significand << (exponent - significandBits);
}
@


