Commit Graph

318 Commits

Author SHA1 Message Date
Craig Topper 705b969f80 [X86] Add Knights Mill CPU to cpu_indicator support to match libgcc.
llvm-svn: 315505
2017-10-11 20:35:43 +00:00
Eli Friedman 0d586d06a7 [compiler-rt] Add back ARM EABI aliases where legal.
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.

llvm-svn: 314851
2017-10-03 21:25:07 +00:00
Manoj Gupta e2ff2ba57d [builtins] ARM: Reland fix for assembling builtins in thumb state.
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

llvm-svn: 314718
2017-10-02 20:56:49 +00:00
Manoj Gupta bfa662ae4e [builtins] ARM: Revert r314284, r314285 and r314289
Revert r314284, r314285 and r314289 because of a reported
breakage in armv7k watchos builder.

llvm-svn: 314333
2017-09-27 19:06:47 +00:00
Manoj Gupta a2eacb3bfc [ARM] builtins: Replace abort by assert in clear_cache.
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

llvm-svn: 314322
2017-09-27 17:36:25 +00:00
Manoj Gupta 92c21d54a4 [builtins] fix build error on non-ARM for r314285.
llvm-svn: 314289
2017-09-27 09:49:32 +00:00
Manoj Gupta 6992817a0e [Builtins] ARM: Fix assembling files in thumb mode.
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

llvm-svn: 314285
2017-09-27 09:33:14 +00:00
Manoj Gupta 9c277321e3 [Builtins] ARM: Fix msr assembly instruction use for Thumb2.
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

llvm-svn: 314284
2017-09-27 09:29:57 +00:00
Manoj Gupta 347ff633f7 [Builtins] Use 4 byte alignment for __aeabi_memclr.
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

llvm-svn: 314255
2017-09-26 22:37:08 +00:00
Francis Ricci e3b018f6e5 [builtins] Prevent duplicate definitions for overridden functions
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

llvm-svn: 312140
2017-08-30 17:12:57 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
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

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
Michal Gorny 7298595a2c Revert r311842 - [cmake] Remove i686 target that is duplicate to i386
The required change in clang is being reverted because of the Android
build bot failure.

llvm-svn: 311859
2017-08-27 20:37:06 +00:00
Michal Gorny 34ca7168ae [cmake] Remove i686 target that is duplicate to i386
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

llvm-svn: 311842
2017-08-27 07:44:41 +00:00
Oleg Ranevskyy 6c75b51bb5 [ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to 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
2017-08-23 14:26:31 +00:00
Saleem Abdulrasool 84315ec513 Revert "builtins: erase `struct` modifier for EH personality"
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
2017-08-22 04:19:51 +00:00
Saleem Abdulrasool 94fd3c41fb builtins: erase `struct` modifier for EH personality
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
2017-08-22 04:05:50 +00:00
Weiming Zhao 1c617be054 [builtins] fix build error on non-ARM for r310884
llvm-svn: 310890
2017-08-14 21:44:33 +00:00
Weiming Zhao 8bf15723ae [builtins][ARM] Select correct code fragments when compiling for 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
2017-08-14 20:48:47 +00:00
Oleg Ranevskyy a02114b651 [compiler-rt][ARM] Fix filtering of ARM targets
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
2017-08-10 13:27:29 +00:00
Martin Storsjo becd2ef602 [builtins] Use Interlocked* intrinsics for atomics on MSVC
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
2017-08-03 19:04:28 +00:00
Sterling Augustine f67036b62c This ppc64 implementation of clear_cache works for both big and little endian.
llvm-svn: 309848
2017-08-02 18:13:59 +00:00
Sterling Augustine f6b2e770ea Revert rL309634 until upstream buildbots have upgraded libc.
llvm-svn: 309704
2017-08-01 17:16:05 +00:00
Sterling Augustine 81fd449238 Add powerpc64 to compiler-rt build infrastructure.
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
2017-07-31 22:23:17 +00:00
Martin Storsjo adf4489009 [builtins] Fix mingw-w64 cross compilation
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
2017-07-31 06:01:39 +00:00
Sterling Augustine dd9173420f Add clear_cache implementation for ppc64. Fix buffer to meet ppc64 alignment.
llvm-svn: 309423
2017-07-28 19:49:22 +00:00
Stephen Hines aba18768f4 [mips] Switch asm to __asm__ for non-GNU compiles.
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
2017-07-24 20:25:08 +00:00
Erich Keane a021743cfd Remove Bitrig: CompilerRT Changes
Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned.

Differential Revision: https://reviews.llvm.org/D35709

llvm-svn: 308798
2017-07-21 22:47:46 +00:00
Craig Topper b77279083c [X86][builtins] Sync getX86CpuIDAndInfoEx with llvm's Host.cpp again.
We now use __cpuidex intrinsics intead of inline asm on 32-bit Windows. We already used it on 64-bit.

llvm-svn: 308420
2017-07-19 05:11:20 +00:00
Craig Topper e6b07073ca [compiler-rt][X86] Match the detection of cpu's for __cpu_model to the 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
2017-07-13 02:56:24 +00:00
Petr Hosek 969518b442 [builtins] Better Fuchsia support
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
2017-07-12 19:33:30 +00:00
Craig Topper 76ac813790 [X86] Sync a few more things from llvm's Host.cpp to cpu_model.
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
2017-07-10 17:47:23 +00:00
Craig Topper 61d8450277 [X86] Resync cpu_model.c with llvm's Host.cpp in preparation for making it compatible with newer gcc.
llvm-svn: 307558
2017-07-10 17:30:20 +00:00
Dimitry Andric 8779ea7aed Add generic __bswap[ds]i2 implementations
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
2017-05-25 14:52:14 +00:00
Catherine Moore b9f969d9e0 [cmake] Disable building emutls.c for baremetal targets.
Differential Revision: https://reviews.llvm.org/D33199

llvm-svn: 303865
2017-05-25 14:45:54 +00:00
Jonathan Roelofs dc62b80c82 Allow armv{7,7s,7k,7m,7em} builds
llvm-svn: 303765
2017-05-24 15:53:24 +00:00
Saleem Abdulrasool 4a45838d10 builtins: fix guard __AEABI__ -> __ARM_EABI__
llvm-svn: 303207
2017-05-16 20:25:07 +00:00
Saleem Abdulrasool 92a239b225 builtins: one more case of a missing header
llvm-svn: 303195
2017-05-16 18:19:44 +00:00
Saleem Abdulrasool 369f74c16b builtins: add missing includes
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
2017-05-16 17:06:48 +00:00
Saleem Abdulrasool 36ac5ddff7 builtins: expand out the AEABI function stubs
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
2017-05-16 16:41:37 +00:00
Saleem Abdulrasool 44c45717b9 builtins: use reserved spelling (NFC)
llvm-svn: 303138
2017-05-16 04:17:12 +00:00
Manoj Gupta 2361a394b6 Fix executable stack directive on Linux.
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
2017-05-15 23:13:54 +00:00
Manoj Gupta cf0675bb74 [builtins] Fix a check from __GNU__ to __GNUC__ for disabling executable stack.
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
2017-05-15 20:41:17 +00:00
Saleem Abdulrasool 12588d76db builtins: fix filtering aliased targets
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
2017-05-15 19:09:13 +00:00
Catherine Moore 61efa174d7 [cmake] Disable building enable_execute_stack.c for baremetal targets.
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
2017-05-10 15:34:25 +00:00
Martell Malone c348a8c747 [builtins] Fixup emulated TLS for mingw.
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
2017-05-06 15:13:17 +00:00
Simon Dardis 19a4d97127 [compiler-rt][mips] Add support for quad precision builtins for mips64
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
2017-05-04 13:34:17 +00:00
Sterling Augustine bb34f278a2 Roll back r301831 to fix broken powerpc64le tests.
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/5941

llvm-svn: 301935
2017-05-02 16:43:39 +00:00
Sterling Augustine ba6c9cb5e8 Add powerpc64 and powerpc64le to build infrastructure.
From Phab D32031.

llvm-svn: 301831
2017-05-01 20:35:02 +00:00
Sterling Augustine 98a89e6d60 Cleanup previous test commit.
llvm-svn: 301820
2017-05-01 18:04:06 +00:00
Sterling Augustine cdcc5b61f4 Add a blank line as a test-commit.
Per http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

llvm-svn: 301818
2017-05-01 17:43:29 +00:00