forked from OSchip/llvm-project
Fixup C++ style comments are not allowed in ISO C90 to classic C style.
llvm-svn: 78152
This commit is contained in:
parent
379429200e
commit
4856eef437
|
@ -1,23 +1,24 @@
|
||||||
//===-- ashrti3.c - Implement __ashrti3 -----------------------------------===//
|
/* ===-- ashrti3.c - Implement __ashrti3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __ashrti3 for the compiler_rt library.
|
* This file implements __ashrti3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: arithmetic a >> b
|
/* Returns: arithmetic a >> b */
|
||||||
|
|
||||||
// Precondition: 0 <= b < bits_in_tword
|
/* Precondition: 0 <= b < bits_in_tword */
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__ashrti3(ti_int a, si_int b)
|
__ashrti3(ti_int a, si_int b)
|
||||||
|
@ -26,13 +27,13 @@ __ashrti3(ti_int a, si_int b)
|
||||||
twords input;
|
twords input;
|
||||||
twords result;
|
twords result;
|
||||||
input.all = a;
|
input.all = a;
|
||||||
if (b & bits_in_dword) // bits_in_dword <= b < bits_in_tword
|
if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
|
||||||
{
|
{
|
||||||
// result.high = input.high < 0 ? -1 : 0
|
/* result.high = input.high < 0 ? -1 : 0 */
|
||||||
result.high = input.high >> (bits_in_dword - 1);
|
result.high = input.high >> (bits_in_dword - 1);
|
||||||
result.low = input.high >> (b - bits_in_dword);
|
result.low = input.high >> (b - bits_in_dword);
|
||||||
}
|
}
|
||||||
else // 0 <= b < bits_in_dword
|
else /* 0 <= b < bits_in_dword */
|
||||||
{
|
{
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return a;
|
return a;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
//===-- clear_cache.c - Implement __clear_cache ---------------------------===//
|
/* ===-- clear_cache.c - Implement __clear_cache ---------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -13,22 +14,23 @@
|
||||||
#include <libkern/OSCacheControl.h>
|
#include <libkern/OSCacheControl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The compiler generates calls to __clear_cache() when creating
|
* The compiler generates calls to __clear_cache() when creating
|
||||||
// trampoline functions on the stack for use with nested functions.
|
* trampoline functions on the stack for use with nested functions.
|
||||||
// It is expected to invalidate the instruction cache for the
|
* It is expected to invalidate the instruction cache for the
|
||||||
// specified range.
|
* specified range.
|
||||||
//
|
*/
|
||||||
|
|
||||||
void __clear_cache(void* start, void* end)
|
void __clear_cache(void* start, void* end)
|
||||||
{
|
{
|
||||||
#if __i386__ || __x86_64__
|
#if __i386__ || __x86_64__
|
||||||
//
|
/*
|
||||||
// Intel processors have a unified instruction and data cache
|
* Intel processors have a unified instruction and data cache
|
||||||
// so there is nothing to do
|
* so there is nothing to do
|
||||||
//
|
*/
|
||||||
#else
|
#else
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
// On Darwin, sys_icache_invalidate() provides this functionality
|
/* On Darwin, sys_icache_invalidate() provides this functionality */
|
||||||
sys_icache_invalidate(start, end-start);
|
sys_icache_invalidate(start, end-start);
|
||||||
#else
|
#else
|
||||||
abort();
|
abort();
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
//===-- clzdi2.c - Implement __clzdi2 -------------------------------------===//
|
/* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __clzdi2 for the compiler_rt library.
|
* This file implements __clzdi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: the number of leading 0-bits
|
/* Returns: the number of leading 0-bits */
|
||||||
|
|
||||||
// Precondition: a != 0
|
/* Precondition: a != 0 */
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__clzdi2(di_int a)
|
__clzdi2(di_int a)
|
||||||
|
|
|
@ -1,51 +1,53 @@
|
||||||
//===-- clzsi2.c - Implement __clzsi2 -------------------------------------===//
|
/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __clzsi2 for the compiler_rt library.
|
* This file implements __clzsi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: the number of leading 0-bits
|
/* Returns: the number of leading 0-bits */
|
||||||
|
|
||||||
// Precondition: a != 0
|
/* Precondition: a != 0 */
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__clzsi2(si_int a)
|
__clzsi2(si_int a)
|
||||||
{
|
{
|
||||||
su_int x = (su_int)a;
|
su_int x = (su_int)a;
|
||||||
si_int t = ((x & 0xFFFF0000) == 0) << 4; // if (x is small) t = 16 else 0
|
si_int t = ((x & 0xFFFF0000) == 0) << 4; /* if (x is small) t = 16 else 0 */
|
||||||
x >>= 16 - t; // x = [0 - 0xFFFF]
|
x >>= 16 - t; /* x = [0 - 0xFFFF] */
|
||||||
su_int r = t; // r = [0, 16]
|
su_int r = t; /* r = [0, 16] */
|
||||||
// return r + clz(x)
|
/* return r + clz(x) */
|
||||||
t = ((x & 0xFF00) == 0) << 3;
|
t = ((x & 0xFF00) == 0) << 3;
|
||||||
x >>= 8 - t; // x = [0 - 0xFF]
|
x >>= 8 - t; /* x = [0 - 0xFF] */
|
||||||
r += t; // r = [0, 8, 16, 24]
|
r += t; /* r = [0, 8, 16, 24] */
|
||||||
// return r + clz(x)
|
/* return r + clz(x) */
|
||||||
t = ((x & 0xF0) == 0) << 2;
|
t = ((x & 0xF0) == 0) << 2;
|
||||||
x >>= 4 - t; // x = [0 - 0xF]
|
x >>= 4 - t; /* x = [0 - 0xF] */
|
||||||
r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28]
|
r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */
|
||||||
// return r + clz(x)
|
/* return r + clz(x) */
|
||||||
t = ((x & 0xC) == 0) << 1;
|
t = ((x & 0xC) == 0) << 1;
|
||||||
x >>= 2 - t; // x = [0 - 3]
|
x >>= 2 - t; /* x = [0 - 3] */
|
||||||
r += t; // r = [0 - 30] and is even
|
r += t; /* r = [0 - 30] and is even */
|
||||||
// return r + clz(x)
|
/* return r + clz(x) */
|
||||||
// switch (x)
|
/* switch (x)
|
||||||
// {
|
* {
|
||||||
// case 0:
|
* case 0:
|
||||||
// return r + 2;
|
* return r + 2;
|
||||||
// case 1:
|
* case 1:
|
||||||
// return r + 1;
|
* return r + 1;
|
||||||
// case 2:
|
* case 2:
|
||||||
// case 3:
|
* case 3:
|
||||||
// return r;
|
* return r;
|
||||||
// }
|
* }
|
||||||
|
*/
|
||||||
return r + ((2 - x) & -((x & 2) == 0));
|
return r + ((2 - x) & -((x & 2) == 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
//===-- clzti2.c - Implement __clzti2 -------------------------------------===//
|
/* ===-- clzti2.c - Implement __clzti2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __clzti2 for the compiler_rt library.
|
* This file implements __clzti2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: the number of leading 0-bits
|
/* Returns: the number of leading 0-bits */
|
||||||
|
|
||||||
// Precondition: a != 0
|
/* Precondition: a != 0 */
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__clzti2(ti_int a)
|
__clzti2(ti_int a)
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
//===-- divti3.c - Implement __divti3 -------------------------------------===//
|
/* ===-- divti3.c - Implement __divti3 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __divti3 for the compiler_rt library.
|
* This file implements __divti3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
|
@ -17,18 +18,18 @@
|
||||||
|
|
||||||
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
|
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
|
||||||
|
|
||||||
// Returns: a / b
|
/* Returns: a / b */
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__divti3(ti_int a, ti_int b)
|
__divti3(ti_int a, ti_int b)
|
||||||
{
|
{
|
||||||
const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1;
|
const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1;
|
||||||
ti_int s_a = a >> bits_in_tword_m1; // s_a = a < 0 ? -1 : 0
|
ti_int s_a = a >> bits_in_tword_m1; /* s_a = a < 0 ? -1 : 0 */
|
||||||
ti_int s_b = b >> bits_in_tword_m1; // s_b = b < 0 ? -1 : 0
|
ti_int s_b = b >> bits_in_tword_m1; /* s_b = b < 0 ? -1 : 0 */
|
||||||
a = (a ^ s_a) - s_a; // negate if s_a == -1
|
a = (a ^ s_a) - s_a; /* negate if s_a == -1 */
|
||||||
b = (b ^ s_b) - s_b; // negate if s_b == -1
|
b = (b ^ s_b) - s_b; /* negate if s_b == -1 */
|
||||||
s_a ^= s_b; // sign of quotient
|
s_a ^= s_b; /* sign of quotient */
|
||||||
return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; // negate if s_a == -1
|
return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
|
/* ===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
@ -14,20 +15,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The compiler generates calls to __enable_execute_stack() when creating
|
* The compiler generates calls to __enable_execute_stack() when creating
|
||||||
// trampoline functions on the stack for use with nested functions.
|
* trampoline functions on the stack for use with nested functions.
|
||||||
// It is expected to mark the page(s) containing the address
|
* It is expected to mark the page(s) containing the address
|
||||||
// and the next 48 bytes as executable. Since the stack is normally rw-
|
* and the next 48 bytes as executable. Since the stack is normally rw-
|
||||||
// that means changing the protection on those page(s) to rwx.
|
* that means changing the protection on those page(s) to rwx.
|
||||||
//
|
*/
|
||||||
|
|
||||||
void __enable_execute_stack(void* addr)
|
void __enable_execute_stack(void* addr)
|
||||||
{
|
{
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
// On Darwin, pagesize is always 4096 bytes
|
/* On Darwin, pagesize is always 4096 bytes */
|
||||||
const uintptr_t pageSize = 4096;
|
const uintptr_t pageSize = 4096;
|
||||||
#else
|
#else
|
||||||
// FIXME: We should have a configure check for this.
|
/* FIXME: We should have a configure check for this. */
|
||||||
const uintptr_t pageSize = getpagesize();
|
const uintptr_t pageSize = getpagesize();
|
||||||
#endif
|
#endif
|
||||||
const uintptr_t pageAlignMask = ~(pageSize-1);
|
const uintptr_t pageAlignMask = ~(pageSize-1);
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
//===---------- eprintf.c - Implements __eprintf --------------------------===//
|
/* ===---------- eprintf.c - Implements __eprintf --------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,14 +14,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
/*
|
||||||
// __eprintf() was used in an old version of <assert.h>.
|
* __eprintf() was used in an old version of <assert.h>.
|
||||||
// It can eventually go away, but it is needed when linking
|
* It can eventually go away, but it is needed when linking
|
||||||
// .o files built with the old <assert.h>.
|
* .o files built with the old <assert.h>.
|
||||||
//
|
*
|
||||||
// It should never be exported from a dylib, so it is marked
|
* It should never be exported from a dylib, so it is marked
|
||||||
// visibility hidden.
|
* visibility hidden.
|
||||||
//
|
*/
|
||||||
__attribute__((visibility("hidden")))
|
__attribute__((visibility("hidden")))
|
||||||
void __eprintf(const char* format, const char* assertion_expression,
|
void __eprintf(const char* format, const char* assertion_expression,
|
||||||
const char* line, const char* file)
|
const char* line, const char* file)
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
//===-- ffsdi2.c - Implement __ffsdi2 -------------------------------------===//
|
/* ===-- ffsdi2.c - Implement __ffsdi2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __ffsdi2 for the compiler_rt library.
|
* This file implements __ffsdi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: the index of the least significant 1-bit in a, or
|
/* Returns: the index of the least significant 1-bit in a, or
|
||||||
// the value zero if a is zero. The least significant bit is index one.
|
* the value zero if a is zero. The least significant bit is index one.
|
||||||
|
*/
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__ffsdi2(di_int a)
|
__ffsdi2(di_int a)
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
//===-- ffsti2.c - Implement __ffsti2 -------------------------------------===//
|
/* ===-- ffsti2.c - Implement __ffsti2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __ffsti2 for the compiler_rt library.
|
* This file implements __ffsti2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: the index of the least significant 1-bit in a, or
|
/* Returns: the index of the least significant 1-bit in a, or
|
||||||
// the value zero if a is zero. The least significant bit is index one.
|
* the value zero if a is zero. The least significant bit is index one.
|
||||||
|
*/
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__ffsti2(ti_int a)
|
__ffsti2(ti_int a)
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
//===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===//
|
/* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunsdfdi for the compiler_rt library.
|
* This file implements __fixunsdfdi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: double is a IEEE 64 bit floating point type
|
/* Assumption: double is a IEEE 64 bit floating point type
|
||||||
// du_int is a 64 bit integral type
|
* du_int is a 64 bit integral type
|
||||||
// value in double is representable in du_int or is negative
|
* value in double is representable in du_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
du_int
|
du_int
|
||||||
__fixunsdfdi(double a)
|
__fixunsdfdi(double a)
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
//===-- fixunsdfsi.c - Implement __fixunsdfsi -----------------------------===//
|
/* ===-- fixunsdfsi.c - Implement __fixunsdfsi -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunsdfsi for the compiler_rt library.
|
* This file implements __fixunsdfsi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned int, rounding toward zero.
|
/* Returns: convert a to a unsigned int, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: double is a IEEE 64 bit floating point type
|
/* Assumption: double is a IEEE 64 bit floating point type
|
||||||
// su_int is a 32 bit integral type
|
* su_int is a 32 bit integral type
|
||||||
// value in double is representable in su_int or is negative
|
* value in double is representable in su_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
su_int
|
su_int
|
||||||
__fixunsdfsi(double a)
|
__fixunsdfsi(double a)
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
//===-- fixunsdfti.c - Implement __fixunsdfti -----------------------------===//
|
/* ===-- fixunsdfti.c - Implement __fixunsdfti -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunsdfti for the compiler_rt library.
|
* This file implements __fixunsdfti for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: double is a IEEE 64 bit floating point type
|
/* Assumption: double is a IEEE 64 bit floating point type
|
||||||
// tu_int is a 64 bit integral type
|
* tu_int is a 64 bit integral type
|
||||||
// value in double is representable in tu_int or is negative
|
* value in double is representable in tu_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
tu_int
|
tu_int
|
||||||
__fixunsdfti(double a)
|
__fixunsdfti(double a)
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
//===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------===//
|
/* ===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunssfdi for the compiler_rt library.
|
* This file implements __fixunssfdi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: float is a IEEE 32 bit floating point type
|
/* Assumption: float is a IEEE 32 bit floating point type
|
||||||
// du_int is a 64 bit integral type
|
* du_int is a 64 bit integral type
|
||||||
// value in float is representable in du_int or is negative
|
* value in float is representable in du_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
|
/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
du_int
|
du_int
|
||||||
__fixunssfdi(float a)
|
__fixunssfdi(float a)
|
||||||
|
|
|
@ -1,27 +1,30 @@
|
||||||
//===-- fixunssfsi.c - Implement __fixunssfsi -----------------------------===//
|
/* ===-- fixunssfsi.c - Implement __fixunssfsi -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunssfsi for the compiler_rt library.
|
* This file implements __fixunssfsi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned int, rounding toward zero.
|
/* Returns: convert a to a unsigned int, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: float is a IEEE 32 bit floating point type
|
/* Assumption: float is a IEEE 32 bit floating point type
|
||||||
// su_int is a 32 bit integral type
|
* su_int is a 32 bit integral type
|
||||||
// value in float is representable in su_int or is negative
|
* value in float is representable in su_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
|
/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
su_int
|
su_int
|
||||||
__fixunssfsi(float a)
|
__fixunssfsi(float a)
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
//===-- fixunssfti.c - Implement __fixunssfti -----------------------------===//
|
/* ===-- fixunssfti.c - Implement __fixunssfti -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunssfti for the compiler_rt library.
|
* This file implements __fixunssfti for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: float is a IEEE 32 bit floating point type
|
/* Assumption: float is a IEEE 32 bit floating point type
|
||||||
// tu_int is a 64 bit integral type
|
* tu_int is a 64 bit integral type
|
||||||
// value in float is representable in tu_int or is negative
|
* value in float is representable in tu_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
|
// seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
|
||||||
|
|
||||||
tu_int
|
tu_int
|
||||||
__fixunssfti(float a)
|
__fixunssfti(float a)
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
//===-- fixunsxfdi.c - Implement __fixunsxfdi -----------------------------===//
|
/* ===-- fixunsxfdi.c - Implement __fixunsxfdi -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunsxfdi for the compiler_rt library.
|
* This file implements __fixunsxfdi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if !_ARCH_PPC
|
#if !_ARCH_PPC
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
||||||
// du_int is a 64 bit integral type
|
* du_int is a 64 bit integral type
|
||||||
// value in long double is representable in du_int or is negative
|
* value in long double is representable in du_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
du_int
|
du_int
|
||||||
__fixunsxfdi(long double a)
|
__fixunsxfdi(long double a)
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
//===-- fixunsxfti.c - Implement __fixunsxfti -----------------------------===//
|
/* ===-- fixunsxfti.c - Implement __fixunsxfti -----------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixunsxfti for the compiler_rt library.
|
* This file implements __fixunsxfti for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a unsigned long long, rounding toward zero.
|
/* Returns: convert a to a unsigned long long, rounding toward zero.
|
||||||
// Negative values all become zero.
|
* Negative values all become zero.
|
||||||
|
*/
|
||||||
|
|
||||||
// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
||||||
// tu_int is a 64 bit integral type
|
* tu_int is a 64 bit integral type
|
||||||
// value in long double is representable in tu_int or is negative
|
* value in long double is representable in tu_int or is negative
|
||||||
// (no range checking performed)
|
* (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
tu_int
|
tu_int
|
||||||
__fixunsxfti(long double a)
|
__fixunsxfti(long double a)
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
//===-- fixxfdi.c - Implement __fixxfdi -----------------------------------===//
|
/* ===-- fixxfdi.c - Implement __fixxfdi -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixxfdi for the compiler_rt library.
|
* This file implements __fixxfdi for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if !_ARCH_PPC
|
#if !_ARCH_PPC
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a signed long long, rounding toward zero.
|
/* Returns: convert a to a signed long long, rounding toward zero. */
|
||||||
|
|
||||||
// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
||||||
// su_int is a 32 bit integral type
|
* su_int is a 32 bit integral type
|
||||||
// value in long double is representable in di_int (no range checking performed)
|
* value in long double is representable in di_int (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
di_int
|
di_int
|
||||||
__fixxfdi(long double a)
|
__fixxfdi(long double a)
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
//===-- fixxfti.c - Implement __fixxfti -----------------------------------===//
|
/* ===-- fixxfti.c - Implement __fixxfti -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __fixxfti for the compiler_rt library.
|
* This file implements __fixxfti for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: convert a to a signed long long, rounding toward zero.
|
/* Returns: convert a to a signed long long, rounding toward zero. */
|
||||||
|
|
||||||
// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
|
||||||
// su_int is a 32 bit integral type
|
* su_int is a 32 bit integral type
|
||||||
// value in long double is representable in ti_int (no range checking performed)
|
* value in long double is representable in ti_int (no range checking performed)
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__fixxfti(long double a)
|
__fixxfti(long double a)
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
//===-- floattixf.c - Implement __floattixf -------------------------------===//
|
/* ===-- floattixf.c - Implement __floattixf -------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __floattixf for the compiler_rt library.
|
* This file implements __floattixf for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
// Returns: convert a to a long double, rounding toward even.
|
/* Returns: convert a to a long double, rounding toward even. */
|
||||||
|
|
||||||
// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
|
/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
|
||||||
// ti_int is a 128 bit integral type
|
* ti_int is a 128 bit integral type
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
si_int __clzti2(ti_int a);
|
si_int __clzti2(ti_int a);
|
||||||
|
|
||||||
|
@ -38,13 +41,14 @@ __floattixf(ti_int a)
|
||||||
int e = sd - 1; // exponent
|
int e = sd - 1; // exponent
|
||||||
if (sd > LDBL_MANT_DIG)
|
if (sd > LDBL_MANT_DIG)
|
||||||
{
|
{
|
||||||
// start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
|
/* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
|
||||||
// finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
|
* finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
|
||||||
// 12345678901234567890123456
|
* 12345678901234567890123456
|
||||||
// 1 = msb 1 bit
|
* 1 = msb 1 bit
|
||||||
// P = bit LDBL_MANT_DIG-1 bits to the right of 1
|
* P = bit LDBL_MANT_DIG-1 bits to the right of 1
|
||||||
// Q = bit LDBL_MANT_DIG bits to the right of 1
|
* Q = bit LDBL_MANT_DIG bits to the right of 1
|
||||||
// R = "or" of all bits to the right of Q
|
* R = "or" of all bits to the right of Q
|
||||||
|
*/
|
||||||
switch (sd)
|
switch (sd)
|
||||||
{
|
{
|
||||||
case LDBL_MANT_DIG + 1:
|
case LDBL_MANT_DIG + 1:
|
||||||
|
@ -56,27 +60,27 @@ __floattixf(ti_int a)
|
||||||
a = ((tu_int)a >> (sd - (LDBL_MANT_DIG+2))) |
|
a = ((tu_int)a >> (sd - (LDBL_MANT_DIG+2))) |
|
||||||
((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0);
|
((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0);
|
||||||
};
|
};
|
||||||
// finish:
|
/* finish: */
|
||||||
a |= (a & 4) != 0; // Or P into R
|
a |= (a & 4) != 0; /* Or P into R */
|
||||||
++a; // round - this step may add a significant bit
|
++a; /* round - this step may add a significant bit */
|
||||||
a >>= 2; // dump Q and R
|
a >>= 2; /* dump Q and R */
|
||||||
// a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits
|
/* a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits */
|
||||||
if (a & ((tu_int)1 << LDBL_MANT_DIG))
|
if (a & ((tu_int)1 << LDBL_MANT_DIG))
|
||||||
{
|
{
|
||||||
a >>= 1;
|
a >>= 1;
|
||||||
++e;
|
++e;
|
||||||
}
|
}
|
||||||
// a is now rounded to LDBL_MANT_DIG bits
|
/* a is now rounded to LDBL_MANT_DIG bits */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a <<= (LDBL_MANT_DIG - sd);
|
a <<= (LDBL_MANT_DIG - sd);
|
||||||
// a is now rounded to LDBL_MANT_DIG bits
|
/* a is now rounded to LDBL_MANT_DIG bits */
|
||||||
}
|
}
|
||||||
long_double_bits fb;
|
long_double_bits fb;
|
||||||
fb.u.high.low = ((su_int)s & 0x8000) | // sign
|
fb.u.high.low = ((su_int)s & 0x8000) | /* sign */
|
||||||
(e + 16383); // exponent
|
(e + 16383); /* exponent */
|
||||||
fb.u.low.all = (du_int)a; // mantissa
|
fb.u.low.all = (du_int)a; /* mantissa */
|
||||||
return fb.f;
|
return fb.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
//===-- floatuntixf.c - Implement __floatuntixf ---------------------------===//
|
/* ===-- floatuntixf.c - Implement __floatuntixf ---------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __floatuntixf for the compiler_rt library.
|
* This file implements __floatuntixf for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
// Returns: convert a to a long double, rounding toward even.
|
/* Returns: convert a to a long double, rounding toward even. */
|
||||||
|
|
||||||
// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
|
/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits
|
||||||
// tu_int is a 128 bit integral type
|
* tu_int is a 128 bit integral type
|
||||||
|
*/
|
||||||
|
|
||||||
// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
|
||||||
// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
* 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
|
||||||
|
*/
|
||||||
|
|
||||||
si_int __clzti2(ti_int a);
|
si_int __clzti2(ti_int a);
|
||||||
|
|
||||||
|
@ -32,17 +35,18 @@ __floatuntixf(tu_int a)
|
||||||
if (a == 0)
|
if (a == 0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
const unsigned N = sizeof(tu_int) * CHAR_BIT;
|
const unsigned N = sizeof(tu_int) * CHAR_BIT;
|
||||||
int sd = N - __clzti2(a); // number of significant digits
|
int sd = N - __clzti2(a); /* number of significant digits */
|
||||||
int e = sd - 1; // exponent
|
int e = sd - 1; /* exponent */
|
||||||
if (sd > LDBL_MANT_DIG)
|
if (sd > LDBL_MANT_DIG)
|
||||||
{
|
{
|
||||||
// start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
|
/* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
|
||||||
// finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
|
* finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
|
||||||
// 12345678901234567890123456
|
* 12345678901234567890123456
|
||||||
// 1 = msb 1 bit
|
* 1 = msb 1 bit
|
||||||
// P = bit LDBL_MANT_DIG-1 bits to the right of 1
|
* P = bit LDBL_MANT_DIG-1 bits to the right of 1
|
||||||
// Q = bit LDBL_MANT_DIG bits to the right of 1
|
* Q = bit LDBL_MANT_DIG bits to the right of 1
|
||||||
// R = "or" of all bits to the right of Q
|
* R = "or" of all bits to the right of Q
|
||||||
|
*/
|
||||||
switch (sd)
|
switch (sd)
|
||||||
{
|
{
|
||||||
case LDBL_MANT_DIG + 1:
|
case LDBL_MANT_DIG + 1:
|
||||||
|
@ -54,26 +58,26 @@ __floatuntixf(tu_int a)
|
||||||
a = (a >> (sd - (LDBL_MANT_DIG+2))) |
|
a = (a >> (sd - (LDBL_MANT_DIG+2))) |
|
||||||
((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0);
|
((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0);
|
||||||
};
|
};
|
||||||
// finish:
|
/* finish: */
|
||||||
a |= (a & 4) != 0; // Or P into R
|
a |= (a & 4) != 0; /* Or P into R */
|
||||||
++a; // round - this step may add a significant bit
|
++a; /* round - this step may add a significant bit */
|
||||||
a >>= 2; // dump Q and R
|
a >>= 2; /* dump Q and R */
|
||||||
// a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits
|
/* a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits */
|
||||||
if (a & ((tu_int)1 << LDBL_MANT_DIG))
|
if (a & ((tu_int)1 << LDBL_MANT_DIG))
|
||||||
{
|
{
|
||||||
a >>= 1;
|
a >>= 1;
|
||||||
++e;
|
++e;
|
||||||
}
|
}
|
||||||
// a is now rounded to LDBL_MANT_DIG bits
|
/* a is now rounded to LDBL_MANT_DIG bits */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a <<= (LDBL_MANT_DIG - sd);
|
a <<= (LDBL_MANT_DIG - sd);
|
||||||
// a is now rounded to LDBL_MANT_DIG bits
|
/* a is now rounded to LDBL_MANT_DIG bits */
|
||||||
}
|
}
|
||||||
long_double_bits fb;
|
long_double_bits fb;
|
||||||
fb.u.high.low = (e + 16383); // exponent
|
fb.u.high.low = (e + 16383); /* exponent */
|
||||||
fb.u.low.all = (du_int)a; // mantissa
|
fb.u.low.all = (du_int)a; /* mantissa */
|
||||||
return fb.f;
|
return fb.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,23 @@
|
||||||
//===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------===//
|
/* ===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
//
|
/*
|
||||||
// _Unwind_* stuff based on C++ ABI public documentation
|
* _Unwind_* stuff based on C++ ABI public documentation
|
||||||
// http://refspecs.freestandards.org/abi-eh-1.21.html
|
* http://refspecs.freestandards.org/abi-eh-1.21.html
|
||||||
//
|
*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
_URC_NO_REASON = 0,
|
_URC_NO_REASON = 0,
|
||||||
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
|
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
|
||||||
|
@ -52,11 +55,12 @@ extern uintptr_t _Unwind_GetIP(_Unwind_Context_t context);
|
||||||
extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context);
|
extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context);
|
||||||
|
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Pointer encodings documented at:
|
* Pointer encodings documented at:
|
||||||
// http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
|
* http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html
|
||||||
//
|
*/
|
||||||
#define DW_EH_PE_omit 0xff // no data follows
|
|
||||||
|
#define DW_EH_PE_omit 0xff /* no data follows */
|
||||||
|
|
||||||
#define DW_EH_PE_absptr 0x00
|
#define DW_EH_PE_absptr 0x00
|
||||||
#define DW_EH_PE_uleb128 0x01
|
#define DW_EH_PE_uleb128 0x01
|
||||||
|
@ -73,11 +77,11 @@ extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context);
|
||||||
#define DW_EH_PE_datarel 0x30
|
#define DW_EH_PE_datarel 0x30
|
||||||
#define DW_EH_PE_funcrel 0x40
|
#define DW_EH_PE_funcrel 0x40
|
||||||
#define DW_EH_PE_aligned 0x50
|
#define DW_EH_PE_aligned 0x50
|
||||||
#define DW_EH_PE_indirect 0x80 // gcc extension
|
#define DW_EH_PE_indirect 0x80 /* gcc extension */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// read a uleb128 encoded value and advance pointer
|
/* read a uleb128 encoded value and advance pointer */
|
||||||
static uintptr_t readULEB128(const uint8_t** data)
|
static uintptr_t readULEB128(const uint8_t** data)
|
||||||
{
|
{
|
||||||
uintptr_t result = 0;
|
uintptr_t result = 0;
|
||||||
|
@ -93,7 +97,7 @@ static uintptr_t readULEB128(const uint8_t** data)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read a pointer encoded value and advance pointer
|
/* read a pointer encoded value and advance pointer */
|
||||||
static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
||||||
{
|
{
|
||||||
const uint8_t* p = *data;
|
const uint8_t* p = *data;
|
||||||
|
@ -102,7 +106,7 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
||||||
if ( encoding == DW_EH_PE_omit )
|
if ( encoding == DW_EH_PE_omit )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// first get value
|
/* first get value */
|
||||||
switch (encoding & 0x0F) {
|
switch (encoding & 0x0F) {
|
||||||
case DW_EH_PE_absptr:
|
case DW_EH_PE_absptr:
|
||||||
result = *((uintptr_t*)p);
|
result = *((uintptr_t*)p);
|
||||||
|
@ -137,15 +141,15 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
||||||
break;
|
break;
|
||||||
case DW_EH_PE_sleb128:
|
case DW_EH_PE_sleb128:
|
||||||
default:
|
default:
|
||||||
// not supported
|
/* not supported */
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// then add relative offset
|
/* then add relative offset */
|
||||||
switch ( encoding & 0x70 ) {
|
switch ( encoding & 0x70 ) {
|
||||||
case DW_EH_PE_absptr:
|
case DW_EH_PE_absptr:
|
||||||
// do nothing
|
/* do nothing */
|
||||||
break;
|
break;
|
||||||
case DW_EH_PE_pcrel:
|
case DW_EH_PE_pcrel:
|
||||||
result += (uintptr_t)(*data);
|
result += (uintptr_t)(*data);
|
||||||
|
@ -155,12 +159,12 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
||||||
case DW_EH_PE_funcrel:
|
case DW_EH_PE_funcrel:
|
||||||
case DW_EH_PE_aligned:
|
case DW_EH_PE_aligned:
|
||||||
default:
|
default:
|
||||||
// not supported
|
/* not supported */
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// then apply indirection
|
/* then apply indirection */
|
||||||
if (encoding & DW_EH_PE_indirect) {
|
if (encoding & DW_EH_PE_indirect) {
|
||||||
result = *((uintptr_t*)result);
|
result = *((uintptr_t*)result);
|
||||||
}
|
}
|
||||||
|
@ -170,24 +174,25 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The C compiler makes references to __gcc_personality_v0 in
|
* The C compiler makes references to __gcc_personality_v0 in
|
||||||
// the dwarf unwind information for translation units that use
|
* the dwarf unwind information for translation units that use
|
||||||
// __attribute__((cleanup(xx))) on local variables.
|
* __attribute__((cleanup(xx))) on local variables.
|
||||||
// This personality routine is called by the system unwinder
|
* This personality routine is called by the system unwinder
|
||||||
// on each frame as the stack is unwound during a C++ exception
|
* on each frame as the stack is unwound during a C++ exception
|
||||||
// throw through a C function compiled with -fexceptions.
|
* throw through a C function compiled with -fexceptions.
|
||||||
//
|
*/
|
||||||
|
|
||||||
_Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
_Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
||||||
uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
|
uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject,
|
||||||
_Unwind_Context_t context)
|
_Unwind_Context_t context)
|
||||||
{
|
{
|
||||||
// Since C does not have catch clauses, there is nothing to do during
|
/* Since C does not have catch clauses, there is nothing to do during */
|
||||||
// phase 1 (the search phase).
|
/* phase 1 (the search phase). */
|
||||||
if ( actions & _UA_SEARCH_PHASE )
|
if ( actions & _UA_SEARCH_PHASE )
|
||||||
return _URC_CONTINUE_UNWIND;
|
return _URC_CONTINUE_UNWIND;
|
||||||
|
|
||||||
// There is nothing to do if there is no LSDA for this frame.
|
/* There is nothing to do if there is no LSDA for this frame. */
|
||||||
const uint8_t* lsda = _Unwind_GetLanguageSpecificData(context);
|
const uint8_t* lsda = _Unwind_GetLanguageSpecificData(context);
|
||||||
if ( lsda == NULL )
|
if ( lsda == NULL )
|
||||||
return _URC_CONTINUE_UNWIND;
|
return _URC_CONTINUE_UNWIND;
|
||||||
|
@ -196,7 +201,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
||||||
uintptr_t funcStart = _Unwind_GetRegionStart(context);
|
uintptr_t funcStart = _Unwind_GetRegionStart(context);
|
||||||
uintptr_t pcOffset = pc - funcStart;
|
uintptr_t pcOffset = pc - funcStart;
|
||||||
|
|
||||||
// Parse LSDA header.
|
/* Parse LSDA header. */
|
||||||
uint8_t lpStartEncoding = *lsda++;
|
uint8_t lpStartEncoding = *lsda++;
|
||||||
if (lpStartEncoding != DW_EH_PE_omit) {
|
if (lpStartEncoding != DW_EH_PE_omit) {
|
||||||
readEncodedPointer(&lsda, lpStartEncoding);
|
readEncodedPointer(&lsda, lpStartEncoding);
|
||||||
|
@ -205,7 +210,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
||||||
if (ttypeEncoding != DW_EH_PE_omit) {
|
if (ttypeEncoding != DW_EH_PE_omit) {
|
||||||
readULEB128(&lsda);
|
readULEB128(&lsda);
|
||||||
}
|
}
|
||||||
// Walk call-site table looking for range that includes current PC.
|
/* Walk call-site table looking for range that includes current PC. */
|
||||||
uint8_t callSiteEncoding = *lsda++;
|
uint8_t callSiteEncoding = *lsda++;
|
||||||
uint32_t callSiteTableLength = readULEB128(&lsda);
|
uint32_t callSiteTableLength = readULEB128(&lsda);
|
||||||
const uint8_t* callSiteTableStart = lsda;
|
const uint8_t* callSiteTableStart = lsda;
|
||||||
|
@ -215,14 +220,15 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
||||||
uintptr_t start = readEncodedPointer(&p, callSiteEncoding);
|
uintptr_t start = readEncodedPointer(&p, callSiteEncoding);
|
||||||
uintptr_t length = readEncodedPointer(&p, callSiteEncoding);
|
uintptr_t length = readEncodedPointer(&p, callSiteEncoding);
|
||||||
uintptr_t landingPad = readEncodedPointer(&p, callSiteEncoding);
|
uintptr_t landingPad = readEncodedPointer(&p, callSiteEncoding);
|
||||||
readULEB128(&p); // action value not used for C code
|
readULEB128(&p); /* action value not used for C code */
|
||||||
if ( landingPad == 0 )
|
if ( landingPad == 0 )
|
||||||
continue; // no landing pad for this entry
|
continue; /* no landing pad for this entry */
|
||||||
if ( (start <= pcOffset) && (pcOffset < (start+length)) ) {
|
if ( (start <= pcOffset) && (pcOffset < (start+length)) ) {
|
||||||
// Found landing pad for the PC.
|
/* Found landing pad for the PC.
|
||||||
// Set Instruction Pointer to so we re-enter function
|
* Set Instruction Pointer to so we re-enter function
|
||||||
// at landing pad. The landing pad is created by the compiler
|
* at landing pad. The landing pad is created by the compiler
|
||||||
// to take two parameters in registers.
|
* to take two parameters in registers.
|
||||||
|
*/
|
||||||
_Unwind_SetGR(context, __builtin_eh_return_data_regno(0),
|
_Unwind_SetGR(context, __builtin_eh_return_data_regno(0),
|
||||||
(uintptr_t)exceptionObject);
|
(uintptr_t)exceptionObject);
|
||||||
_Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0);
|
_Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0);
|
||||||
|
@ -231,7 +237,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No landing pad found, continue unwinding.
|
/* No landing pad found, continue unwinding. */
|
||||||
return _URC_CONTINUE_UNWIND;
|
return _URC_CONTINUE_UNWIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
//===-- lshrdi3.c - Implement __lshrdi3 -----------------------------------===//
|
/* ===-- lshrdi3.c - Implement __lshrdi3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __lshrdi3 for the compiler_rt library.
|
* This file implements __lshrdi3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: logical a >> b
|
/* Returns: logical a >> b */
|
||||||
|
|
||||||
// Precondition: 0 <= b < bits_in_dword
|
/* Precondition: 0 <= b < bits_in_dword */
|
||||||
|
|
||||||
di_int
|
di_int
|
||||||
__lshrdi3(di_int a, si_int b)
|
__lshrdi3(di_int a, si_int b)
|
||||||
|
@ -24,12 +25,12 @@ __lshrdi3(di_int a, si_int b)
|
||||||
udwords input;
|
udwords input;
|
||||||
udwords result;
|
udwords result;
|
||||||
input.all = a;
|
input.all = a;
|
||||||
if (b & bits_in_word) // bits_in_word <= b < bits_in_dword
|
if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
|
||||||
{
|
{
|
||||||
result.high = 0;
|
result.high = 0;
|
||||||
result.low = input.high >> (b - bits_in_word);
|
result.low = input.high >> (b - bits_in_word);
|
||||||
}
|
}
|
||||||
else // 0 <= b < bits_in_word
|
else /* 0 <= b < bits_in_word */
|
||||||
{
|
{
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return a;
|
return a;
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
//===-- lshrti3.c - Implement __lshrti3 -----------------------------------===//
|
/* ===-- lshrti3.c - Implement __lshrti3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __lshrti3 for the compiler_rt library.
|
* This file implements __lshrti3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: logical a >> b
|
/* Returns: logical a >> b */
|
||||||
|
|
||||||
// Precondition: 0 <= b < bits_in_tword
|
/* Precondition: 0 <= b < bits_in_tword */
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__lshrti3(ti_int a, si_int b)
|
__lshrti3(ti_int a, si_int b)
|
||||||
|
@ -26,12 +27,12 @@ __lshrti3(ti_int a, si_int b)
|
||||||
utwords input;
|
utwords input;
|
||||||
utwords result;
|
utwords result;
|
||||||
input.all = a;
|
input.all = a;
|
||||||
if (b & bits_in_dword) // bits_in_dword <= b < bits_in_tword
|
if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
|
||||||
{
|
{
|
||||||
result.high = 0;
|
result.high = 0;
|
||||||
result.low = input.high >> (b - bits_in_dword);
|
result.low = input.high >> (b - bits_in_dword);
|
||||||
}
|
}
|
||||||
else // 0 <= b < bits_in_dword
|
else /* 0 <= b < bits_in_dword */
|
||||||
{
|
{
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
return a;
|
return a;
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
//===-- negdi2.c - Implement __negdi2 -------------------------------------===//
|
/* ===-- negdi2.c - Implement __negdi2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __negdi2 for the compiler_rt library.
|
* This file implements __negdi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: -a
|
/* Returns: -a */
|
||||||
|
|
||||||
di_int
|
di_int
|
||||||
__negdi2(di_int a)
|
__negdi2(di_int a)
|
||||||
{
|
{
|
||||||
// Note: this routine is here for API compatibility; any sane compiler
|
/* Note: this routine is here for API compatibility; any sane compiler
|
||||||
// should expand it inline.
|
* should expand it inline.
|
||||||
|
*/
|
||||||
return -a;
|
return -a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
//===-- negti2.c - Implement __negti2 -------------------------------------===//
|
/* ===-- negti2.c - Implement __negti2 -------------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __negti2 for the compiler_rt library.
|
* This file implements __negti2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
|
|
||||||
// Returns: -a
|
/* Returns: -a */
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__negti2(ti_int a)
|
__negti2(ti_int a)
|
||||||
{
|
{
|
||||||
// Note: this routine is here for API compatibility; any sane compiler
|
/* Note: this routine is here for API compatibility; any sane compiler
|
||||||
// should expand it inline.
|
* should expand it inline.
|
||||||
|
*/
|
||||||
return -a;
|
return -a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
//===-- negvdi2.c - Implement __negvdi2 -----------------------------------===//
|
/* ===-- negvdi2.c - Implement __negvdi2 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __negvdi2 for the compiler_rt library.
|
* This file implements __negvdi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Returns: -a
|
/* Returns: -a */
|
||||||
|
|
||||||
// Effects: aborts if -a overflows
|
/* Effects: aborts if -a overflows */
|
||||||
|
|
||||||
di_int
|
di_int
|
||||||
__negvdi2(di_int a)
|
__negvdi2(di_int a)
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
//===-- negvsi2.c - Implement __negvsi2 -----------------------------------===//
|
/* ===-- negvsi2.c - Implement __negvsi2 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __negvsi2 for the compiler_rt library.
|
* This file implements __negvsi2 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Returns: -a
|
/* Returns: -a */
|
||||||
|
|
||||||
// Effects: aborts if -a overflows
|
/* Effects: aborts if -a overflows */
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__negvsi2(si_int a)
|
__negvsi2(si_int a)
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
//===-- subvdi3.c - Implement __subvdi3 -----------------------------------===//
|
/* ===-- subvdi3.c - Implement __subvdi3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __subvdi3 for the compiler_rt library.
|
* This file implements __subvdi3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Returns: a - b
|
/* Returns: a - b */
|
||||||
|
|
||||||
// Effects: aborts if a - b overflows
|
/* Effects: aborts if a - b overflows */
|
||||||
|
|
||||||
di_int
|
di_int
|
||||||
__subvdi3(di_int a, di_int b)
|
__subvdi3(di_int a, di_int b)
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
//===-- subvsi3.c - Implement __subvsi3 -----------------------------------===//
|
/* ===-- subvsi3.c - Implement __subvsi3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __subvsi3 for the compiler_rt library.
|
* This file implements __subvsi3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Returns: a - b
|
/* Returns: a - b */
|
||||||
|
|
||||||
// Effects: aborts if a - b overflows
|
/* Effects: aborts if a - b overflows */
|
||||||
|
|
||||||
si_int
|
si_int
|
||||||
__subvsi3(si_int a, si_int b)
|
__subvsi3(si_int a, si_int b)
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
//===-- subvti3.c - Implement __subvti3 -----------------------------------===//
|
/* ===-- subvti3.c - Implement __subvti3 -----------------------------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
//
|
*
|
||||||
// This file implements __subvti3 for the compiler_rt library.
|
* This file implements __subvti3 for the compiler_rt library.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#if __x86_64
|
#if __x86_64
|
||||||
|
|
||||||
#include "int_lib.h"
|
#include "int_lib.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Returns: a - b
|
/* Returns: a - b */
|
||||||
|
|
||||||
// Effects: aborts if a - b overflows
|
/* Effects: aborts if a - b overflows */
|
||||||
|
|
||||||
ti_int
|
ti_int
|
||||||
__subvti3(ti_int a, ti_int b)
|
__subvti3(ti_int a, ti_int b)
|
||||||
|
|
|
@ -1,46 +1,48 @@
|
||||||
//===----- trampoline_setup.c - Implement __trampoline_setup -------------===//
|
/* ===----- trampoline_setup.c - Implement __trampoline_setup -------------===
|
||||||
//
|
*
|
||||||
// The LLVM Compiler Infrastructure
|
* The LLVM Compiler Infrastructure
|
||||||
//
|
*
|
||||||
// This file is distributed under the University of Illinois Open Source
|
* This file is distributed under the University of Illinois Open Source
|
||||||
// License. See LICENSE.TXT for details.
|
* License. See LICENSE.TXT for details.
|
||||||
//
|
*
|
||||||
//===----------------------------------------------------------------------===//
|
* ===----------------------------------------------------------------------===
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern void __clear_cache(void* start, void* end);
|
extern void __clear_cache(void* start, void* end);
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The ppc compiler generates calls to __trampoline_setup() when creating
|
* The ppc compiler generates calls to __trampoline_setup() when creating
|
||||||
// trampoline functions on the stack for use with nested functions.
|
* trampoline functions on the stack for use with nested functions.
|
||||||
// This function creates a custom 40-byte trampoline function on the stack
|
* This function creates a custom 40-byte trampoline function on the stack
|
||||||
// which loads r11 with a pointer to the outer function's locals
|
* which loads r11 with a pointer to the outer function's locals
|
||||||
// and then jumps to the target nested function.
|
* and then jumps to the target nested function.
|
||||||
//
|
*/
|
||||||
|
|
||||||
#if __ppc__
|
#if __ppc__
|
||||||
void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated,
|
void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated,
|
||||||
const void* realFunc, void* localsPtr)
|
const void* realFunc, void* localsPtr)
|
||||||
{
|
{
|
||||||
// should never happen, but if compiler did not allocate
|
/* should never happen, but if compiler did not allocate */
|
||||||
// enough space on stack for the trampoline, abort
|
/* enough space on stack for the trampoline, abort */
|
||||||
if ( trampSizeAllocated < 40 )
|
if ( trampSizeAllocated < 40 )
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
// create trampoline
|
/* create trampoline */
|
||||||
trampOnStack[0] = 0x7c0802a6; // mflr r0
|
trampOnStack[0] = 0x7c0802a6; /* mflr r0 */
|
||||||
trampOnStack[1] = 0x4800000d; // bl Lbase
|
trampOnStack[1] = 0x4800000d; /* bl Lbase */
|
||||||
trampOnStack[2] = (uint32_t)realFunc;
|
trampOnStack[2] = (uint32_t)realFunc;
|
||||||
trampOnStack[3] = (uint32_t)localsPtr;
|
trampOnStack[3] = (uint32_t)localsPtr;
|
||||||
trampOnStack[4] = 0x7d6802a6; // Lbase: mflr r11
|
trampOnStack[4] = 0x7d6802a6; /* Lbase: mflr r11 */
|
||||||
trampOnStack[5] = 0x818b0000; // lwz r12,0(r11)
|
trampOnStack[5] = 0x818b0000; /* lwz r12,0(r11) */
|
||||||
trampOnStack[6] = 0x7c0803a6; // mtlr r0
|
trampOnStack[6] = 0x7c0803a6; /* mtlr r0 */
|
||||||
trampOnStack[7] = 0x7d8903a6; // mtctr r12
|
trampOnStack[7] = 0x7d8903a6; /* mtctr r12 */
|
||||||
trampOnStack[8] = 0x816b0004; // lwz r11,4(r11)
|
trampOnStack[8] = 0x816b0004; /* lwz r11,4(r11) */
|
||||||
trampOnStack[9] = 0x4e800420; // bctr
|
trampOnStack[9] = 0x4e800420; /* bctr */
|
||||||
|
|
||||||
// clear instruction cache
|
/* clear instruction cache */
|
||||||
__clear_cache(trampOnStack, &trampOnStack[10]);
|
__clear_cache(trampOnStack, &trampOnStack[10]);
|
||||||
}
|
}
|
||||||
#endif // __ppc__
|
#endif /* __ppc__ */
|
||||||
|
|
Loading…
Reference in New Issue