summaryrefslogtreecommitdiff
path: root/lib/builtins
AgeCommit message (Collapse)Author
2017-11-19[X86] Add cpu detection for cannonlake.Craig Topper
This uses the same encoding for cannonlake in the proposed gcc patches here. https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00551.html git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14[builtins] Include GENERIC_SOURCES in arm_SOURCES for MinGWMartin Storsjo
It is included in the built sources for all other arches supported for MinGW currently, except for arm. Differential Revision: https://reviews.llvm.org/D39938 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[Builtins] Do not use tailcall for Thumb1Weiming Zhao
Summary: The `b` instruction in Thumb1 has limited range, which may cause link-time errors if the jump target is far away. This patch guards the tailcalls for non-Thumb1 Reviewers: peter.smith, compnerd, rengolin, eli.friedman Reviewed By: rengolin Subscribers: joerg, dalias, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D39700 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317814 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07[WebAssembly] Include GENERIC_TF_SOURCES in wasm buildsSam Clegg
Differential Revision: https://reviews.llvm.org/D39748 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[X86] Add Knights Mill CPU to cpu_indicator support to match libgcc.Craig Topper
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-03[compiler-rt] Add back ARM EABI aliases where legal.Eli Friedman
r303188 removed all the uses of aliases for EABI functions from compiler-rt, because some of them had mismatched calling conventions. Obviously, we can't use aliases for functions which don't have the same calling convention, but that's only an issue for floating-point functions with the hardfloat ABI. In other cases, the stubs increase size and reduce performance for no benefit. This patch adds back the aliases, with appropriate checks to make sure they're only used in cases where the calling convention matches. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314851 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02[builtins] ARM: Reland fix for assembling builtins in thumb state.Manoj Gupta
Summary: clang does not assemble files in thumb mode unless .thumb declaration is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that files are assembled correctly. Also add a fix to ensure that armv7k-watchos can assemble the aeabi_c{f|d}cmp.S files. Fixes PR 34715. Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, efriedma, t.p.northover, fjricci Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D38390 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314718 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[builtins] ARM: Revert r314284, r314285 and r314289Manoj Gupta
Revert r314284, r314285 and r314289 because of a reported breakage in armv7k watchos builder. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[ARM] builtins: Replace abort by assert in clear_cache.Manoj Gupta
Summary: __builtion___clear_cache maps to clear_cache function. On Linux, clear_cache functions makes a syscall and does an abort if syscall fails. Replace the abort by an assert so that non-debug builds do not abort if the syscall fails. Fixes PR34588. Reviewers: rengolin, compnerd, srhines, peter.smith, joerg Reviewed By: rengolin Subscribers: aemerson, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D37788 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[builtins] fix build error on non-ARM for r314285.Manoj Gupta
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Builtins] ARM: Fix assembling files in thumb mode.Manoj Gupta
Summary: clang does not assemble files in thumb mode unless .thumb declaration is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that files are assembled correctly. Fixes PR 34715. Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D38227 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Builtins] ARM: Fix msr assembly instruction use for Thumb2.Manoj Gupta
Summary: MSR instruction in Thumb2 does not support immediate operand. Fix this by moving the condition for V7-M to Thumb2 since V7-M support Thumb2 only. With this change, aeabi_cfcmp.s and aeabi_cdcmp.S files can be assembled in Thumb2 mode. (This is split out from the review D38227). Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, kristof.beyls Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D38268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314284 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26[Builtins] Use 4 byte alignment for __aeabi_memclr.Manoj Gupta
Summary: Align __aeabi_memclr to 4 bytes. All other ARM functions are already aligned to 4-bytes in compiler-rt. (Split off from review D38227) Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, kristof.beyls Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D38271 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314255 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30[builtins] Prevent duplicate definitions for overridden functionsFrancis Ricci
Summary: Some architecture-specific function overrides (for example, i386/ashrdi3.S) duplicate generic functions (in that case, ashrdi3.c). Prevent duplicate definitions by filtering out the generic files before compiling. Reviewers: compnerd, beanz Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D37166 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28Reland r311842 - [cmake] Remove i686 target that is duplicate to i386Michal Gorny
Remove the explicit i686 target that is completely duplicate to the i386 target, with the latter being used more commonly. 1. The runtime built for i686 will be identical to the one built for i386. 2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion on the clang end which has to expect either of them. 3. The checks are based on wrong assumption that __i686__ is defined for all newer x86 CPUs. In fact, it is only declared when -march=i686 is explicitly used. It is not available when a more specific (or newer) -march is used. Curious enough, if CFLAGS contain -march=i686, the runtime will be built both for i386 and i686. For any other value, only i386 variant will be built. Differential Revision: https://reviews.llvm.org/D26764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27Revert r311842 - [cmake] Remove i686 target that is duplicate to i386Michal Gorny
The required change in clang is being reverted because of the Android build bot failure. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-27[cmake] Remove i686 target that is duplicate to i386Michal Gorny
Remove the explicit i686 target that is completely duplicate to the i386 target, with the latter being used more commonly. 1. The runtime built for i686 will be identical to the one built for i386. 2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion on the clang end which has to expect either of them. 3. The checks are based on wrong assumption that __i686__ is defined for all newer x86 CPUs. In fact, it is only declared when -march=i686 is explicitly used. It is not available when a more specific (or newer) -march is used. Curious enough, if CFLAGS contain -march=i686, the runtime will be built both for i386 and i686. For any other value, only i386 variant will be built. Differential Revision: https://reviews.llvm.org/D26764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23[ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to ↵Oleg Ranevskyy
non-AEABI functions on HF targets Summary: This is a patch for PR34167. On HF targets functions like `__{eq,lt,le,ge,gt}df2` and `__{eq,lt,le,ge,gt}sf2` expect their arguments to be passed in d/s registers, while some of the AEABI builtins pass them in r registers. Reviewers: compnerd, peter.smith, asl Reviewed By: peter.smith, asl Subscribers: peter.smith, aemerson, dberris, javed.absar, llvm-commits, asl, kristof.beyls Differential Revision: https://reviews.llvm.org/D36675 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311555 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22Revert "builtins: erase `struct` modifier for EH personality"Saleem Abdulrasool
This reverts SVN r311425 which broke one of the buildbots. It is unclear what header is being used there. Revert it until that can be handled properly. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22builtins: erase `struct` modifier for EH personalitySaleem Abdulrasool
On ARM, the `_Unwind_Exception` is an alias for `struct _Unwind_Control_Block`. The extra `struct` modifier causes a warning due to the locally scoped type. Special case this to avoid the warning. NFC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14[builtins] fix build error on non-ARM for r310884Weiming Zhao
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14[builtins][ARM] Select correct code fragments when compiling for ↵Weiming Zhao
Thumb1/Thum2/ARM ISA Summary: Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation mode (-mthumb, -marm), it reflect's capability of given CPU. Due to this: •use tbumb and thumb2 insteand of __ARM_ARCH_ISA_THUMB •use '.thumb' directive consistently in all affected files •decorate all thumb functions using DEFINE_COMPILERRT_THUMB_FUNCTION() (This is based off Michal's patch https://reviews.llvm.org/D30938) Reviewers: dim, rengolin, compnerd, strejda Reviewed By: compnerd Subscribers: peter.smith, kubamracek, mgorny, javed.absar, kristof.beyls, jamesduley, aemerson, llvm-commits Differential Revision: https://reviews.llvm.org/D31220 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10[compiler-rt][ARM] Fix filtering of ARM targetsOleg Ranevskyy
Summary: Similarly to i686, the ARM build target has multiple names, such as armhf, armv7 and so on. Currently we get duplicated symbol definitions for these targets while compiling the library. Each duplicated definition has its generic version from `lib/builtins` and an ARM-specialized version from `lib/builtins/arm`. This patch fixes filtering for ARM to ignore the generic definitions if they have their ARM specializations. Reviewers: compnerd Reviewed By: compnerd Subscribers: aemerson, dberris, llvm-commits, mgorny, asl, kristof.beyls Differential Revision: https://reviews.llvm.org/D35336 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310588 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03[builtins] Use Interlocked* intrinsics for atomics on MSVCMartin Storsjo
Tested on MSVC 2013, 2015 and 2017 targeting X86, X64 and ARM. This fixes building emutls.c for Windows for ARM (both with clang which don't need these atomics fallbacks at all, but just failed due to the immintrin.h include before, and with MSVC). Differential Revision: https://reviews.llvm.org/D36071 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02This ppc64 implementation of clear_cache works for both big and little endian.Sterling Augustine
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01Revert rL309634 until upstream buildbots have upgraded libc.Sterling Augustine
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309704 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31Add powerpc64 to compiler-rt build infrastructure.Sterling Augustine
Summary: Add powerpc64 to compiler-rt build infrastructure. Reviewers: timshen Reviewed By: timshen Subscribers: nemanjai, dberris, mgorny, aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D36108 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31[builtins] Fix mingw-w64 cross compilationMartin Storsjo
Lowercase the Windows.h include in enable_execute_stack.c, just as in emutls.c in SVN r302340. Differential Revision: https://reviews.llvm.org/D36066 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309537 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28Add clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.Sterling Augustine
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309423 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24[mips] Switch asm to __asm__ for non-GNU compiles.Stephen Hines
Summary: Using asm works fine for gnu11, but fails if the compiler uses C11. Switch to the more consistent __asm__, since that is what the rest of the source is using. Reviewers: petarj Reviewed By: petarj Subscribers: llvm-commits, sdardis, arichardson, pirama Differential Revision: https://reviews.llvm.org/D35756 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21Remove Bitrig: CompilerRT ChangesErich Keane
Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35709 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19[X86][builtins] Sync getX86CpuIDAndInfoEx with llvm's Host.cpp again.Craig Topper
We now use __cpuidex intrinsics intead of inline asm on 32-bit Windows. We already used it on 64-bit. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308420 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13[compiler-rt][X86] Match the detection of cpu's for __cpu_model to the ↵Craig Topper
latest version of gcc Summary: We were missing many feature flags that newer gcc supports and we had our own set of feature flags that gcc didnt' support that were overlapping. Clang's implementation assumes gcc's features list so a mismatch here is problematic. I've also matched the cpu type/subtype lists with gcc and removed all the cpus that gcc doesn't support. I've also removed the fallback autodetection logic that was taken from Host.cpp. It was the main reason we had extra feature flags relative to gcc. I don't think gcc does this in libgcc. Once this support is in place we can consider implementing __builtin_cpu_is in clang. This could also be needed for function dispatching that Erich Keane is working on. Reviewers: echristo, asbirlea, RKSimon, erichkeane, zvi Reviewed By: asbirlea Subscribers: dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D35214 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[builtins] Better Fuchsia supportPetr Hosek
Add Fuchsia support to some builtings and avoid building builtins that are not and will never be used on Fuchsia. Differential Revision: https://reviews.llvm.org/D34075 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10[X86] Sync a few more things from llvm's Host.cpp to cpu_model.Craig Topper
This syncs the cpuid functions and adds breaks to the appropriate spots in the CPU decoding switches. Also a few formatting tweaks. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307561 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10[X86] Resync cpu_model.c with llvm's Host.cpp in preparation for making it ↵Craig Topper
compatible with newer gcc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25Add generic __bswap[ds]i2 implementationsDimitry Andric
Summary: In FreeBSD we needed to add generic implementations for `__bswapdi2` and `__bswapsi2`, since gcc 6.x for mips is emitting calls to these. See: https://reviews.freebsd.org/D10838 and https://reviews.freebsd.org/rS318601 The actual mips code generated for these generic C versions is pretty OK, as can be seen in the (FreeBSD) review. I checked over gcc sources, and it seems that it can emit these calls on more architectures, so maybe it's best to simply always add them to the compiler-rt builtins library. Reviewers: howard.hinnant, compnerd, petarj, emaste Reviewed By: compnerd, emaste Subscribers: mgorny, llvm-commits, arichardson Differential Revision: https://reviews.llvm.org/D33516 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[cmake] Disable building emutls.c for baremetal targets.Catherine Moore
Differential Revision: https://reviews.llvm.org/D33199 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24Allow armv{7,7s,7k,7m,7em} buildsJonathan Roelofs
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303765 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-16builtins: fix guard __AEABI__ -> __ARM_EABI__Saleem Abdulrasool
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-16builtins: one more case of a missing headerSaleem Abdulrasool
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303195 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-16builtins: add missing includesSaleem Abdulrasool
This inclusion is needed to fix the ARM build. The int_lib.h include is slightly ugly, but allows us to use the `AEABI_RTABI` macro to decorate the CC for the functions. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-16builtins: expand out the AEABI function stubsSaleem Abdulrasool
These actually may change calling conventions. We cannot simply provide function aliases as the aliased function may have a different calling convention. Provide a forwarding function instead to permit the compiler to synthesize the calling convention adjustment thunk. Remove the `ARM_EABI_FNALIAS` macro as that is not safe to use. Resolves PR33030! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303188 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-16builtins: use reserved spelling (NFC)Saleem Abdulrasool
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303138 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15Fix executable stack directive on Linux.Manoj Gupta
Summary: Use __linux__ to check for Linux and bring back the check for __GNU__. Reviewers: echristo, krytarowski, compnerd, rengolin Reviewed By: krytarowski Subscribers: phosek, llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D33219 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303131 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15[builtins] Fix a check from __GNU__ to __GNUC__ for disabling executable stack.Manoj Gupta
Summary: Neither GCC nor Clang define __GNU__. Instead use __GNUC__ for the check. Reviewers: echristo, rengolin, compnerd Subscribers: srhines, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D33211 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15builtins: fix filtering aliased targetsSaleem Abdulrasool
Some build targets (e.g. i686) have aliased names (e.g. i386). We would get multiple definitions previously and have the linker arbitrarily select a definition on those aliased targets. Make this more deterministic by checking those aliases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303103 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10[cmake] Disable building enable_execute_stack.c for baremetal targets.Catherine Moore
Disable building enable_execute_stack.c for targets that do not have support for mprotect(). Differential Revision: https://reviews.llvm.org/D33018 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-06[builtins] Fixup emulated TLS for mingw.Martell Malone
Enabled emulated TLS on WOA for mingw Fix <windows.h> include for mingw Reviewed By: chapuni, mstorsjo Subscribers: compnerd, llvm-commits Differential Revision: https://reviews.llvm.org/D32681 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302340 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04[compiler-rt][mips] Add support for quad precision builtins for mips64Simon Dardis
Match the builtins that GCC provides for IEEE754 quad precision on MIPS64. Also, enable building them with clang as PR20098 is resolved. Disable tests for xf and xc modes as MIPS doesn't support that mode in hardware or software. Reviewers: slthakur Differential Revision: https://reviews.llvm.org/D32794 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302147 91177308-0d34-0410-b5e6-96231b3b80d8