summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/builtins
Commit message (Collapse)AuthorAgeFilesLines
* [RISCV-V] Provide muldi3 builtin assembly implementationkamlesh kumar2020-06-253-19/+46
| | | | | | | | | | Provides an assembly implementation of muldi3 for RISC-V, to solve bug 43388. Since the implementation is the same as for mulsi3, that code was moved to `riscv/int_mul_impl.inc` and is now reused by both `mulsi3.S` and `muldi3.S`. Differential Revision: https://reviews.llvm.org/D80465 (cherry picked from commit e31ccee1b01acf703889312ee86023ff87bd39fe)
* Revert "Revert 1689ad27af5 "[builtins] Implement rounding mode support for ↵Yi Kong2019-11-272-0/+46
| | | | | | | | | i386/x86_64"" Don't build specilised fp_mode.c on MSVC since it does not support inline ASM on x86_64. This reverts commit a19f0eec94e195cac676d0d473882b48f4fded90.
* [PowerPC][compiler-rt][builtins]Add __fixtfti builtin on PowerPCLei Huang2019-11-252-0/+39
| | | | | | | | | | | | Implements __fixtfti builtin for PowerPC. This builtin converts a long double (IBM double-double) to a signed int128. The conversion relies on the unsigned conversion of the absolute value of the long double. Tests included for both positive and negative long doubles. Patch By: Baptiste Saleil Differential Revision: https://reviews.llvm.org/D69730
* [compiler-rt] Don't check XCR0 when detecting avx512 on Darwin.Florian Hahn2019-11-211-0/+8
| | | | | | | | | | | | | | | | | | | Darwin lazily saves the AVX512 context on first use [1]: instead of checking that it already does to figure out if the OS supports AVX512, trust that the kernel will do the right thing and always assume the context save support is available. [1] https://github.com/apple/darwin-xnu/blob/xnu-4903.221.2/osfmk/i386/fpu.c#L174 Reviewers: ab, RKSimon, craig.topper Reviewed By: craig.topper Subscribers: dberris, JDevlieghere, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D70454
* Revert 1689ad27af5 "[builtins] Implement rounding mode support for i386/x86_64"Hans Wennborg2019-11-192-40/+0
| | | | | | | | It broke the build with MSVC: fp_mode.c(20): error C2065: '__asm__': undeclared identifier > Differential Revision: https://reviews.llvm.org/D69870
* [X86] Add AMD Matisse (znver2) model number to getHostCPUName and ↵Craig Topper2019-11-181-2/+2
| | | | | | | | | | compiler-rt's getAMDProcessorTypeAndSubtype. This is the CPUID model used on Ryzen 3000 series (Zen 2/Matisse) CPUs. Patch by Alex James Differential Revision: https://reviews.llvm.org/D70279
* [builtins] Implement rounding mode support for i386/x86_64Yi Kong2019-11-182-0/+40
| | | | Differential Revision: https://reviews.llvm.org/D69870
* [PowerPC][compiler-rt][builtins]Fix __fixunstfti builtin on PowerPCLei Huang2019-11-081-2/+12
| | | | | | | | | | | __fixunstfti converts a long double (IBM double-double) to an unsigned 128 bit integer. This patch enables it to handle a previously unhandled case in which a negative low double may impact the result of the conversion. Collaborated with @masoud.ataei and @renenkel. Patch By: Baptiste Saleil Differential Revision: https://reviews.llvm.org/D69193
* [Builtins] Fix bug where powerpc builtins specializations didn't remove ↵Dan Liew2019-10-301-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generic implementations. Summary: Previously the CMake code looked for filepaths of the form `<arch>/<filename>` as an indication that `<arch>/<filename>` provided a specialization of a top-level file `<filename>`. For powerpc there was a bug because the powerpc specialized implementations lived in `ppc/` but the architectures were `powerpc64` and `powerpc64le` which meant that CMake was looking for files at `powerpc64/<filename>` and `powerpc64le/<filename>`. The result of this is that for powerpc the builtins library contained a duplicate symbol for `divtc3` because it had the generic implementation and the specialized version in the built static library. Although we could just add similar code to what there is for arm (i.e. compute `${_arch}`) to fix this, this is extremely error prone (until r375150 no error was raised). Instead this patch takes a different approach that removes looking for the architecture name entirely. Instead this patch uses the convention that a source file in a sub-directory might be a specialization of a generic implementation and if a source file of the same name (ignoring extension) exists at the top-level then it is the corresponding generic implementation. This approach is much simpler because it doesn't require keeping track of different architecture names. This convention already existed in repository but previously it was implicit. This change makes it explicit. This patch is motivated by wanting to revert r375162 which worked around the powerpc bug found when r375150 landed. Once it lands we should revert r375162. Reviewers: phosek, beanz, compnerd, shiva0217, amyk, rupprecht, kongyi, mstorsjo, t.p.northover, weimingz, jroelofs, joerg, sidneym Subscribers: nemanjai, mgorny, kristof.beyls, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D69189
* [AArch64][Builtins] Avoid unnecessary cache cleaningBryan Chan2019-10-281-13/+23
| | | | | | | | | | | | Use new control bits CTR_EL0.DIC and CTR_EL0.IDC to discover the d-cache cleaning and i-cache invalidation requirements for instruction-to-data coherence. This matches the behavior in the latest libgcc. Author: Shaokun Zhang <zhangshaokun@hisilicon.com> Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D69247
* [mips] [builtins] Remove clear_mips_cacheZoran Jovanovic2019-10-171-50/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D69021 llvm-svn: 375110
* [builtins] Unbreak build on FreeBSD armv7 after D60351David Carlier2019-10-082-3/+9
| | | | | | | | | | | | headers include reordering. Reviewers: phosek, echristo Reviewed-By: phosek Differential Revsion: https://reviews.llvm.org/D68045 llvm-svn: 374070
* Fix int to bool errors exposed due to r372612.Rumeet Dhindsa2019-09-243-4/+4
| | | | | | | | | Differential Revision: https://reviews.llvm.org/D67937 M lib/builtins/fp_add_impl.inc M lib/builtins/fp_lib.h M lib/builtins/fp_trunc_impl.inc llvm-svn: 372684
* compiler-rt: use fp_t instead of long double, for consistencyEd Maste2019-09-094-4/+4
| | | | | | | | | Most builtins accepting or returning long double use the fp_t typedef. Change the remaining few cases to do so. Differential Revision: https://reviews.llvm.org/D35034 llvm-svn: 371400
* Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3""Yi Kong2019-09-0512-16/+199
| | | | | | | | Test failure fixed. This reverts commit e204d244badb2e9765a1020f41c773f63da208f4. llvm-svn: 371003
* [X86] Add support for avx512bf16 for __builtin_cpu_supports and ↵Craig Topper2019-09-041-1/+7
| | | | | | compiler-rt's cpu indicator. llvm-svn: 370915
* Move a break into the correct place. NFCI.Peter Collingbourne2019-08-231-1/+1
| | | | | | Should silence new C fallthrough warning. llvm-svn: 369813
* Fix Wnewline-eof after r368598Nico Weber2019-08-122-2/+2
| | | | llvm-svn: 368613
* [builtins] MSVC warning disable for clean buildMatthew G McGovern2019-08-125-0/+55
| | | | | | | - https://reviews.llvm.org/D66023 - amended for ifdef/if gcc errors in previous verison llvm-svn: 368598
* Revert "[sanitizers] MSVC warning disable for clean build" and follow-up ↵Eric Christopher2019-08-095-54/+0
| | | | | | | | that tried to fix the build as it's still broken. This reverts commit 368476 and 368480. llvm-svn: 368481
* Fix compilation after SVN r368476Martin Storsjo2019-08-091-0/+1
| | | | | | | | | That revision broke compilation with this error: lib/builtins/fixunsxfdi.c:13:2: error: unterminated conditional directive #if !_ARCH_PPC llvm-svn: 368480
* [sanitizers] MSVC warning disable for clean buildMatthew G McGovern2019-08-095-0/+53
| | | | | | - https://reviews.llvm.org/D66023 llvm-svn: 368476
* BMI2 support is indicated in bit eight of EBX, not nine.Eric Christopher2019-08-051-1/+1
| | | | | | | | | See Intel SDM, Vol 2A, Table 3-8: https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-2a-manual.pdf#page=296 Differential Revision: https://reviews.llvm.org/D65766 llvm-svn: 367929
* gn build: Fix redundant object files in builtin lib.Nico Weber2019-07-311-18/+0
| | | | | | | | | | | | | | | | | | | | | | compiler-rt's builtin library has generic implementations of many functions, and then per-arch optimized implementations of some. In the CMake build, both filter_builtin_sources() and an explicit loop at the end of the build file (see D37166) filter out the generic versions if a per-arch file is present. The GN build wasn't doing this filtering. Just do the filtering manually and explicitly, instead of being clever. While here, also remove files from the mingw/arm build that are redundantly listed after D39938 / r318139 (both from the CMake and the GN build). While here, also fix a target_os -> target_cpu typo. Differential Revision: https://reviews.llvm.org/D65512 llvm-svn: 367448
* [compiler-rt][builtins] Provide __clear_cache for SPARCRainer Orth2019-07-231-0/+10
| | | | | | | | | | | | | | | While working on https://reviews.llvm.org/D40900, two tests were failing since __clear_cache aborted. While libgcc's __clear_cache is just empty, this only happens because gcc (in gcc/config/sparc/sparc.c (sparc32_initialize_trampoline, sparc64_initialize_trampoline)) emits flush insns directly. The following patch mimics that. Tested on sparcv9-sun-solaris2.11. Differential Revision: https://reviews.llvm.org/D64496 llvm-svn: 366822
* [builtins] Fix assembly in arm sync-ops.hNikita Popov2019-07-121-1/+1
| | | | | | | | | This assembly is part of a macro that was reformatted in D60351. The missing space between push and { results in: Error: bad instruction `push{r4, r5,r6,lr}' llvm-svn: 365957
* Enable compiler-rt on SPARCRainer Orth2019-07-122-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables compiler-rt on SPARC targets. Most of the changes are straightforward: - Add 32 and 64-bit sparc to compiler-rt - lib/builtins/fp_lib.h needed to check if the int128_t and uint128_t types exist (which they don't on sparc) There's one issue of note: many asan tests fail to compile on Solaris/SPARC: fatal error: error in backend: Function "_ZN7testing8internal16BoolFromGTestEnvEPKcb": over-aligned dynamic alloca not supported. Therefore, while asan is still built, both asan and ubsan-with-asan testing is disabled. The goal is to check if asan keeps compiling on Solaris/SPARC. This serves asan in gcc, which doesn't have the problem above and works just fine. With this patch, sparcv9-sun-solaris2.11 test results are pretty good: Failing Tests (9): Builtins-sparc-sunos :: divtc3_test.c Builtins-sparcv9-sunos :: compiler_rt_logbl_test.c Builtins-sparcv9-sunos :: divtc3_test.c [...] UBSan-Standalone-sparc :: TestCases/TypeCheck/misaligned.cpp UBSan-Standalone-sparcv9 :: TestCases/TypeCheck/misaligned.cpp The builtin failures are due to Bugs 42493 and 42496. The tree contained a few additonal patches either currently in review or about to be submitted. Tested on sparcv9-sun-solaris2.11. Differential Revision: https://reviews.llvm.org/D40943 llvm-svn: 365880
* [builtins] Use libtool for builtins when building for Apple platformPetr Hosek2019-06-041-0/+3
| | | | | | | | | | | | compiler-rt already uses libtool instead of ar when building for Apple platform, but that's not being used when builtins are being built separately e.g. as part of the runtimes build. This change extracts the logic setting up libtool into a separate file and uses it from both the compiler-rt and standalone builtins build. Differential Revision: https://reviews.llvm.org/D62820 llvm-svn: 362466
* builtins: correct function name for AEABISaleem Abdulrasool2019-06-031-2/+2
| | | | | | | | | | If `COMPILER_RT_ARMHF_TARGET` is set , the definition of the AEABI runtime function `__aeabi_fcmpun` is misspelt: `__aeabi_fcmpum` instead of `__aeabi_fcmpun`. Patch by Konstantin Schwarz! llvm-svn: 362424
* [builtins] Move the compare2f definition outside of the macroPetr Hosek2019-05-291-11/+19
| | | | | | | | | This should hopefully address the error we're seeing in older versions of Clang. Differential Revision: https://reviews.llvm.org/D62554 llvm-svn: 361909
* [X86] Add more icelake model numbers to compiler-rt implementation of ↵Craig Topper2019-05-221-0/+8
| | | | | | | | | __builtin_cpu_is. Using model numbers found in Table 2-1 of the May 2019 version of the Intel Software Developer's Manual Volume 4. llvm-svn: 361423
* [builtins] Deduplicate __eqsf2 and __gtsf2 via macroPetr Hosek2019-05-201-77/+30
| | | | | | | | | | | The only difference between __eqsf2 and __gtsf2 is whether they return 1 or -1 on NaN. Rather than duplicating all the code, use a macro to define the function twice and use an argument to decide whether to negate the return value. Differential Revision: https://reviews.llvm.org/D61919 llvm-svn: 361207
* [X86] Add icelake-client and tremont model numbers to compiler-rt's ↵Craig Topper2019-05-201-0/+9
| | | | | | implementation of __builtin_cpu_is. llvm-svn: 361175
* [NFC][compiler-rt][builtins] Tidy and match comments for floating point ↵Leonard Chan2019-05-099-102/+94
| | | | | | | | operations Differential Revision: https://reviews.llvm.org/D61762 llvm-svn: 360389
* Avoid duplicate function aliases on MinGW after SVN r359835Martin Storsjo2019-05-032-4/+6
| | | | | | | On MinGW, the same alias mechanism as for ELF, using __attribute__((__alias__())), is used. llvm-svn: 359865
* Fix check-builtins on Windows after alias changesReid Kleckner2019-05-022-0/+16
| | | | llvm-svn: 359835
* [builtins] Use __APPLE__ instead of __MACH__ in checkPetr Hosek2019-04-291-1/+1
| | | | | | | The latter doesn't seem to be working for all targets. This addresses the issue introduced in r359413. llvm-svn: 359423
* [builtins] Fix the missing assembly on DarwinPetr Hosek2019-04-291-1/+1
| | | | | | This was introduced in r359413. llvm-svn: 359421
* [builtins] Fix the typo in the preprocessor checkPetr Hosek2019-04-291-1/+1
| | | | | | This was introduced in r359413. llvm-svn: 359419
* [builtins] Use aliases for function redirectsPetr Hosek2019-04-2941-95/+85
| | | | | | | | | | | | | Symbol aliases are supported by all platforms that compiler-rt builtins target, and we can use these instead of function redirects to avoid the extra indirection. This is part of the cleanup proposed in "[RFC] compiler-rt builtins cleanup and refactoring". Differential Revision: https://reviews.llvm.org/D60931 llvm-svn: 359413
* [builtins] Use single line C++/C99 comment stylePetr Hosek2019-04-28240-3869/+3489
| | | | | | | | | | | Use the uniform single line C++/99 style for code comments. This is part of the cleanup proposed in "[RFC] compiler-rt builtins cleanup and refactoring". Differential Revision: https://reviews.llvm.org/D60352 llvm-svn: 359411
* [builtins] Reformat builtins with clang-formatPetr Hosek2019-04-28193-5873/+5341
| | | | | | | | | | | Update formatting to use the LLVM style. This is part of the cleanup proposed in "[RFC] compiler-rt builtins cleanup and refactoring". Differential Revision: https://reviews.llvm.org/D60351 llvm-svn: 359410
* [builtins] Build x86_64 with GENERIC_TF_SOURCESYi Kong2019-04-181-0/+1
| | | | llvm-svn: 358706
* [builtins] Add __cmpsf2 for ARM version of comparesf2Yi Kong2019-04-171-0/+5
| | | | | | | | | The generic version of comparesf2 defines __cmpsf2 alias for libgcc compatibility, but the ARM overlay is missing the alias. Differential Revision: https://reviews.llvm.org/D60805 llvm-svn: 358542
* [gn] Support for building compiler-rt builtinsPetr Hosek2019-04-051-81/+111
| | | | | | | | | | | | | | | | This is support for building compiler-rt builtins, The library build should be complete for a subset of supported platforms, but not all CMake options have been replicated in GN. We always use the just built compiler to build all the runtimes, which is equivalent to the CMake runtimes build. This simplifies the build configuration because we don't need to support arbitrary host compiler and can always assume the latest Clang. With GN's toolchain support, this is significantly more efficient than the CMake runtimes build. Differential Revision: https://reviews.llvm.org/D60331 llvm-svn: 357821
* Remove unneeded ymath.h include from int_math.hReid Kleckner2019-04-041-1/+0
| | | | | | | | | | | | This avoids a conflict between stdbool.h, which defines bool to _Bool in xkeycheck.h. From what I can tell, ymath.h is an internal header, and the intention is that users should include math.h directly instead. It doesn't appear to provide declarations of anything required for our builtins. This include was added back in r249513 from 2015, and it's possible that ymath.h provided something this code needed at the time, but today it does not. llvm-svn: 357728
* Revert "[builtins] Rounding mode support for addxf3/subxf3"Yi Kong2019-03-2712-198/+15
| | | | | | | | This reverts commit 2cabea054e40ae2837da959d0ca89ae25cf1b1f1. Test failure on buildbots. llvm-svn: 357048
* [builtins] Rounding mode support for addxf3/subxf3Yi Kong2019-03-2612-15/+198
| | | | | | | | | | | | | | | | | Implement rounding mode support for addxf3/subxf3. On architectures that implemented the support, this will access the corresponding floating point environment register to apply the correct rounding. For other architectures, it will keep the current behaviour and use IEEE-754 default rounding mode (to nearest, ties to even). ARM32/AArch64 support implemented in this change. i386 and AMD64 will be added in a follow up change. Differential Revision: https://reviews.llvm.org/D57143 llvm-svn: 357035
* Fix typos in compiler-rt/lib/builtins/atomic.cHubert Tong2019-03-231-1/+10
| | | | | | | | | | | | | | | | | | | Summary: This patch fixes typos in file compiler-rt/lib/builtins/atomic.c. Reviewers: jasonliu, hubert.reinterpretcast, jfb Reviewed By: jfb Subscribers: t.p.northover, theraven, dberris, jfb, jdoerfert, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59228 Patch by Xing Xue. llvm-svn: 356844
* Make __cpu_model a hidden symbol, to match libgcc.Sterling Augustine2019-03-201-0/+10
| | | | | | | | | | | | | | | Also hide __cpu_inicator_init and __cpu_features2 for similar reasons. Summary: Make __cpu_model a hidden symbol, to match libgcc. Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59561 llvm-svn: 356581
OpenPOWER on IntegriCloud