Commit Graph

770 Commits

Author SHA1 Message Date
Joerg Sonnenberger cc1edb5a45 Add __ARM_DWARF_EH__ to signify the use of Itanium ABI for unwind
instructions.

llvm-svn: 208719
2014-05-13 18:58:36 +00:00
Joerg Sonnenberger 4645b44fc6 Test preprocessor defines for NetBSD/ARM.
llvm-svn: 208718
2014-05-13 18:58:00 +00:00
Saleem Abdulrasool 6323a2d63c Target: fix wchar_t definition for Windows on ARM
Windows on ARM uses AAPCS, but has some deviations.  wchar_t remains an unsigned
short on WoA, which does not conform to AAPCS.  Ensure that wchar_t is defined
accordingly.

llvm-svn: 207929
2014-05-04 01:56:04 +00:00
Benjamin Kramer 56c582279b Add support for -march=bdver4.
llvm-svn: 207848
2014-05-02 15:47:51 +00:00
Bradley Smith 9a6b29540e [ARM64/AArch64] Define the correct value for __ARM_NEON_FP
llvm-svn: 207842
2014-05-02 15:18:38 +00:00
Bradley Smith 418c5935f8 [ARM64/AArch64] Hook up CRC32 subtarget feature to the driver
llvm-svn: 207841
2014-05-02 15:17:51 +00:00
Lubos Lunak 576a0415cb do not warn about unknown pragmas in modes that do not handle them (pr9537)
And refactor to have just one place in code that sets up the empty
pragma handlers.

llvm-svn: 207758
2014-05-01 12:54:03 +00:00
Alp Toker f424a597df Fix and restore the macro-multiline.c test
This test didn't work as intended and was ultimately disabled some years ago in
r169458.

Indeed it's not clear if the '\n' was ever passed through to the driver
correctly given that lit would insert '&& {' at the newline.

Test rewritten to use printf/xargs to insert '\n' in a more reliable manner and
to use FileCheck for verification.

llvm-svn: 206703
2014-04-19 21:40:58 +00:00
James Molloy 96061a6db1 [ARM64] Add ARM64 RUN lines to a bunch of tests that had AARCH64 RUN lines.
This covers all tests in tests/Driver and tests/Preprocessor, but there are some
failing tests in test/Sema that need looking into.

llvm-svn: 206464
2014-04-17 12:51:36 +00:00
Reid Kleckner 6f6e76dfe0 Revert "Move -fms-extensions predefined macros into InitPreprocessor"
This reverts commit r206413.

This was proposed before, but it's not clear if this is really a good
idea:
http://reviews.llvm.org/D3034

llvm-svn: 206415
2014-04-16 20:10:16 +00:00
Reid Kleckner ae4759df00 Move -fms-extensions predefined macros into InitPreprocessor
If someone on Linux asks for -fms-extensions, there's no reason not to
define the feature test macros that MSVC defines.

llvm-svn: 206413
2014-04-16 19:47:06 +00:00
James Molloy 75f5f9e629 [ARM64] Allow the disabling of NEON and crypto instructions. Update tests to pass -target-feature +neon.
llvm-svn: 206394
2014-04-16 15:33:48 +00:00
James Molloy 5e73df5cf0 [ARM64] Fix up predefines, including adding big endian support to Targets.cpp
llvm-svn: 206390
2014-04-16 15:06:20 +00:00
Saleem Abdulrasool f4c9e49f94 Driver: add target definition for Windows on ARM
This introduces the definitions needed for the Windows on ARM target.  Add
target definitions for both the MSVC environment and the MSVC + Itanium C++ ABI
environment.  The Visual Studio definitions correspond to the definitions
provided by Visual Studio 2012.

llvm-svn: 205650
2014-04-04 20:31:19 +00:00
Reid Kleckner 98a1266218 Put macro redefinition warnings under -Wmacro-redefined
This is consistent with -Wbuiltin-macro-redefined, and puts this common
extension warning under a flag.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D3283

llvm-svn: 205591
2014-04-04 00:17:16 +00:00
NAKAMURA Takumi c1e8aa06aa clang/test/Preprocessor/headermap-rel2.c: Recognize dos path.
llvm-svn: 205152
2014-03-30 15:09:08 +00:00
Chandler Carruth 705cd965e3 Force a header file input to the headermap test to have different
contents than the header file by the same name under the system header
search root. Surprisingly, this is required to get the test to pass on
some systems.

So, it turns out that there exist filesystems in the world which unique
the inode of all files based on their contents. This results in two
files with the same contents at different paths suddenly having the same
inode. This doesn't actually cause any problems in practice as the
contents are the same, and the path used to access the files are the
same. However, it can cause tests like this one to be more brittle
because the file manager ends up de-duplicating the file entries by
inode. We don't have any other really easy ways to observe the behavior
shift because the whole point is that the #include written in the source
code doesn't contain the information -- instead it is contained in the
header map.

If folks have other solutions they would prefer, I'm more than happy to
work on them, but this seems a reasonable way to ensure that the test in
question exercises the code it wants to exercise.

llvm-svn: 205149
2014-03-30 14:04:32 +00:00
Argyrios Kyrtzidis 48fb488706 [test] Add a triple to the test.
llvm-svn: 205073
2014-03-29 04:05:21 +00:00
Argyrios Kyrtzidis ca1aa4626d [test] Add a RUN line to get a hint on why the test is failing at the buildbots.
llvm-svn: 205072
2014-03-29 03:37:04 +00:00
Argyrios Kyrtzidis 7bd78a910a [HeaderSearch] Make sure we clear the mapped name from the LookupFileCacheInfo when we reset the start point.
rdar://16462455

llvm-svn: 205071
2014-03-29 03:22:54 +00:00
Christian Pirker f01cd6f57b Add ARM big endian Target (armeb, thumbeb)
Reviewed at http://llvm-reviews.chandlerc.com/D3096

llvm-svn: 205008
2014-03-28 14:40:46 +00:00
Joerg Sonnenberger 1f5984ca82 From Matt Thomas: use long long for [u]int64_t and [u]intmax_t on
NetBSD/aarch64 to simplify code sharing with NetBSD/arm.

llvm-svn: 204798
2014-03-26 11:48:29 +00:00
Will Schmidt 5fa50f3c57 Update the powerpc64le check to include CALL_ELF=2 check.
This is a testcase follow-up to r204627.
(see also r204614 for CALL_ELF usage).

llvm-svn: 204669
2014-03-24 21:09:16 +00:00
Christian Pirker 227f5ed547 AArch64_BE test case for predefined macros
llvm-svn: 204604
2014-03-24 13:57:21 +00:00
Argyrios Kyrtzidis 34fad42003 [HeaderSearch] Fix issue where if a headermap entry maps the filename to a framework import (non-absolute path)
then we fail to find it if it is re-included later on.

rdar://16285490

llvm-svn: 203542
2014-03-11 06:21:28 +00:00
Robert Lytton 2c942c64fb Make __LITTLE_ENDIAN__/__BIG_ENDOAN__ common PredefinedMacros
llvm-svn: 203455
2014-03-10 12:06:29 +00:00
David Majnemer dbd6acb64b Revert "Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__"
This commit reverts r201037, it's functionality is not needed given the
definition of std::max_align_t in libcxx circa r201843.

llvm-svn: 202667
2014-03-02 23:01:10 +00:00
NAKAMURA Takumi 210fbcdd5a clang/test/Preprocessor/init.c: Split conditions to win32 and non-win32.
FIXME: Implement and check x86_64-cygwin.
llvm-svn: 202094
2014-02-25 00:30:14 +00:00
Richard Smith 5b2f7c5f60 If preprocessing results in a token with leading whitespace that was expanded
from a macro in column 0, ensure that we print whitespace before it in the -E
output. Patch by Harald van Dijk!

llvm-svn: 202070
2014-02-24 20:50:36 +00:00
Richard Smith f2baa70396 If the first token in a macro that appears at the start of a line expands to
nothing, be sure to inform the *next* token expanded from the macro that it is
now at the start of a line. Patch by Harald van Dijk!

llvm-svn: 202068
2014-02-24 20:45:00 +00:00
Richard Barton c9b5f35ec1 Implement -fno-short-wchar
llvm-svn: 202058
2014-02-24 18:43:28 +00:00
Kevin Qin ad64f6d4e5 [AArch64] Change int64_t from 'long long int' to 'long int' for AArch64 target.
Most 64-bit targets define int64_t as long int, and AArch64 should
make same definition to follow LP64 model. In GNU tool chain, int64_t
is defined as long int for 64-bit target. So to get consistent with GNU,
it's better Changing int64_t from 'long long int' to 'long int',
otherwise clang will get different name mangling suffix compared with g++.

llvm-svn: 202004
2014-02-24 02:45:03 +00:00
Richard Smith 51bacfd9c7 Update __cplusplus to match the value in the C++14 DIS preview (D3937).
llvm-svn: 202003
2014-02-24 01:35:45 +00:00
Reid Kleckner 0e73ec4550 Expand macros in pragmas with -fms-extensions and -E
gcc never expands macros in pragmas and MSVC always expands macros
before processing pragmas.  Clang usually allows macro expansion, except
in a handful of pragmas, most of which are handled by the lexer.

Also remove PPCallbacks for pragmas that are currently handled in the
parser.  Without a Parser, such as with clang -E, these callbacks would
never be called.

Fixes PR18576.

llvm-svn: 201821
2014-02-20 22:59:51 +00:00
Reid Kleckner 064eaba99c Add missing test file for r201615
llvm-svn: 201617
2014-02-18 23:57:59 +00:00
Reid Kleckner a97d4c0679 Fix false positives in -Wmsvc-include by continuing header search
This makes Clang and LLVM -Wmsvc-include clean.

I believe the correct behavior here is to avoid updating the cache when
we find the header via MSVC's search rules.

Differential Revision: http://llvm-reviews.chandlerc.com/D2733

llvm-svn: 201615
2014-02-18 23:49:24 +00:00
Nico Rieck e6a1582595 Fix broken CHECK lines
llvm-svn: 201477
2014-02-16 07:29:41 +00:00
Nico Rieck 140db2767b Fix broken RUN lines
llvm-svn: 201475
2014-02-16 07:28:32 +00:00
David Blaikie 228f28ca4f Move test inputs into the Inputs directory (improvement/fix to r201419)
llvm-svn: 201458
2014-02-15 05:09:38 +00:00
Argyrios Kyrtzidis 75fa9eddae If the headermap maps the filename to a framework include ("Foo.h" -> "Foo/Foo.h"),
continue header lookup using the framework include as filename.

This allows us to conveniently treat
  #import "Foo.h"
as an implicit module import if we can resolve "Foo/Foo.h" as such.

rdar://16042979

llvm-svn: 201419
2014-02-14 14:58:28 +00:00
Jiangning Liu b19c5b652e Enable AArch64 NEON by default.
llvm-svn: 201384
2014-02-14 04:37:46 +00:00
David Majnemer 158ba130ee Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__
TargetInfo::getSuitableAlign() was introduced in r146762 and is defined
as alignof(std::max_align_t).

Introduce __ALIGNOF_MAX_ALIGN_T__ which exposes getSuitableAlign() so
that libc++ may take advantage of it.

llvm-svn: 201037
2014-02-09 05:30:48 +00:00
Joey Gouly 18730ba4ab Fix the range for Malayam UCNs in C99.
llvm-svn: 200845
2014-02-05 15:32:23 +00:00
Justin Bogner 79c93845f6 Fix whitespace handling in empty macro expansions
When a macro expansion does not result in any tokens, and the macro name
is preceded by whitespace, the whitespace should be passed to the first
token that follows the macro expansion. Similarly when a macro expansion
ends with a placemarker token, and that placemarker token is preceded by
whitespace. This worked already for top-level macro expansions, but is
now extended to also work for nested macro expansions.

Patch by Harald van Dijk!

llvm-svn: 200787
2014-02-04 19:18:35 +00:00
Justin Bogner eacd96d972 Fix whitespace handling in empty macro arguments
When a function-like macro definition ends with one of the macro's
parameters, and the argument is empty, any whitespace before the
parameter name in the macro definition needs to be preserved. Promoting
the existing NextTokGetsSpace to a preserved bit-field and checking it
at the end of the macro expansion allows it to be moved to the first
token following the macro expansion result.

Patch by Harald van Dijk!

llvm-svn: 200786
2014-02-04 19:18:32 +00:00
Justin Bogner 502155aff9 Fix whitespace handling in ## operator
In x ## y, where x and y are regular tokens, whitespace between x and ##
is ignored, and whitespace between ## and y is also ignored. When either
x or y is a function argument, whitespace was preserved, but it should
not be. This patch removes the checks for whitespace before ## and
before y, and in the special case where x is an empty macro argument and
y is a regular token, actively removes whitespace before y.

One existing test is affected by that change, but as clang's output now
matches the standard's requirements and that of GCC, I've tweaked the
testcase.

Patch by Harald van Dijk!

llvm-svn: 200785
2014-02-04 19:18:28 +00:00
Joerg Sonnenberger ec39cc6165 Test pre-defined macros of aarch64-netbsd.
llvm-svn: 200656
2014-02-02 21:55:32 +00:00
Ben Langmuir 5eb7cb74a7 Revert "Fix assertion failures on annot_* tokens in clang -E"
This is causing a failure in the msan buildbot that I am having trouble
reproducing.  Reverting until I can figure out what went wrong.

llvm-svn: 200492
2014-01-30 21:50:18 +00:00
Ben Langmuir 5944ecd64c Fix assertion failures on annot_* tokens in clang -E
In particular, #pragma clang __debug, and #include implicitly changed
into @import were causing assertion failures.

llvm-svn: 200475
2014-01-30 18:09:55 +00:00
Simon Atanasyan 26292ccc91 [Mips] Fix __mips macro definition.
llvm-svn: 200223
2014-01-27 13:59:11 +00:00
Simon Atanasyan 1a3665b676 [Mips] Change default CPU for MIPS 32/64 targets. Now they are mips32r2/mips64r2 respectively.
llvm-svn: 200222
2014-01-27 13:59:04 +00:00
Simon Atanasyan 682b49b9ef [Mips] Add tests to check MIPS arch macros.
llvm-svn: 200221
2014-01-27 13:58:54 +00:00
Weiming Zhao fb5c21a70b PR18465: [Thumbv8] add predefined macros
currently, for thumbv8, two predefined macros are missing:
 define __THUMB_INTERWORK__ 1
 define __THUMB_INTERWORK__ 1

This patch adds them for thumbv8.

llvm-svn: 199819
2014-01-22 18:42:13 +00:00
Bradley Smith 0f28f0cfc1 [ARM] Add ACLE enum/wchar size predefines
llvm-svn: 199642
2014-01-20 10:52:00 +00:00
Tim Northover 157d911b42 MachO: use *-*-*-macho for MachO embedded targets.
Previously we had bodged together some hacks mapping MachO embedded
targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple.
This is incorrect in both details (they don't run Darwin and they're
not EABI in any real sense).

This commit appropriates the existing "MachO" environment for the
purpose instead.

llvm-svn: 199367
2014-01-16 08:48:16 +00:00
Chandler Carruth b653131345 Move a bunch of tests to directly use the CC1 layer. This at least saves
a subprocess invocation which is pretty significant on Windows. It also
likely saves a bunch of thrashing the host machine needlessly. Finally
it makes the tests much more predictable and less dependent on the host.
For example 'header_lookup1.c' was passing '-fno-ms-extensions' just to
thwart the host detection adding it into the compilation. By runnig CC1
directly we don't have to deal with such oddities.

llvm-svn: 199308
2014-01-15 09:08:07 +00:00
Aaron Ballman 0fa06d879a __has_attribute now understands target-specific attributes. So when you ask whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others.
llvm-svn: 198897
2014-01-09 22:57:44 +00:00
Reid Kleckner 52b10afb08 Move MS header search test inputs to Inputs/
llvm-svn: 198086
2013-12-27 20:41:49 +00:00
Will Wilson 0fafd34a6e Implement MSVC header search algorithm in MicrosoftMode.
Follows algorithm described here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx

llvm-svn: 198082
2013-12-27 19:46:16 +00:00
Ana Pazos dd6068d400 Added support for mcpu krait
- krait processor currently modeled with the same features as A9.
- Krait processor additionally has VFP4 (fused multiply add/sub)
and hardware division features enabled.
- krait has currently the same Schedule model as A9
- krait cpu flag is not recognized by the GNU assembler yet,
it is replaced with march=armv7-a to avoid a lower march
from being used.

llvm-svn: 196618
2013-12-06 22:43:17 +00:00
Amara Emerson a1daec7235 [ARM] Enable FeatureMP for Cortex-A5 by default.
Patch by Oliver Stannard.

llvm-svn: 195641
2013-11-25 13:18:59 +00:00
Richard Barton 3b82ed3948 Add support for Cortex-A12.
Patch by Oliver Stannard!

llvm-svn: 195449
2013-11-22 11:53:28 +00:00
Artyom Skrobov 53b000a86c [ARM] add basic support for Cortex-A7 and VFPv4 to Clang
llvm-svn: 195359
2013-11-21 14:04:38 +00:00
Jiangning Liu c8b0a1ad95 Clean up predefined macros for AArch64 to follow ACLE 2.0.
llvm-svn: 195068
2013-11-19 01:33:17 +00:00
Simon Atanasyan 55df3bb5e0 [Mips] Add tests for MIPS/MIPS64 type defines and type limits macros. No
functional changes - just reflection of the current state.

llvm-svn: 194690
2013-11-14 11:15:10 +00:00
Robert Lytton cc4246614f XCore target Type defines.
Change SizeType, PtrDiffType, IntPtrType, WCharType, WIntType
to follow the XMOS llvm-gcc front end's settings.

llvm-svn: 194461
2013-11-12 10:09:30 +00:00
Tim Northover e77f78cbad Darwin(ish): we don't want __ARM_EABI__ even on v7a embedded targets.
llvm-svn: 194408
2013-11-11 19:11:22 +00:00
Joerg Sonnenberger 0e921f2bd9 NetBSD 6.99.26 switched to default rounding mode, so adjust
__FLT_EVAL_METHOD__ accordingly. Add test case for this and the SSE2
variances on NetBSD.

llvm-svn: 194377
2013-11-11 14:00:37 +00:00
Alp Toker f80de76ca9 Make test run reliably
llc waits for input on stdin, which was not provided in this test. It
was running only thanks to a quirk in the way lit concatenates
commands.

llvm-svn: 194071
2013-11-05 12:45:43 +00:00
David Majnemer 21db51ab91 Simplify test case added in r194059
llvm-svn: 194061
2013-11-05 10:05:58 +00:00
David Majnemer 76faf1f525 Lex: Require that '#' be followed by a macro parameter name when preceded by '##'
After lexing a '##', we would look ahead and check to see if it was
followed by '__VA_ARGS__'.  After doing so, we would then go ahead and
lex the token.

However we would fail in the case where the '##' was followed by a '#'
followed by an identifier because we would have lexed the '#' separately
from the identifier, bypassing our parameter validation logic.

Instead, lex the tokens coming after the '##' later.

This fixes PR17804.

llvm-svn: 194059
2013-11-05 09:30:17 +00:00
Benjamin Kramer d9a5e2a490 Driver: Add support for -march=bdver3 on x86.
llvm-svn: 193985
2013-11-04 10:29:51 +00:00
Bernard Ogden 18b5701a68 ARM: Add -m[no-]crc to dis/enable CRC subtargetfeature from clang
Allow users to disable or enable CRC subtarget feature.

Differential Revision: http://llvm-reviews.chandlerc.com/D2037

llvm-svn: 193600
2013-10-29 09:47:51 +00:00
Bernard Ogden da13af380a Add driver support for FP, SIMD and crypto defaults.
Although we wire up a bit for v8fp for macro setting
purposes, we don't set a macro yet. Need to ask list
about that.

Change-Id: Ic9819593ce00882fbec72757ffccc6f0b18160a0
llvm-svn: 193367
2013-10-24 18:32:51 +00:00
Silviu Baranga e5690463e2 Set the default hardware division features for ARM cpus. Also set it as default for A32 armv8.
llvm-svn: 193075
2013-10-21 10:59:33 +00:00
Silviu Baranga f9671dd09d Add the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide in the mode that we are compiling in (depending on the target features), not defined if we don't. Should be compatible with the GCC conterpart. Also adding a -hwdiv option to overide the default behavior.
llvm-svn: 193074
2013-10-21 10:54:53 +00:00
Justin Bogner 5353513058 Lex: Don't restrict legal UCNs when preprocessing assembly
The C and C++ standards disallow using universal character names to
refer to some characters, such as basic ascii and control characters,
so we reject these sequences in the lexer. However, when the
preprocessor isn't being used on C or C++, it doesn't make sense to
apply these restrictions.

Notably, accepting these characters avoids issues with unicode escapes
when GHC uses the compiler as a preprocessor on haskell sources.

Fixes rdar://problem/14742289

llvm-svn: 193067
2013-10-21 05:02:28 +00:00
Simon Atanasyan 2c97a81e81 [Mips] Define __mips_fpr and _MIPS_FPSET macros.
llvm-svn: 192969
2013-10-18 13:13:53 +00:00
Eric Christopher 2fe3b4a490 Add preprocessor support for powerpc vsx.
The test should be expanded upon for more powerpc checking.

llvm-svn: 192849
2013-10-16 21:19:26 +00:00
Eric Christopher c26a5b4f9d Remove an old, seemingly out of date, comment.
The referenced script no longer seems to exist.

llvm-svn: 192848
2013-10-16 21:19:23 +00:00
Yunzhong Gao 6108936fa6 Enabling 3DNow! prefetch instruction support for a few AMD processors in the
clang front end. This change will allow the __PRFCHW__ macro to be set on these
processors and hence include prfchwintrin.h in x86intrin.h header. Support for
the intrinsic itself seems to have already been added in r178041.

Differential Revision: http://llvm-reviews.chandlerc.com/D1934

llvm-svn: 192829
2013-10-16 19:07:02 +00:00
Nick Lewycky 50e8f480ea Add support for -mcx16, and predefine __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 when
it is enabled. Also enable it on the same architectures that GCC does.

llvm-svn: 192045
2013-10-05 20:14:27 +00:00
Reid Kleckner 4d185105e9 Accept #pragma warning(push, 0) without warning
This partially addresses PR17435, but it doesn't actually implement the
pragma.  If we implement it, we should map levels 1-4 to something like
-Wall and level 0 to something like -w.

llvm-svn: 191833
2013-10-02 15:19:23 +00:00
Weiming Zhao 53a797ce7b Fix PR 12730: Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros for ARM
llvm-svn: 191707
2013-09-30 22:51:32 +00:00
Ed Schouten d062146896 Add character set related __STDC_* definitions.
Clang uses UTF-16 and UTF-32 for its char16_t's and char32_t's
exclusively. This means that we can define __STDC_UTF_16__ and
__STDC_UTF_32__ unconditionally.

While there, define __STDC_MB_MIGHT_NEQ_WC__ for FreeBSD. FreeBSD's
wchar_t's don't encode characters as ISO-10646; the encoding depends on
the locale used. Because the character set used might not be a superset
of ASCII, we must define __STDC_MB_MIGHT_NEQ_WC__.

llvm-svn: 191631
2013-09-29 07:54:52 +00:00
Reid Kleckner 95e036c669 PR17359: Fix off-by-one OOB on _Pragma("") and an unescaping bug
Previously the code would reduce a run of backslashes to a single
backslash, and now it will properly leave behind every other backslash.

llvm-svn: 191382
2013-09-25 16:42:48 +00:00
Yunzhong Gao 1f6aeebe76 Adding -mtbm and -mno-tbm command line options to the clang front end for the
x86 TBM instruction set. Also adding a __TBM__ macro if the TBM feature is
enabled. Otherwise there should be no functionality change to existing features.

Phabricator code review is located here: http://llvm-reviews.chandlerc.com/D1693

llvm-svn: 191326
2013-09-24 19:00:58 +00:00
Simon Atanasyan 22127cee34 [Mips] Support -mnan=2008 option. Define "__mips_nan2008" macros and pass
this option to the assembler.

llvm-svn: 191282
2013-09-24 09:09:16 +00:00
Ben Langmuir 58078d0103 Add C intrinsics for Intel SHA Extensions
Intrinsics added shaintrin.h, which is included from x86intrin.h if __SHA__ is
enabled. SHA implies SSE2, which is needed for the __m128i type.

Also add the -msha/-mno-sha option.

llvm-svn: 190999
2013-09-19 13:22:04 +00:00
Eli Friedman 0834a4b901 Make Preprocessor::Lex non-recursive.
Before this patch, Lex() would recurse whenever the current lexer changed (e.g.
upon entry into a macro). This patch turns the recursion into a loop: the
various lex routines now don't return a token when the current lexer changes,
and at the top level Preprocessor::Lex() now loops until it finds a token.
Normally, the recursion wouldn't end up being very deep, but the recursion depth
can explode in edge cases like a bunch of consecutive macros which expand to
nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this
patch).

<rdar://problem/14569770>

llvm-svn: 190980
2013-09-19 00:41:32 +00:00
Craig Topper 5f79e2661d Disabling sse2 should disable aes and pclmul support.
llvm-svn: 190977
2013-09-19 00:01:05 +00:00
Joey Gouly 1e8637b259 [ARMv8] Add builtins for CRC instructions.
Patch by Bradley Smith!

llvm-svn: 190931
2013-09-18 10:07:09 +00:00
Hal Finkel c4d7c82c7f Add the intrinsic __builtin_convertvector
LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.

C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.

llvm-svn: 190915
2013-09-18 03:29:45 +00:00
Craig Topper 31db3a2efc Make F16C feature imply AVX. Matches GCC behavior.
llvm-svn: 190776
2013-09-16 04:54:13 +00:00
Reid Kleckner 881dff3683 Lex and ignore Microsoft's #pragma warning(...)
Summary:
This fixes PR17145 and avoids unknown pragma warnings.

This change does not attempt to map MSVC warning numbers to clang
warning flags.  Perhaps in the future we will implement a mapping for
some common subset of Microsoft warnings, but for now we don't.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1652

llvm-svn: 190726
2013-09-13 22:00:30 +00:00
Craig Topper c0070a4320 Fix a bug where -msse followed by -mno-sse would leave MMX enabled.
llvm-svn: 190496
2013-09-11 06:48:53 +00:00
Craig Topper 7481d8aa17 Separate popcnt and sse4.2 feature control somewhat to match gcc behavior.
Enabling sse4.2 will implicitly enable popcnt unless popcnt is explicitly disabled.
Disabling sse4.2 will not disable popcnt if popcnt is explicitly enabled.

llvm-svn: 190387
2013-09-10 06:55:47 +00:00
Sylvestre Ledru 4e06e6e8c3 Follow up on commit r190159. Also test the KFreeBSD i686 platform defines + minor cosmetics
llvm-svn: 190162
2013-09-06 15:36:36 +00:00
Sylvestre Ledru fd7cd35592 Add a test for the KFreeBSD define (#define __FreeBSD_kernel__ 1). This was introduced in commit r190048
llvm-svn: 190159
2013-09-06 14:53:07 +00:00
Rafael Espindola ff7cea8c1a Don't pass -O0 to clang_cc1, it is the default.
llvm-svn: 189910
2013-09-04 04:12:25 +00:00
Benjamin Kramer ffecc84583 Add support for -march=slm, aka Intel Atom Silvermont.
llvm-svn: 189670
2013-08-30 14:05:34 +00:00
Eli Friedman 80e45b8cd4 Properly escape filenames in line directives.
Fixes PR17018.  Only partial test coverage because I don't want
to try to write a test which generates a file whose name contains a newline.

llvm-svn: 189557
2013-08-29 01:42:42 +00:00
Eli Friedman cefc7eafc6 Fix "//" comments with -traditional-cpp in C++.
Apparently, gcc's -traditional-cpp behaves slightly differently in C++ mode;
specifically, it discards "//" comments.  Match gcc's behavior.

<rdar://problem/14808126>

llvm-svn: 189515
2013-08-28 20:53:32 +00:00
Eli Friedman 2afb63c001 Handle -D arguments ending in a backslash.
We translate these into #define directives; to preserve gcc-compatible
semantics (where the expanded macro includes the backslash), we add
an extra "\\\n" to the end of the synthesized "#define".

<rdar://problem/14810220>

llvm-svn: 189511
2013-08-28 20:35:38 +00:00
Craig Topper 258a86802a Add test cases for avx512 feature flags. Fix typo in avx512pf options.
llvm-svn: 188984
2013-08-22 04:32:55 +00:00
Eli Friedman 5ba37d5282 Split isFromMainFile into two functions.
Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't.  Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).

llvm-svn: 188968
2013-08-22 00:27:10 +00:00
Rafael Espindola 0221d8636e Don't disable SSE4A when disabling AVX.
Thanks for Craig Topper for noticing it.

llvm-svn: 188902
2013-08-21 13:28:02 +00:00
Craig Topper 679b53ac67 Add avx512cd, avx512er, avx512pf feature flags and enable them on KNL CPU.
llvm-svn: 188867
2013-08-21 05:29:10 +00:00
Rafael Espindola db0fcfbfae Centralize the logic for handling -m* options and fix pr16943.
This moves the logic for handling -mfoo -mno-foo from the driver to -cc1. It
also changes -cc1 to apply the options in order, fixing pr16943.

The handling of -mno-mmx -msse is now an explicit special case.

llvm-svn: 188817
2013-08-20 18:57:55 +00:00
Craig Topper af0ca63cec Rename __AVX512__ to __AVX512F__
llvm-svn: 188764
2013-08-20 07:52:37 +00:00
Craig Topper 449314e1ec Add AVX-512 feature flag and knl cpu to clang.
llvm-svn: 188758
2013-08-20 07:09:39 +00:00
Craig Topper 33b4cde2f2 Revert r188756 because some other changes snuck in with it.
llvm-svn: 188757
2013-08-20 07:07:29 +00:00
Craig Topper ffb7180e96 Add AVX-512 feature flag and knl cpu to clang.
llvm-svn: 188756
2013-08-20 07:05:05 +00:00
Robert Lytton 0e07649ae5 Add XCore target
llvm-svn: 188258
2013-08-13 09:43:10 +00:00
Jack Carter 44ff1e5673 [Mips] MSA frontend option support
This patch adds -mmsa and -mno-msa to the options supported by 
clang to enable and disable support for MSA.

When MSA is enabled, a predefined macro '__mips_msa' is defined to 1.

Patch by Daniel Sanders

llvm-svn: 188184
2013-08-12 17:20:29 +00:00
Tim Northover 2fe823a6c3 AArch64: initial NEON support
Patch by Ana Pazos

- Completed implementation of instruction formats:
AdvSIMD three same
AdvSIMD modified immediate
AdvSIMD scalar pairwise

- Completed implementation of instruction classes
(some of the instructions in these classes
belong to yet unfinished instruction formats):
Vector Arithmetic
Vector Immediate
Vector Pairwise Arithmetic

- Initial implementation of instruction formats:
AdvSIMD scalar two-reg misc
AdvSIMD scalar three same

- Intial implementation of instruction class:
Scalar Arithmetic

- Initial clang changes to support arm v8 intrinsics.
Note: no clang changes for scalar intrinsics function name mangling yet.

- Comprehensive test cases for added instructions
To verify auto codegen, encoding, decoding, diagnosis, intrinsics.

llvm-svn: 187568
2013-08-01 09:23:19 +00:00
Bill Schmidt 778d387684 [PowerPC] Support powerpc64le as a syntax-checking target.
This patch provides basic support for powerpc64le as an LLVM target.
However, use of this target will not actually generate little-endian
code.  Instead, use of the target will cause the correct little-endian
built-in defines to be generated, so that code that tests for
__LITTLE_ENDIAN__, for example, will be correctly parsed for
syntax-only testing.  Code generation will otherwise be the same as
powerpc64 (big-endian), for now.

The patch leaves open the possibility of creating a little-endian
PowerPC64 back end, but there is no immediate intent to create such a
thing.

The new test case variant ensures that correct built-in defines for
little-endian code are generated.

llvm-svn: 187180
2013-07-26 01:36:11 +00:00
Rafael Espindola 644eb0a8da Add not to a command that is expected to fail.
llvm-svn: 187065
2013-07-24 18:45:44 +00:00
Richard Trieu 7aa7218545 Changed "an macro" to "a macro" in diagnostic note.
llvm-svn: 186988
2013-07-23 21:06:45 +00:00
Richard Trieu 79b45389c3 Add new diagnostic messages when too many arguments are presented to a
function-like macro.  Clang will attempt to correct the arguments by detecting
braced initializer lists:

1) If possible, suggest parentheses around arguments
containing braced lists which will give the proper number of arguments.
2) If a braced list is detected at the start of a macro argument, it cannot be
corrected by parentheses.  Instead, just point out the location of these
braced lists.

llvm-svn: 186971
2013-07-23 18:01:49 +00:00
Richard Smith 701a3523ba Don't give # and ## special treatment when in -traditional-cpp mode. Patch by
Austin Seipp!

llvm-svn: 185896
2013-07-09 01:00:29 +00:00
Richard Smith baf2912b40 Generalize hack allowing 'const' in __has_attribute (etc) to allow any token
with identifier info. This covers most identifier-like entities (other than
the ISO646 keywords).

llvm-svn: 185895
2013-07-09 00:57:56 +00:00
Rafael Espindola 925213b0fa Add 'not' to commands that are expected to fail.
This is at least good documentation, but also opens the possibility of
using pipefail.

llvm-svn: 185652
2013-07-04 16:16:58 +00:00
Rafael Espindola 80a99478bd Convert test to FileCheck.
llvm-svn: 185645
2013-07-04 15:08:20 +00:00
Roman Divacky 13b586f298 Dont define __LONG_DOUBLE_128__ unless LongDoubleWidth is really 128bits width.
It's not the case on ie. FreeBSD.

llvm-svn: 185572
2013-07-03 19:45:54 +00:00
Anton Korobeynikov ef4129084a Fix MSP430 builtin types.
Patch by Job Noorman!

llvm-svn: 185362
2013-07-01 19:42:40 +00:00
Reid Kleckner 596b85cc23 Match MSVC's handling of commas during macro argument expansion
This allows clang to parse the type_traits header in Visual Studio 2012,
which is included widely in practice.

This is a rework of r163022 by João Matos.  The original patch broke
preprocessing of gtest headers, which this patch addresses.

Patch by Will Wilson!

llvm-svn: 184968
2013-06-26 17:16:08 +00:00
Chandler Carruth 6aa92ad762 Fix a couple of PPC predefined macros that I spotted while driving by
this code. These aren't technically standard predefines for the platform
but apparantly lots of folks use them as they show up within LLVM's own
codebase. ;] This may even fix some self host issues w/ the JIT!!!

llvm-svn: 184830
2013-06-25 11:13:47 +00:00
Rafael Espindola 49ddb8675b Accept both / and \\ to fix the windows bots.
llvm-svn: 184790
2013-06-24 22:07:15 +00:00
Eli Friedman cdf8b88285 Make sure the assembler-with-cpp hack for "#" works with multiple "#"s in
succession. Fixes PR16363.

llvm-svn: 184240
2013-06-18 21:33:38 +00:00
Aaron Ballman 5d041beb4e Adding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMISMATCH linker command into the object file.
llvm-svn: 183178
2013-06-04 02:07:14 +00:00
Argyrios Kyrtzidis 977026c5f5 [Preprocessor] Prevent expansion of y in x ## y when x is empty
When x is empty, x ## is suppressed, and when y gets expanded, the fact that it follows ## is not
available in the macro expansion result. The macro definition can be checked instead, the ## will
be available there regardless of what x expands to.

Fixes http://llvm.org/PR12767

Patch by Harald van Dijk!

llvm-svn: 182699
2013-05-25 01:35:18 +00:00
Jakob Stoklund Olesen 826df14d72 OpenBSD/sparc64 uses long long for int64_t and intmax_t.
Other operating systems, including FreeBSD and NetBSD, use long.

llvm-svn: 182215
2013-05-19 17:53:37 +00:00
David Fang 072d47b67f fix PR 15726: ptrdiff_t should be int on PowerPC Darwin
llvm-svn: 182029
2013-05-16 17:51:48 +00:00
Jakob Stoklund Olesen 248520bdea Use correct types for SPARC v9.
It's an LP64 platform.

llvm-svn: 181867
2013-05-15 03:22:33 +00:00
Richard Smith 0a715429b9 C++1y: Update __cplusplus to temporary value 201305L to allow detection of provisional C++1y support.
Add __has_feature and __has_extension checks for C++1y features (based on the provisional names from
the C++ features study group), and update documentation to match.

llvm-svn: 181342
2013-05-07 19:32:56 +00:00
Ulrich Weigand 47445073f8 Add SystemZ support
This patch then adds all the usual platform-specific pieces for SystemZ:
driver support, basic target info, register names and constraints,
ABI info and vararg support.  It also adds new tests to verify pre-defined
macros and inline asm, and updates a test for the minimum alignment change.

This version of the patch incorporates feedback from reviews by
Eric Christopher and John McCall.  Thanks to all reviewers!

Patch by Richard Sandiford.

llvm-svn: 181211
2013-05-06 16:26:41 +00:00
Benjamin Kramer 914d7e06b6 Add support for -march=btver2.
llvm-svn: 181006
2013-05-03 10:47:15 +00:00
Hans Wennborg 4c02be3b83 Make sure we define wchar_t related macros correctly in -fms-extensions mode.
This adds a test to make sure we define _WCHAR_T_DEFINED and
_NATIVE_WCHAR_T_DEFINED correctly in the preprocessor, and updates
stddef.h to set it when typedeffing wchar_t.

llvm-svn: 180918
2013-05-02 13:12:32 +00:00
Argyrios Kyrtzidis f97290bb53 [test] add missing header for the test.
llvm-svn: 180719
2013-04-29 17:31:48 +00:00
Argyrios Kyrtzidis c3b4b79beb When emitting a preprocessed file with implicit module imports, make sure line directives are emitted in the next line.
rdar://13722737

llvm-svn: 180718
2013-04-29 17:26:22 +00:00
Jordan Rose 111c4a6b69 Fix off-by-one error in #pragma clang system_header.
The system_header pragma (from GCC) is implemented using line notes in the
source manager. However, a line note's line number specifies the number
not for the current line, but for the next line. This was making all
line numbers appear off by one after the pragma.

Reported by Andy Gibbs, uncovered during r179677.

llvm-svn: 179709
2013-04-17 19:09:18 +00:00
Tareq A. Siraj 0de0dd4923 Parser support for #pragma clang __debug captured
This patch implements parsing ‘#pragma clang __debug’ as a first step for
implementing captured statements. Captured statements are a mechanism for
doing outlining in the AST.
see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html.

Currently returns StmtEmpty

Author: Andy Zhang <andy.zhang@intel.com>

Differential Revision: http://llvm-reviews.chandlerc.com/D369

llvm-svn: 179614
2013-04-16 18:41:26 +00:00
Simon Atanasyan 607776140b [Mips] Support -mmicromips / -mno-micromips command line options.
llvm-svn: 179489
2013-04-14 14:07:51 +00:00
Simon Atanasyan 1607191e66 [Mips] Follow-up to r179481. Consider "single-float" as a separate
independent of float ABI feature in the MipsTargetInfoBase class.

llvm-svn: 179486
2013-04-14 14:07:30 +00:00
Reid Kleckner 9643a313ac Fix failing dependencies-and-pp.c test
The bots seem to do more line wrapping because they have longer absolute
paths.

llvm-svn: 179284
2013-04-11 13:43:19 +00:00
Reid Kleckner 37e8fe13e0 FileCheck-ify more grep tests with quoted double quotes
This required some tedious reordering to match clang's order.
Presumably these ObjC tests were generated based on llvm-gcc's output
ordering.

llvm-svn: 179282
2013-04-11 13:24:56 +00:00
Reid Kleckner e494399203 FileCheck-ify some clang grep tests that use double quotes
The escaping interaction between Python and grep doesn't work on my
system.  This change fixes the tests for me.

llvm-svn: 179214
2013-04-10 21:10:39 +00:00
Argyrios Kyrtzidis a6444b1ce1 [frontend] When preprocessing, turn implicit module imports into @imports.
part of rdar://13610250

llvm-svn: 179144
2013-04-10 01:53:46 +00:00
Michael Ilseman 82a2a3d8f5 Repeat some #line directive tests for the GNU line marker directive.
llvm-svn: 179142
2013-04-10 01:41:19 +00:00