1214152Sed/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== 2214152Sed * 3214152Sed * The LLVM Compiler Infrastructure 4214152Sed * 5222656Sed * This file is dual licensed under the MIT and the University of Illinois Open 6222656Sed * Source Licenses. See LICENSE.TXT for details. 7214152Sed * 8214152Sed * ===----------------------------------------------------------------------=== 9214152Sed * 10214152Sed * This file is a configuration header for compiler-rt. 11214152Sed * This file is not part of the interface of this library. 12214152Sed * 13214152Sed * ===----------------------------------------------------------------------=== 14214152Sed */ 15214152Sed 16214152Sed#ifndef INT_LIB_H 17214152Sed#define INT_LIB_H 18214152Sed 19229135Sed/* Assumption: Signed integral is 2's complement. */ 20229135Sed/* Assumption: Right shift of signed negative is arithmetic shift. */ 21229135Sed/* Assumption: Endianness is little or big (not mixed). */ 22214152Sed 23229135Sed/* ABI macro definitions */ 24214152Sed 25229135Sed#if __ARM_EABI__ 26229135Sed# define ARM_EABI_FNALIAS(aeabi_name, name) \ 27229135Sed void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); 28245642Sandrew 29245642Sandrew# if !defined(__clang__) && defined(__GNUC__) && \ 30245642Sandrew (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 5) 31245642Sandrew/* The pcs attribute was introduced in GCC 4.5.0 */ 32245642Sandrew# define COMPILER_RT_ABI 33245642Sandrew# else 34245642Sandrew# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) 35245642Sandrew# endif 36245642Sandrew 37214152Sed#else 38229135Sed# define ARM_EABI_FNALIAS(aeabi_name, name) 39229135Sed# define COMPILER_RT_ABI 40214152Sed#endif 41214152Sed 42229135Sed/* Include the standard compiler builtin headers we use functionality from. */ 43229135Sed#include <limits.h> 44229135Sed#include <stdint.h> 45229135Sed#include <stdbool.h> 46229135Sed#include <float.h> 47214152Sed 48229135Sed/* Include the commonly used internal type definitions. */ 49229135Sed#include "int_types.h" 50214152Sed 51229135Sed/* Include internal utility function declarations. */ 52229135Sed#include "int_util.h" 53214152Sed 54230021Sed/* 55230021Sed * Workaround for LLVM bug 11663. Prevent endless recursion in 56230021Sed * __c?zdi2(), where calls to __builtin_c?z() are expanded to 57230021Sed * __c?zdi2() instead of __c?zsi2(). 58230021Sed * 59230021Sed * Instead of placing this workaround in c?zdi2.c, put it in this 60230021Sed * global header to prevent other C files from making the detour 61230021Sed * through __c?zdi2() as well. 62230021Sed * 63230021Sed * This problem has only been observed on FreeBSD for sparc64 and 64230021Sed * mips64 with GCC 4.2.1. 65230021Sed */ 66230021Sed#if defined(__FreeBSD__) && (defined(__sparc64__) || \ 67230021Sed defined(__mips_n64) || defined(__mips_o64)) 68230021Sedsi_int __clzsi2(si_int); 69230021Sedsi_int __ctzsi2(si_int); 70230021Sed#define __builtin_clz __clzsi2 71230021Sed#define __builtin_ctz __ctzsi2 72230021Sed#endif 73230021Sed 74214152Sed#endif /* INT_LIB_H */ 75