summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/builtins
Commit message (Collapse)AuthorAgeFilesLines
* [ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to ↵Oleg Ranevskyy2017-08-232-0/+18
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 311555
* Revert "builtins: erase `struct` modifier for EH personality"Saleem Abdulrasool2017-08-221-25/+17
| | | | | | | | 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. llvm-svn: 311426
* builtins: erase `struct` modifier for EH personalitySaleem Abdulrasool2017-08-221-17/+25
| | | | | | | | | 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. llvm-svn: 311425
* [builtins] fix build error on non-ARM for r310884Weiming Zhao2017-08-141-0/+2
| | | | llvm-svn: 310890
* [builtins][ARM] Select correct code fragments when compiling for ↵Weiming Zhao2017-08-1416-128/+95
| | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 310884
* [compiler-rt][ARM] Fix filtering of ARM targetsOleg Ranevskyy2017-08-101-2/+6
| | | | | | | | | | | | | | | | | 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 llvm-svn: 310588
* [builtins] Use Interlocked* intrinsics for atomics on MSVCMartin Storsjo2017-08-031-8/+6
| | | | | | | | | | | | 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 llvm-svn: 309974
* This ppc64 implementation of clear_cache works for both big and little endian.Sterling Augustine2017-08-021-1/+1
| | | | llvm-svn: 309848
* Revert rL309634 until upstream buildbots have upgraded libc.Sterling Augustine2017-08-012-15/+1
| | | | llvm-svn: 309704
* Add powerpc64 to compiler-rt build infrastructure.Sterling Augustine2017-07-312-1/+15
| | | | | | | | | | | | | | 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 llvm-svn: 309634
* [builtins] Fix mingw-w64 cross compilationMartin Storsjo2017-07-311-1/+1
| | | | | | | | | 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 llvm-svn: 309537
* Add clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.Sterling Augustine2017-07-281-1/+15
| | | | llvm-svn: 309423
* [mips] Switch asm to __asm__ for non-GNU compiles.Stephen Hines2017-07-241-1/+1
| | | | | | | | | | | | | | | | | 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 llvm-svn: 308922
* Remove Bitrig: CompilerRT ChangesErich Keane2017-07-212-4/+4
| | | | | | | | Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35709 llvm-svn: 308798
* [X86][builtins] Sync getX86CpuIDAndInfoEx with llvm's Host.cpp again.Craig Topper2017-07-191-29/+10
| | | | | | We now use __cpuidex intrinsics intead of inline asm on 32-bit Windows. We already used it on 64-bit. llvm-svn: 308420
* [compiler-rt][X86] Match the detection of cpu's for __cpu_model to the ↵Craig Topper2017-07-131-309/+109
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 307878
* [builtins] Better Fuchsia supportPetr Hosek2017-07-122-4/+19
| | | | | | | | | 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 llvm-svn: 307832
* [X86] Sync a few more things from llvm's Host.cpp to cpu_model.Craig Topper2017-07-101-42/+32
| | | | | | This syncs the cpuid functions and adds breaks to the appropriate spots in the CPU decoding switches. Also a few formatting tweaks. llvm-svn: 307561
* [X86] Resync cpu_model.c with llvm's Host.cpp in preparation for making it ↵Craig Topper2017-07-101-34/+55
| | | | | | compatible with newer gcc. llvm-svn: 307558
* Add generic __bswap[ds]i2 implementationsDimitry Andric2017-05-254-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 303866
* [cmake] Disable building emutls.c for baremetal targets.Catherine Moore2017-05-251-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D33199 llvm-svn: 303865
* Allow armv{7,7s,7k,7m,7em} buildsJonathan Roelofs2017-05-2417-0/+38
| | | | llvm-svn: 303765
* builtins: fix guard __AEABI__ -> __ARM_EABI__Saleem Abdulrasool2017-05-161-1/+1
| | | | llvm-svn: 303207
* builtins: one more case of a missing headerSaleem Abdulrasool2017-05-161-0/+2
| | | | llvm-svn: 303195
* builtins: add missing includesSaleem Abdulrasool2017-05-162-0/+2
| | | | | | | | 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. llvm-svn: 303190
* builtins: expand out the AEABI function stubsSaleem Abdulrasool2017-05-1645-90/+300
| | | | | | | | | | | | | 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! llvm-svn: 303188
* builtins: use reserved spelling (NFC)Saleem Abdulrasool2017-05-161-1/+1
| | | | llvm-svn: 303138
* Fix executable stack directive on Linux.Manoj Gupta2017-05-151-1/+2
| | | | | | | | | | | | | | 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 llvm-svn: 303131
* [builtins] Fix a check from __GNU__ to __GNUC__ for disabling executable stack.Manoj Gupta2017-05-151-1/+1
| | | | | | | | | | | | | 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 llvm-svn: 303112
* builtins: fix filtering aliased targetsSaleem Abdulrasool2017-05-151-1/+8
| | | | | | | | | 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. llvm-svn: 303103
* [cmake] Disable building enable_execute_stack.c for baremetal targets.Catherine Moore2017-05-101-1/+6
| | | | | | | | | Disable building enable_execute_stack.c for targets that do not have support for mprotect(). Differential Revision: https://reviews.llvm.org/D33018 llvm-svn: 302680
* [builtins] Fixup emulated TLS for mingw.Martell Malone2017-05-062-2/+3
| | | | | | | | | | | | | 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 llvm-svn: 302340
* [compiler-rt][mips] Add support for quad precision builtins for mips64Simon Dardis2017-05-042-23/+26
| | | | | | | | | | | | | | 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 llvm-svn: 302147
* Roll back r301831 to fix broken powerpc64le tests.Sterling Augustine2017-05-021-14/+0
| | | | | | http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/5941 llvm-svn: 301935
* Add powerpc64 and powerpc64le to build infrastructure.Sterling Augustine2017-05-011-0/+14
| | | | | | From Phab D32031. llvm-svn: 301831
* Cleanup previous test commit.Sterling Augustine2017-05-011-1/+0
| | | | llvm-svn: 301820
* Add a blank line as a test-commit.Sterling Augustine2017-05-011-0/+1
| | | | | | Per http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access llvm-svn: 301818
* [builtins] Implement emulated TLS on Windows.Frederich Munch2017-04-252-67/+236
| | | | | | | | | | | | | | | Summary: LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows. Reviewers: chh, howard.hinnant Reviewed By: chh Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D30787 llvm-svn: 301350
* Revert r301089 "[builtins] Implement emulated TLS on Windows."Hans Wennborg2017-04-242-222/+67
| | | | | | | | | | | | | | | | | | | | | This broke the self-host build on Windows (PR32777). Original commit message: > [builtins] Implement emulated TLS on Windows. > > Summary: > LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows. > > Reviewers: chh, howard.hinnant > > Reviewed By: chh > > Subscribers: mgorny, llvm-commits > > Differential Revision: https://reviews.llvm.org/D30787 llvm-svn: 301274
* [builtins] Implement emulated TLS on Windows.Frederich Munch2017-04-222-67/+222
| | | | | | | | | | | | | | | Summary: LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows. Reviewers: chh, howard.hinnant Reviewed By: chh Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D30787 llvm-svn: 301089
* [builtins] Make some ISA macro checks work with MSVCReid Kleckner2017-04-073-3/+3
| | | | llvm-svn: 299786
* [builtins] Fix MSVC buildReid Kleckner2017-04-072-17/+24
| | | | | | | | | | Avoid __attribute__((constructor)) in cpu_model.c. Use more C99 _Complex emulation in divtc3.c. Joerg Sonnenberger added this builtin just after the last round of C99 _Complex emulation landed in r249514 (Oct 2015). llvm-svn: 299784
* [builtins] Get the builtins tests passing on WindowsReid Kleckner2017-04-071-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Many things were broken: - We stopped building most builtins on Windows in r261432 for reasons that are not at all clear to me. This essentially reverts that patch. - Fix %librt to expand to clang_rt.builtins-$arch.lib on Windows instead of libclang_rt.builtins-$arch.a. - Fix memory protection tests (trampoline, enable executable, clear cache) on Windows. One issue was that the MSVC incremental linker generates ILT thunks for functions with external linkage, so memcpying the functions into the executable stack buffer wasn't working. You can't memcpy an RIP-relative jump without fixing up the offset. - Disable tests that rely on C99 complex library functions when using the MSVC CRT, which isn't compatible with clang's C99 _Complex. In theory, these could all be separate patches, but it would not green the tests, so let's try for it all at once. Hopefully this fixes the clang-x64-ninja-win7 bot. llvm-svn: 299780
* Add __ffssi2 implementation to compiler-rt builtinsDimitry Andric2017-04-063-0/+31
| | | | | | | | | | | | | | | | | | | | Summary: During MIPS implementation work for FreeBSD, John Baldwin (jhb@FreeBSD.org) found that gcc 6.x emits calls to __ffssi2() when compiling libc and some userland programs in the base system. Add it to compiler-rt's builtins, based off of the existing __ffsdi2() implementation. Also update the CMake files and add a test case. Reviewers: howard.hinnant, weimingz, rengolin, compnerd Reviewed By: weimingz Subscribers: dberris, mgorny, llvm-commits, emaste Differential Revision: https://reviews.llvm.org/D31721 llvm-svn: 299675
* [Builtins] Fix div0 error in udivsi3Weiming Zhao2017-04-061-12/+14
| | | | | | | | | | | | | | Summary: Need to save `lr` before bl to aeabi_div0 Reviewers: rengolin, compnerd Reviewed By: compnerd Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31716 llvm-svn: 299628
* [Builtin] Unxfail tests for armhfWeiming Zhao2017-03-292-2/+6
| | | | | | | | | | | | | | | | | | | | | Summary: Originally, a few tests fail for armhf target due to: 1) COMPILER_RT_ARMHF_TARGET was not set when building the lib 2) COMPILER_RT_ABI should not be defined as `__attribute__((pcs("aapcs")))` for armhf when building for both lib and tests This address https://bugs.llvm.org//show_bug.cgi?id=32261 mulsc3_test.c is a newly exposed issue, which will be addressed separately. Reviewers: rengolin, compnerd Reviewed By: compnerd Subscribers: aemerson, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D31448 llvm-svn: 298974
* Revert "builtins: Select correct code fragments when compiling for ↵Weiming Zhao2017-03-2414-108/+64
| | | | | | | | | Thumb1/Thum2/ARM ISA." This reverts commit c3709191b6d36c4c936173f4a9a29a734b12cb15. (commit by mistake) llvm-svn: 298715
* builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.Weiming Zhao2017-03-2414-64/+108
| | | | | | | | | | | | | | | | | | | | | | | 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() --------- Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 ! Reviewers: weimingz, rengolin, compnerd Subscribers: aemerson, dim Differential Revision: https://reviews.llvm.org/D30938 llvm-svn: 298713
* [compiler-rt][builtins] Ignore the deprecated warning forAlex Lorenz2017-03-151-0/+3
| | | | | | | | CFPropertyListCreateFromXMLData that's used in __isOSVersionAtLeast I forgot to add the pragmas in r297760. llvm-svn: 297827
* [compiler-rt][builtins] __isOSVersionAtLeast should load CoreFoundationAlex Lorenz2017-03-141-17/+68
| | | | | | | | | | | | | | | | symbols dynamically The CoreFoundation symbols uses by __isOSVersionAtLeast should be loaded at runtime to ensure that the programs that don't use @available won't have to be linked to CoreFoundation. The Clang frontend IRGen library will need to emit a CoreFoundation symbol when @available is used to ensure that programs that actually use @available are linked to CoreFoundation. rdar://31039554 llvm-svn: 297760
OpenPOWER on IntegriCloud