Commit Graph

2046 Commits

Author SHA1 Message Date
Bill Wendling 85ab57ac5d Update the tests.
This update coincides with r174110. That change ordered the attributes
alphabetically.

llvm-svn: 174111
2013-01-31 23:17:12 +00:00
Tim Northover 9bb857a4f1 Add support for AArch64 target.
In cooperation with the LLVM patch, this should implement all scalar front-end
parts of the C and C++ ABIs for AArch64.

This patch excludes the NEON support also reviewed due to an outbreak of
batshit insanity in our legal department. That will be committed soon bringing
the changes to precisely what has been approved.

Further reviews would be gratefully received.

llvm-svn: 174055
2013-01-31 12:13:10 +00:00
Richard Trieu de5cc7d3d8 Add indents to AST dumping and removed parenthesis from AST nodes.
Indents were given the color blue when outputting with color.
AST dumping now looks like this:

Node
|-Node
| `-Node
`-Node
  `-Node

Compared to the previous:

(Node
  (Node
    (Node))
  (Node
    (Node)))

llvm-svn: 174022
2013-01-31 01:44:26 +00:00
Richard Smith debc59d1f3 Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled as
an attribute for consistency with our other noreturn mechanisms.

llvm-svn: 173898
2013-01-30 05:45:05 +00:00
Chad Rosier ae229d599b [ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.

The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred.  Eventually, the -fcatch-undefined-behavior' flag will be removed.

llvm-svn: 173848
2013-01-29 23:31:22 +00:00
Bill Wendling 9806806f39 Modify the tests for the (sorted) order that the attributes come out as now.
llvm-svn: 173762
2013-01-29 03:21:00 +00:00
Dmitri Gribenko a3ecd32bbf Tests: remove disabled llvm-gcc invocations
llvm-svn: 173703
2013-01-28 18:01:33 +00:00
David Blaikie 0a21d0da17 PR14566: Debug Info: avoid top level lexical blocks in functions
One of the gotchas (see changes to CodeGenFunction) was due to the fix in
r139416 (for PR10829). This only worked previously because the top level
lexical block would set the location to the end of the function, the debug
location would be updated (as per r139416), the location would be set to
the end of the function again (but that would no-op, since it was the same
as the previous location), then the return instruction would be emitted using
the debug location.

Once the top level lexical block was no longer emitted, the end-of-function
location change was causing the debug loc to be updated, regressing that bug.

llvm-svn: 173593
2013-01-26 22:16:26 +00:00
Fariborz Jahanian 7865220da4 patch for PR9027 and // rdar://11861085
Title: [PR9027] volatile struct bug: member is not loaded at -O;
This is caused by last flag passed to @llvm.memcpy being false, 
not honoring that aggregate has at least one 'volatile' data member 
(even though aggregate itself has not been qualified as 'volatile'. 
As a result, optimization optimizes away the memcpy altogether.
Patch review by John MaCall (I still need to fix up a test though).

llvm-svn: 173535
2013-01-25 23:57:05 +00:00
Dmitri Gribenko e29dadb640 FileCheck'ize test
llvm-svn: 173396
2013-01-25 00:06:54 +00:00
Dmitri Gribenko dfbd119c8b FileCheck'ize test
llvm-svn: 173391
2013-01-24 23:34:51 +00:00
Dmitri Gribenko 53616ad42d FileCheck'ize test
llvm-svn: 173389
2013-01-24 23:29:37 +00:00
David Blaikie 35d0e27b78 FileCheck-ify some debug info scope related tests.
llvm-svn: 173379
2013-01-24 22:47:48 +00:00
Akira Hatanaka 4f15fb46a1 [mips] Do not emit i32 padding if target ABI is O32. This was causing backend
to pass floating point arguments to be passed in integer registers.

llvm-svn: 173375
2013-01-24 21:47:33 +00:00
Jordan Rose 7f43dddae0 Handle universal character names and Unicode characters outside of literals.
This is a missing piece for C99 conformance.

This patch handles UCNs by adding a '\\' case to LexTokenInternal and
LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN.
If the UCN is not syntactically well-formed, we fall back to the old
treatment: a backslash followed by an identifier beginning with 'u' (or 'U').

Because the spelling of an identifier with UCNs still has the UCN in it, we
need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo.

Of course, valid code that does *not* use UCNs will see only a very minimal
performance hit (checks after each identifier for non-ASCII characters,
checks when converting raw_identifiers to identifiers that they do not
contain UCNs, and checks when getting the spelling of an identifier that it
does not contain a UCN).

This patch also adds basic support for actual UTF-8 in the source. This is
treated almost exactly the same as UCNs except that we consider stray
Unicode characters to be mistakes and offer a fixit to remove them.

llvm-svn: 173369
2013-01-24 20:50:46 +00:00
Adhemerval Zanella 5d874aeea9 PowerPC: fix __builtin_eh_return_data_regno return
llvm-svn: 173188
2013-01-22 20:02:45 +00:00
Chad Rosier e3aac2c864 [ms-inline asm] Remove the -fenable-experimental-ms-inline-asm flag. MS-style
inline assembly can be enable with -fasm-blocks or -fms-extensions alone.

llvm-svn: 173186
2013-01-22 19:38:32 +00:00
NAKAMURA Takumi 7b597946b1 clang/test/CodeGen: Nuke llvm's opt and llvm-dis, and FileCheck-ize two tests. -O1 is sufficient here.
llvm-svn: 173115
2013-01-22 01:51:59 +00:00
NAKAMURA Takumi 73871f6632 clang/test/CodeGen/2006-01-13-StackSave.c: Nuke llvm's opt and llvm-dis, and FileCheck-ize.
@llvm.stacksave is emitted regardless of "opt -std-compile-opts". We have optimizers' tests in llvm/test/Transforms.

llvm-svn: 173114
2013-01-22 01:51:54 +00:00
NAKAMURA Takumi 3bb0aa7625 clang/test/CodeGen/blocks-seq.c: FileCheck-ize.
llvm-svn: 173113
2013-01-22 01:51:48 +00:00
Akira Hatanaka b2206e71e1 [mips] Enable inlining of atomic ops on mips32 and mips64.
llvm-svn: 172855
2013-01-18 21:58:11 +00:00
NAKAMURA Takumi d6a707f20e clang/test/CodeGen: Suppress a couple of tests on win32. It seems -fsanitize-blacklist doesn't accept DOSish pathnames.
llvm-svn: 172820
2013-01-18 14:11:04 +00:00
Will Dietz f54319c891 [ubsan] Add support for -fsanitize-blacklist
llvm-svn: 172808
2013-01-18 11:30:38 +00:00
Chad Rosier e343bc83f0 [ms-inline asm] Updates and test case for r172743.
Part of rdar://12576868

llvm-svn: 172744
2013-01-17 19:22:48 +00:00
Tim Northover bd7c169664 Fix recent test for more diverse environments.
I think the main issue was the lack of -ffreestanding, which pulled in
the host's stdint.h. After that things went rapidly downhill.

llvm-svn: 172653
2013-01-16 20:35:54 +00:00
Tim Northover 4ef746768b Correct order of operands forwarding NEON vfma to LLVM fma
llvm-svn: 172650
2013-01-16 20:13:15 +00:00
Eric Christopher 91a3190a28 Collect both normal and static data members of a class in source
order. Describe static data members to metadata using new interfaces.

Part of PR14471.

Patch by Paul Robinson!

llvm-svn: 172591
2013-01-16 01:22:32 +00:00
Michael Gottesman a2b5c4ba6a Multiprecision subtraction builtins.
We lower these into 2x chained usub.with.overflow intrinsics.

llvm-svn: 172476
2013-01-14 21:44:30 +00:00
Bill Schmidt 924c478827 This patch addresses varargs processing for small complex types under
the 64-bit PowerPC ELF ABI.

The ABI requires that the real and imaginary parts of a complex argument
each occupy their own doubleword.  Arguments smaller than 8 bytes are
right-adjusted within the doubleword.

Clang expects EmitVAARG() to return a pointer to a structure in which
the real and imaginary parts are packed adjacently in memory.  To accomplish
this, we generate code to load the code appropriately from the varargs
location and pack the values into a temporary variable in the form Clang
expects, returning a pointer to that structure.

The test case demonstrates correct code generation for all "small" complex
types on PPC64:  int, short, char, and float.

llvm-svn: 172438
2013-01-14 17:45:36 +00:00
NAKAMURA Takumi 4b7d1ce9c1 clang/test/CodeGen/builtins-multiprecision.c: Enhance for each test to run on theree targets, i686, amd64, win64.
llvm-svn: 172344
2013-01-13 03:55:21 +00:00
Michael Gottesman 987226696e Fixed spelling of test name: builtins-multipercision.c => builtins-multiprecision.c.
llvm-svn: 172343
2013-01-13 03:44:31 +00:00
Michael Gottesman 0cd8b78916 Added a triple to the test builtins-multiprecision.c.
llvm-svn: 172342
2013-01-13 03:40:23 +00:00
Michael Gottesman 54398015bf Added builtins for multiprecision adds.
We lower all of these intrinsics into a 2x chained usage of
uadd.with.overflow.

llvm-svn: 172341
2013-01-13 02:22:39 +00:00
Chad Rosier 97b5895029 [ms-inline asm] Add test case for r172121.
Part of rdar://12991541

llvm-svn: 172122
2013-01-10 22:11:28 +00:00
Guy Benyei 03e61960c8 Enable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled this extension for multiple targets.
llvm-svn: 172052
2013-01-10 10:41:05 +00:00
Will Dietz 450f1a1f45 [ubsan] Make static check data non-const so it can be used for deduplication.
llvm-svn: 171947
2013-01-09 03:39:41 +00:00
Chad Rosier d35ae732ac [ms-inline asm] Add a test case for the offset operator where the operand is a
global variable.

llvm-svn: 171919
2013-01-08 23:51:48 +00:00
Dmitri Gribenko 7daa1a2201 CodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode
This hopefully fixes the ARM buildbot.

llvm-svn: 171853
2013-01-08 14:47:41 +00:00
Eric Christopher 9cf4480392 Add a test to make sure that vector output happens for debug info.
llvm-svn: 171834
2013-01-08 01:54:13 +00:00
Will Dietz cefb44869a [ubsan] Use correct type for compound assignment ops.
llvm-svn: 171801
2013-01-07 22:25:52 +00:00
Chad Rosier 8f980ef08c Test case for r171784.
llvm-svn: 171785
2013-01-07 20:34:40 +00:00
David Tweed 042e0883cb Scalar shifts in the OpenCL specification (as of v. 1.2) are defined to be
with respect to the lower "left-hand-side bitwidth" bits, even when negative);
see OpenCL spec 6.3j. This patch both implements this behaviour in the code
generator and "constant folding" bits of Sema, and also prevents tests
to detect undefinedness in terms of the weaker C99 or C++ specifications
from being applied. 

llvm-svn: 171755
2013-01-07 16:43:27 +00:00
David Blaikie a234c65613 FileCheck-ize test/CodeGen/inline.c.
A rather egregious example of the grep-style checking of old that I randomly
came across.

llvm-svn: 171631
2013-01-05 18:22:42 +00:00
Akira Hatanaka 009173f613 [mips] Fix data layout string. Add 64 to the list of native integer widths
and add stack alignment information.

llvm-svn: 171588
2013-01-05 02:04:34 +00:00
Will Dietz 3676d56b71 [ubsan] Recover by default, use -fno-sanitize-recover to disable.
llvm-svn: 171264
2012-12-30 20:53:28 +00:00
Guy Benyei f0a014bbb7 Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.
llvm-svn: 171056
2012-12-25 08:53:55 +00:00
Quentin Colombet 9b14ebc355 Add a testcase for ARM cortex-r5 subtarget
llvm-svn: 170912
2012-12-21 18:00:32 +00:00
Rafael Espindola 2be6b72ce0 Don't eagerly emit a global static merged with a local extern.
When we are visiting the extern declaration of 'i' in

static int i = 99;
int foo() {
  extern int i;
  return i;
}

We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.

Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.

Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.

Thanks to Reed Kotler for reporting this.

llvm-svn: 170827
2012-12-21 01:21:33 +00:00
Alexander Kornienko 90ff607894 Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52

Patch by Philip Craig!

llvm-svn: 170634
2012-12-20 02:09:13 +00:00
Meador Inge b97878a235 CodeGen: Expand creal and cimag into complex field loads
PR 14529 was opened because neither Clang or LLVM was expanding
calls to creal* or cimag* into instructions that just load the
respective complex field.  After some discussion, it was not
considered realistic to do this in LLVM because of the platform
specific way complex types are expanded.  Thus a way to solve
this in Clang was pursued.  GCC does a similar expansion.

This patch adds the feature to Clang by making the creal* and
cimag* functions library builtins and modifying the builtin code
generator to look for the new builtin types.

llvm-svn: 170455
2012-12-18 20:58:04 +00:00
Rafael Espindola 8522ba845f Now that the uninitialized variable has been fixed in llvm, add this test back,
but remove unneeded options and fix the comment.

llvm-svn: 170405
2012-12-18 03:54:29 +00:00
Bill Schmidt a3d121cd61 This patch fixes PR13624, which notes a 64-bit PowerPC ELF ABI
incompatibility with how complex values are returned.  It is sufficient
to flag all complex types as direct rather than indirect.

A new test case is provided that checks correct IR generation for the
various supported flavors of _Complex.

llvm-svn: 170302
2012-12-17 04:20:17 +00:00
Will Dietz ddd282addb [ubsan] Emit branch weight metadata to hint towards common case.
Results in better block placement that helps close the
performance gap when making ubsan checks recoverable.

llvm-svn: 170263
2012-12-15 01:39:14 +00:00
Richard Smith 1629da95fe ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.

llvm-svn: 170108
2012-12-13 07:11:50 +00:00
John McCall 49954ca014 Rewrite calls to bitcast unprototyped functions when emitting a definition.
My variadics patch, r169588, changed these calls to typically be
bitcasts rather than calls to a supposedly variadic function.
This totally subverted a hack where we intentionally dropped
excess arguments from such calls in order to appease the inliner
and a "warning" from the optimizer.  This patch extends the hack
to also work with bitcasts, as well as teaching it to rewrite
invokes.

llvm-svn: 170034
2012-12-12 22:21:47 +00:00
Bill Wendling 740629e299 Remove until I can fix this.
llvm-svn: 169778
2012-12-10 22:10:53 +00:00
Bill Wendling dcb992d474 Use correct flags for this test.
llvm-svn: 169768
2012-12-10 21:15:22 +00:00
Chad Rosier 99bde87178 Fixup test case from r169755. These are driver options, not frontend options.
Also, add the -S option.

llvm-svn: 169763
2012-12-10 20:16:17 +00:00
Bill Wendling 9a12912c9a Specify if `-mno-red-zone' was used when creating the GCOV instrucmentation pass.
This prevents the functions generated by that pass from using the red zone.
<rdar://problem/12843084>

llvm-svn: 169755
2012-12-10 19:47:53 +00:00
Michael Ilseman 43e17ad1d0 Remove unneeded typedef and volatile
llvm-svn: 169743
2012-12-10 18:48:08 +00:00
John McCall c818bbb8b2 Fix the required args count for variadic blocks.
We were emitting calls to blocks as if all arguments were
required --- i.e. with signature (A,B,C,D,...) rather than
(A,B,...).  This patch fixes that and accounts for the
implicit block-context argument as a required argument.
In addition, this patch changes the function type under which
we call unprototyped functions on platforms like x86-64 that
guarantee compatibility of variadic functions with unprototyped
function types;  previously we would always call such functions
under the LLVM type T (...)*, but now we will call them under
the type T (A,B,C,D,...)*.  This last change should have no
material effect except for making the type conventions more
explicit;  it was a side-effect of the most convenient implementation.

llvm-svn: 169588
2012-12-07 07:03:17 +00:00
NAKAMURA Takumi dbe7d7e965 clang/test/CodeGen/2008-01-07-UnusualIntSize.c: Add triple x86_64. It doesn't assume 32-bit target, for now.
llvm-svn: 169492
2012-12-06 12:05:25 +00:00
Chandler Carruth ff0e3a1e1c Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

llvm-svn: 169489
2012-12-06 11:14:44 +00:00
Chad Rosier c8e56e8931 [driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag.
rdar://12808010

llvm-svn: 169422
2012-12-05 21:08:21 +00:00
Chad Rosier ed92815cb0 [ms-inline asm] Add more tests.
llvm-svn: 169411
2012-12-05 19:52:05 +00:00
Michael Ilseman 7a167eef2f Have clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly modes. Test cases included.
llvm-svn: 169191
2012-12-04 00:36:06 +00:00
Will Dietz 88e0233ff4 [ubsan] Add flag to enable recovery from checks when possible.
llvm-svn: 169114
2012-12-02 19:50:33 +00:00
Eli Bendersky 2592e4e851 Fix a test that was redefining FileCheck variables while referencing old ones.
In preparation for the FileCheck enhancement to support backreferences.

llvm-svn: 169090
2012-12-01 13:50:51 +00:00
Bill Wendling 0517508c00 Don't emit a warning with an input/output parameter. We assume the user knows what they're doing here.
llvm-svn: 169059
2012-11-30 23:46:56 +00:00
Bill Wendling 3c6591d6ea Don't warn if the input size is less than the register size. Also don't warn if
the output size is greater than the register size. No truncation occurs with
those. Reword warning to make it clearer what's the problem is.

llvm-svn: 169054
2012-11-30 23:18:12 +00:00
Quentin Colombet 317962381a Add a test case for the new cortex-a5 switch
llvm-svn: 168968
2012-11-30 01:34:36 +00:00
Eli Friedman a92db6773a Fix a small calling-convention bug for x86-32. PR14453.
llvm-svn: 168959
2012-11-29 23:21:04 +00:00
Manman Ren 836a93bdb3 ABI: comments from Eli on r168820.
rdar://12723368

llvm-svn: 168821
2012-11-28 22:29:41 +00:00
Manman Ren 84b921f805 ABI: modify CreateCoercedLoad and CreateCoercedStore to not use load or store of
the original parameter or return type.

Since we do not accurately represent the data fields of a union, we should not
directly load or store a union type.

As an exmple, if we have i8,i8, i32, i32 as one field type and i32,i32 as
another field type, the first field type will be chosen to represent the union.
If we load with the union's type, the 3rd byte and the 4th byte will be skipped.

rdar://12723368

llvm-svn: 168820
2012-11-28 22:08:52 +00:00
Richard Smith 9a67f47882 Teach Lexer::getSpelling about raw string literals. Specifically, if a raw
string literal needs cleaning (because it contains line-splicing in the
encoding prefix or in the ud-suffix), do not clean the section between the
double-quotes -- that's the "raw" bit!

llvm-svn: 168776
2012-11-28 07:29:00 +00:00
Will Dietz 1897cb3b9c Add -fsanitize=integer for reporting suspicious integer behaviors.
Introduces new sanitizer "unsigned-integer-overflow".

llvm-svn: 168701
2012-11-27 15:01:55 +00:00
Bill Schmidt 90b22c9de6 This patch addresses an incompatibility relative to the 64-bit PowerPC
ELF ABI.

Complex values are to be passed in registers as though the real and
imaginary parts were passed as separate parameters.  Prior to this
patch, complex values were passed as byval aggregates.  It turns out
that specifying getDirect() for all complex types when classifying the
argument type results in the desired behavior.

The new Clang test case verifies that the correct LLVM IR is generated
for caller and callee for each of the underlying types for _Complex.

llvm-svn: 168673
2012-11-27 02:46:43 +00:00
Sebastian Pop 3ff4416458 check that always_inline attribute works with -fno-inline
Clean up the existing test to use FileCheck.

llvm-svn: 168607
2012-11-26 20:44:46 +00:00
Joey Gouly ebc59d5eb4 PR14306: Move -fbounds-checking to -fsanitize=bounds.
llvm-svn: 168510
2012-11-23 10:39:49 +00:00
Benjamin Kramer 37196de31e Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.
Also fixes a bit/byte mismatch when checking if a target supports atomic ops of a certain size.

llvm-svn: 168260
2012-11-17 17:30:55 +00:00
Eli Friedman ab19712823 Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, a crash in IR generation.
llvm-svn: 168112
2012-11-15 23:40:48 +00:00
Eli Friedman 1f576831c9 When evaluating variably modified types for function parameters, dig out the
type as written from the ParmVarDecl; it's unclear whether the standard
(C99 6.9.1p10) requires this, but we're following the precedent set by gcc,
and hopefully nobody will ever ask about this again.

PR9559 / <rdar://problem/12621983>.

llvm-svn: 167985
2012-11-14 22:09:59 +00:00
Eric Christopher fd081ca50a Remove the cellspu port.
Approved by Chris Lattner.

llvm-svn: 167983
2012-11-14 22:08:59 +00:00
Eric Christopher 175c72656f Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily since it breaks the gdb bots.

This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7.

llvm-svn: 167887
2012-11-13 23:30:57 +00:00
Bill Wendling 2415b3b6b0 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>

llvm-svn: 167807
2012-11-13 02:31:58 +00:00
Eli Friedman b369f44924 Fix IR generation for bool on PPC (and any other target where bool is not 8 bits in memory).
PR11777.

llvm-svn: 167802
2012-11-13 02:05:15 +00:00
Bill Wendling 0cc8bc4d63 That's causing an error.
llvm-svn: 167763
2012-11-12 22:14:27 +00:00
Bill Wendling b1da2cb3fd Don't test for incomplete types.
llvm-svn: 167761
2012-11-12 22:01:56 +00:00
Bill Wendling 039136664d Update testcase to show that we don't emit an error for sizes <= 32-bits.
llvm-svn: 167748
2012-11-12 21:13:35 +00:00
Bill Wendling 887b485dbe Check that the input size is correct for the given constraint.
The 'a', 'c', and 'd' constraints on i386 mean a 32-bit register. We cannot
place a 64-bit value into the 32-bit register. Error out instead of causing the
compiler to spew general badness.
<rdar://problem/12415959>

llvm-svn: 167717
2012-11-12 06:42:51 +00:00
Michael Liao 625a875f05 Add clang support of RTM from TSX
- New options '-mrtm'/'-mno-rtm' are added to enable/disable RTM feature
- Builtin macro '__RTM__' is defined if RTM feature is enabled
- RTM intrinsic header is added and introduces 3 new intrinsics, namely
  '_xbegin', '_xend', and '_xabort'.
- 3 new builtins are added to keep compatible with gcc, namely
  '__builtin_ia32_xbegin', '__builtin_ia32_xend', and '__builtin_ia32_xabort'.
- Test cases for pre-defined macro and new intrinsic codegen are added.

llvm-svn: 167665
2012-11-10 05:17:46 +00:00
Meador Inge 2461d8a6d5 Add a few more test cases for verifying -fno-builtin.
Some holes in testing where discovered while working on the LLVM library
call simplifiers.

llvm-svn: 167661
2012-11-10 03:56:55 +00:00
Justin Holewinski c0cad046b6 [NVPTX] Add __nvvm_* intrinsics as Clang builtins
Fixes bug 13354.

llvm-svn: 167647
2012-11-09 23:50:51 +00:00
NAKAMURA Takumi 43ab4ef9ba llvm/ConstantFolding.cpp: Make ReadDataFromGlobal() and FoldReinterpretLoadFromConstPtr() Big-endian-aware.
llvm-svn: 167595
2012-11-08 20:34:25 +00:00
Manman Ren 8cd99817f9 ARM byval: when type alignment is bigger than ABI alignment, instead of
disabling byval, we set realign to true.

It will perform an aligned alloca, and call memcpy to copy the byval
argument to the local variable.
Change the size threshold back to 64 bytes.

rdar://12596507

llvm-svn: 167440
2012-11-06 04:58:01 +00:00
Richard Smith c86a114409 Classify the INT_MIN/-1 check as -fsanitize=signed-integer-overflow, not as -fsanitize=divide-by-zero.
llvm-svn: 167433
2012-11-06 02:30:30 +00:00
Richard Smith b1b0ab41e7 Use the individual -fsanitize=<...> arguments to control which of the UBSan
checks to enable. Remove frontend support for -fcatch-undefined-behavior,
-faddress-sanitizer and -fthread-sanitizer now that they don't do anything.

llvm-svn: 167413
2012-11-05 22:21:05 +00:00
Ulrich Weigand 77ed89dbad On PowerPC64, integer arguments and return values need to be sign- or
zero-extended to 64 bits.  This information is currently provided to
the back end by setting "signext" or "zeroext" attributes.  However,
this is done only for integer types *smaller* than i32, not for i32
itself.  This causes clang to generate code violating the ABI, which
results in a failure of the tramp3d-v4 test case (due to calling a
system library routine without ABI-required extension).

This patch implements custom versions of classifyArgumentType and
classifyReturnType for PPC64_SVR4_ABIInfo, which are the same as the
default versions except that they also classify "int" and "unsigned int"
as types needing extending.  This fixed tramp3d-v4 on PowerPC64.

llvm-svn: 167393
2012-11-05 19:13:42 +00:00
David Blaikie d37bbc3e00 Fix debug tag type of forward declarations of struct/class in C++.
llvm-svn: 167308
2012-11-02 20:49:01 +00:00
NAKAMURA Takumi 51466d7622 clang/test/CodeGen/bitfield-promote.c: Add explicit triple for now. It has been failing for big endian targets, for example, ppc.
llvm-svn: 167293
2012-11-02 09:59:12 +00:00
NAKAMURA Takumi 510db83782 clang/test/CodeGen/bitfield-promote.c: FileCheck-ize.
llvm-svn: 167292
2012-11-02 09:59:06 +00:00
Quentin Colombet 4e172067b2 Update the front end to use minsize attribute
llvm-svn: 167266
2012-11-01 23:55:47 +00:00
Richard Smith e29c441a89 Remove divison-by-zero checks from -ftrapv. These checks were incompatible with
g++'s -ftrapv, failed to call the -ftrapv overflow handler, and are still
available under -fcatch-undefined-behavior.

llvm-svn: 167258
2012-11-01 22:13:39 +00:00
Richard Smith 2d8b294b3c -fcatch-undefined-behavior: Start checking loads and stores for null pointers.
We want the diagnostic, and if the load is optimized away, we still want to
trap it. Stop checking non-default address spaces; that doesn't work in
general.

llvm-svn: 167219
2012-11-01 07:22:08 +00:00
Manman Ren b505d33a5c ARM AAPCS-VFP: fix tracking of allocated VFP registers.
According to the spec, we can backfill VFP registers that were skipped due
to alignment constraints.

llvm-svn: 167159
2012-10-31 19:02:26 +00:00
Chad Rosier bd465a9cc7 [driver] Remove the -ccc-host-triple alias. This has been replaced by the
-target option.
rdar://10692880

llvm-svn: 167158
2012-10-31 18:59:38 +00:00
Manman Ren 2a523d864d ARM AAPCS-VFP: fix handling of homogeneous aggreate.
If HA can only partially fit into VFP registers, we add padding to make sure
HA will be on stack and later VFP CPRCs will be on stack as well.

llvm-svn: 167058
2012-10-30 23:21:41 +00:00
Quentin Colombet 7bba3f14bf Change ForceSizeOpt attribute into MinSize attribute
llvm-svn: 167021
2012-10-30 16:33:19 +00:00
Eli Friedman fb9c49e250 Don't crash on bad atomic operations. PR14176.
llvm-svn: 166992
2012-10-30 01:15:28 +00:00
Quentin Colombet ee3e0fb632 Revert commit r166946
llvm-svn: 166957
2012-10-29 18:28:57 +00:00
Quentin Colombet 0d6b5e5fde Make forcesizeopt attribute available to the end user
llvm-svn: 166946
2012-10-29 17:56:23 +00:00
Bill Schmidt cec4cb151a This patch adds alignment information for long double to the 64-bit PowerPC
ELF subtarget.

The existing description string is moved from PPC64TargetInfo to its
DarwinTargetInfo subclass, to avoid any changes to the Darwin ABI.
PPC64TargetInfo now has two possible description strings: one for FreeBSD,
which requires 8-byte alignment, and a default string that requires
16-byte alignment.

I've added a test for PPC64 Linux to verify the 16-byte alignment.  If
somebody wants to add a separate test for FreeBSD, that would be great.

Note that there is a companion patch to update the alignment information
in LLVM, which I am committing now as well.

llvm-svn: 166927
2012-10-29 14:59:24 +00:00
Ulrich Weigand 7bcc7ec745 Handle '*' and '#' asm constraint modifiers.
llvm-svn: 166924
2012-10-29 12:20:54 +00:00
Eli Friedman ef5df7b8eb Fix typo.
llvm-svn: 166833
2012-10-26 23:25:42 +00:00
Eli Friedman fc5b2effcf Add missing safety check to an optimization for do-while loops. PR14191.
llvm-svn: 166832
2012-10-26 23:23:35 +00:00
Bill Schmidt 528d2f12b7 This patch is a follow-up to r166805. As suggested on-list, a check was
added to ensure no extra alignment code is added in the future.

llvm-svn: 166812
2012-10-26 20:34:52 +00:00
Bill Schmidt 4a2dcfe5ee This patch addresses a 64-bit PowerPC ELF ABI compatibility issue with
varargs parameter passing.

A strict reading of the ABI indicates that any argument with alignment greater
than 8 may require skipping doublewords in the parameter save area to align
the argument, and hence require skipping GPRs.  In practice, this is not done
by GCC.  The alignment restriction is used for internal alignment of a
structure, but a structure with 16-byte alignment, for example, is not
itself 16-byte aligned in the parameter save area.  Although this is messy,
it has become the de facto standard used in building existing libraries.

My initial varargs support followed the ABI language, but not the de facto
standard.  Running the GCC compatibility test suite exposed this issue, and
indeed showed that LLVM didn't pass parameters self-consistently with my
original logic.  Removing the additional alignment logic allows the affected
tests to now pass.

I modified the ppc64-varargs-struct.c test case to remove the existing test
for generation of alignment code, which is no longer appropriate.

Built and tested on powerpc64-unknown-linux-gnu with no new regressions.

llvm-svn: 166805
2012-10-26 19:59:03 +00:00
Chad Rosier 0473d5429c [ms-inline asm] Test case for r166790.
llvm-svn: 166791
2012-10-26 18:04:45 +00:00
David Tweed 89206b6214 These tests require an actual x86 registered target, so mark them as such. Tested on ARM.
Patch by Joey Gouly.

llvm-svn: 166765
2012-10-26 10:17:44 +00:00
Quentin Colombet 5ee5ca1dbc Oz optimization level sets ForceSizeOpt attribute for each function
llvm-svn: 166744
2012-10-26 00:29:48 +00:00
Manman Ren 5750c1c07e X86 SSE Intrinsics: update header for sqrt_ss, rsqrt_ss and rcp_ss.
There intrinsics pass through the upper FP values from the input.
rdar://12558838

llvm-svn: 166743
2012-10-26 00:25:10 +00:00
Bill Wendling 9d1ee1175d Recommit Eric's code to validate ASM string's constraints and modifiers.
This code checks the ASM string to see if the output size is able to fit within
the variable specified as the output. For instance, scalar-to-vector conversions
may not really work. It's on by default, but can be turned off with a flag if
you think you know what you're doing.

This is placed under a flag ('-Wasm-operand-widths') and flag group ('-Wasm').

<rdar://problem/12284092>

llvm-svn: 166737
2012-10-25 23:28:48 +00:00
Chad Rosier 77c8aca06a [ms-inline asm] Add a test case for r166723 and r166724.
llvm-svn: 166725
2012-10-25 21:52:03 +00:00
Chad Rosier 602d09d0aa [ms-inline asm] Test case for r166632.
llvm-svn: 166633
2012-10-24 22:22:12 +00:00
Chad Rosier 340c1ca0f3 [ms-inline asm] Add test cases for r166451.
llvm-svn: 166600
2012-10-24 17:48:01 +00:00
Chad Rosier 42146d9a06 [ms-inline asm] Add test cases for r166592. The test cases only works if the
source operand is a register.

llvm-svn: 166594
2012-10-24 17:23:06 +00:00
Ulrich Weigand 35668cc401 A number of test cases assume that an "int" parameter or return value
will be represented in the IR as a plain "i32" type.  This causes the
tests to spuriously fail on platforms where int is not a 32-bit type,
or where the ABI requires attributes like "signext" or "zeroext" to
be used.

This patch adds -triple or -target parameters to force those tests
to use the i386-unknown-unknown target.

llvm-svn: 166551
2012-10-24 12:22:56 +00:00
NAKAMURA Takumi f1f6e99c53 Revert r166541, "clang/test: Add appropriate requirements as REQUIRES, corresponding to r166532."
According to r166543, it is not needed for now.

llvm-svn: 166544
2012-10-24 03:59:09 +00:00
NAKAMURA Takumi a22fe582d2 clang/test: Add appropriate requirements as REQUIRES, corresponding to r166532.
llvm-svn: 166541
2012-10-24 02:57:57 +00:00
Rafael Espindola fad28de40c Add padding inreg registers to cause llvm to skip ecx when needed with
the x86_fastcallcc calling convention.

llvm-svn: 166538
2012-10-24 01:59:00 +00:00
Rafael Espindola 077dd59371 Add inreg markers with the x86_fastcallcc calling convention.
llvm-svn: 166537
2012-10-24 01:58:58 +00:00
Chad Rosier a96da4773c [ms-inline asm] Test case for r166526.
llvm-svn: 166527
2012-10-23 23:42:25 +00:00
Chad Rosier 03c181b021 [ms-inline asm] Update the triple to test r166523.
llvm-svn: 166524
2012-10-23 23:32:21 +00:00
Chad Rosier b8097dec8f [ms-inline asm] Update for r166433.
llvm-svn: 166489
2012-10-23 17:44:40 +00:00
Eli Friedman 01e4d5937a Testcase change for r166440.
llvm-svn: 166441
2012-10-22 20:50:45 +00:00
Chad Rosier f7000f8c5b [ms-inline asm] Test case for r166433.
llvm-svn: 166434
2012-10-22 19:43:17 +00:00
Lang Hames a930e7131c When used in a compound expression FP_CONTRACT should proceed all explicit
declarations and statements. Emit an error if the FP_CONTRACT is used
later in a compound statement.

llvm-svn: 166383
2012-10-21 01:10:01 +00:00
Chad Rosier 03c20e83b8 [ms-inline asm] Update test case for r166357.
llvm-svn: 166358
2012-10-20 00:47:32 +00:00
Chad Rosier 4e11eec116 [ms-inline asm] Test case for r166349 and r166352.
llvm-svn: 166353
2012-10-19 23:16:17 +00:00
Chad Rosier 81bf0e81e0 [ms-inline asm] Update testcase for r166316.
llvm-svn: 166317
2012-10-19 20:57:37 +00:00
Chad Rosier 14e0bb54a5 [ms-inline asm] Revert accidental commit. Sorry for the churn.
llvm-svn: 166312
2012-10-19 20:38:09 +00:00
Chad Rosier 46d8fc9d6b [ms-inline asm] Set the SemaCallback in the TargetAsmParser.
llvm-svn: 166310
2012-10-19 20:36:37 +00:00
Daniel Dunbar 1999294b86 tests: Fix two tests to just use -triple instead of XFAIL+XTARGET.
llvm-svn: 166304
2012-10-19 20:28:44 +00:00
Andy Gibbs c6e68daac0 Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
llvm-svn: 166280
2012-10-19 12:44:48 +00:00
Eric Christopher a2f7eb7c52 Add a new option for and disable column number information as there
are no known current users of column info. Robustify and fix up
a few tests in the process. Reduces the size of debug information
by a small amount.

Part of PR14106

llvm-svn: 166236
2012-10-18 21:52:18 +00:00
Chad Rosier 0eea516789 [ms-inline asm] Remove accidental commit.
llvm-svn: 166193
2012-10-18 17:51:43 +00:00
Chad Rosier ce2bcbf8c0 [ms-inline asm] Move most of the AsmParsing logic in clang back into the MC
layer.  Use the new ParseMSInlineAsm() API and add an implementation of the
MCAsmParserSemaCallback interface.

llvm-svn: 166184
2012-10-18 15:49:40 +00:00
Manman Ren de70d54c43 ARM ABI: fix testing case arm-abi-vector.c by using [[VAR]]
rdar://12439123

llvm-svn: 166066
2012-10-16 22:40:48 +00:00
Derek Schuff a202096dc0 Add pnaclcall convention to Native Client targets.
Because PNaCl bitcode must be target-independent, it uses some
different bitcode representations from other targets (e.g. byval and
sret for structures). This means that without additional type
information, it cannot meet some native ABI requirements for some
targets (e.g. passing structures containing unions by value on
x86-64). To allow generation of code which uses the correct native
ABIs, we also support triples such as x86_64-nacl, which uses
target-dependent IR (as opposed to le32-nacl, which uses byval and
sret).

To allow interoperation between the two types of code, this patch adds
a calling convention attribute to be used in code compiled with the
target-dependent triple, which will generate code using the le32-style
bitcode. This calling convention does not need to be explicitly
supported in the backend because it determines bitcode representation
rather than native conventions (the backend just needs to undersand
how to handle byval and sret for the Native Client OS).

This patch implements __attribute__((pnaclcall)) to generate calls in
bitcode according to the le32 bitcode conventions, an attribute which
is accepted by any Native Client target, but issues a warning
otherwise.

llvm-svn: 166065
2012-10-16 22:30:41 +00:00
Manman Ren 0e8bf254b5 XFAIL this testing case to recover buildbot
llvm-svn: 166064
2012-10-16 22:02:26 +00:00
Manman Ren 67effb97df ARM ABI: fix ABI alignment issues in varargs.
We generalize r166040 to handle ABI alignment issues for all types.

rdar://12439123

llvm-svn: 166052
2012-10-16 19:51:48 +00:00
Manman Ren fef9e3199a ARM ABI: passing illegal vector types as varargs.
We expand varargs in clang and the call site is handled in the back end, it is
hard to match exactly how illegal vectors are handled in the backend. Therefore,
we legalize the illegal vector types in clang:
if (Size <= 32), legalize to i32.
if (Size == 64), legalize to v2i32.
if (Size == 128), legalize to v4i32.
if (Size > 128), use indirect.

rdar://12439123

llvm-svn: 166043
2012-10-16 19:18:39 +00:00
Manman Ren cca54d0460 ARM ABI: fix ABI alignment issues when passing legal vector types as varargs.
We create an aligned temporary space and copy the content over from ap.cur to
the temporary space. This is necessary if the natural alignment of the type is
greater than the ABI alignment.

rdar://12439123

llvm-svn: 166040
2012-10-16 19:01:37 +00:00
Joerg Sonnenberger de78bba047 When using a symbol with attribute weakref, search for it first and
don't try the normal GetOrCreateLLVM. The latter could drop the weak
atrtibute on the second reference, if there is no explicit declaration
of the aliasee.

llvm-svn: 166032
2012-10-16 17:45:27 +00:00
Chad Rosier 4a0054f383 [ms-inline asm] Rework the front-end to use the API introduced in r165946.
-The front-end now builds a single assembly string and feeds it to the
 AsmParser.  The front-end iterates on a per statement basis by calling the
 ParseStatement() function.  Please note, the calling of ParseStatement() and
 and any notion of MCAsmParsedOperands will be sunk into the MC layer in the
 near future.  I plan to expose more basic APIs such as getClobbers, etc.

-The enumeration of the AsmString expressions have been reworked to use SMLocs
 rather than assembly Pieces, which were being parsed in the front-end.

-The test case, t8(), was modified due to r129223.  I'll have to find a way to
 work around things such as these.

Sorry for the large commit, but breaking this in multiple smaller commits proved
too irritating.

llvm-svn: 165957
2012-10-15 19:56:10 +00:00
Nico Weber 636fc09960 "Implement" codegen support for __noop().
Eli discovered that __noop's sema behavior also needs some love. I filed
PR14081 for that and intend to improve it.

llvm-svn: 165886
2012-10-13 22:30:41 +00:00
Richard Smith f9a1e4ab7d -fcatch-undefined-behavior: Trap undefined behavior due to conversions to or
from a floating-point type where the source value is not in the range of
representable values of the destination type.

llvm-svn: 165843
2012-10-12 22:57:06 +00:00
Chad Rosier 941faac455 [ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
reimplemented in the AsmParser where it belongs.

llvm-svn: 165825
2012-10-12 21:37:00 +00:00
Bill Schmidt 7adee6f90e Remove XFAIL,fix test
llvm-svn: 165819
2012-10-12 20:16:26 +00:00
Bill Schmidt 2cf801ab9e XFAIL pending further investigation
llvm-svn: 165818
2012-10-12 20:07:31 +00:00
Bill Schmidt 84d3779819 This patch addresses PR13948.
For 64-bit PowerPC SVR4, an aggregate containing only one
floating-point field (float, double, or long double) must be passed in
a register as though just that field were present.  This patch
addresses the issue during Clang code generation by specifying in the
ABIArgInfo for the argument that the underlying type is passed
directly in a register.  The included test case verifies flat and
nested structs for the three data types.

llvm-svn: 165816
2012-10-12 19:26:17 +00:00
Chad Rosier dc12c45058 [ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
reimplemented in the AsmParser where it belongs.

llvm-svn: 165752
2012-10-11 21:44:41 +00:00
Chad Rosier e66f42634f [ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove the
now unused static helper function.

The test case needs to be remove temporarily until I can better filter memory
operands that aren't actual variable reference.

llvm-svn: 165751
2012-10-11 21:28:29 +00:00
Derek Schuff 57b7e8f63f Properly factor Native Client defines to support NaCl as an OS
with x86/ARM architecture

llvm-svn: 165722
2012-10-11 16:55:58 +00:00
Manman Ren a45358c284 X86: add F16C support in Clang
Support the following intrinsics:
  _mm_cvtph_ps, _mm256_cvtph_ps, _mm_cvtps_ph, _mm256_cvtps_ph

rdar://12407875

llvm-svn: 165685
2012-10-11 00:59:55 +00:00
Chandler Carruth a6399a519d Apply the same fundamental fix for PR14048 as was applied for PR11905.
The issue arises when coercing to/from types of different sizes. We need
to be certain that the allocation on either end has sufficient room for
the coerced type. When it doesn't, we need to make room, copy across,
and then proceed. PR11905 handled the case of storing function arguments
back into allocas in the function prolog, this patch handles the case of
setting up the function arguments in a call expression.

This is actually significantly simpler than the fix for PR11905. It ends
up being a trivial change to create a temporary alloca when the source
is too small and memcpy across. This should preserve the compile-time
fast-isel benefits of doing gep+load sequences and avoiding FCAs.

Reviewed by Benjamin and Evgeniy (who fixed PR11905).

llvm-svn: 165615
2012-10-10 11:29:08 +00:00
Richard Smith 481652b3e3 -fcatch-undefined-behavior: catch a VLA bound which evalutes to a non-positive value.
llvm-svn: 165583
2012-10-10 01:11:12 +00:00
Richard Smith fe782158b2 Fix test broken by r165572.
llvm-svn: 165581
2012-10-10 01:02:07 +00:00
Eli Friedman bbbbac6012 People put pragmas in crazy places; add more handling. PR14046.
I think our general framework for parser pragmas needs a bit more work,
but I'm not planning on working on it at the moment.

llvm-svn: 165558
2012-10-09 22:46:54 +00:00
Rafael Espindola fc3fc0c936 The clang driver has a fairly fancy support for executing gcc instead of
clang itself. This dates back to clang's early days and while it looks like
some of it is still used (for kext for example), other parts are probably dead.

Remove the -ccc-clang-archs option and associated code. I don't think there
is any remaining setup where clang doesn't support an architecture but it can
expect an working gcc cross compiler to be available.

A nice side effect is that tests no longer need to differentiate architectures
that are included in production builds of clang and those that are not.

llvm-svn: 165545
2012-10-09 20:46:28 +00:00
Richard Smith e30752c93b -fcatch-undefined-behavior: emit calls to the runtime library whenever one of the checks fails.
llvm-svn: 165536
2012-10-09 19:52:38 +00:00
Benjamin Kramer a801f4a81d Expose __builtin_bswap16.
GCC has always supported this on PowerPC and 4.8 supports it on all platforms,
so it's a good idea to expose it in clang too. LLVM supports this on all targets.

llvm-svn: 165362
2012-10-06 14:42:22 +00:00
Alex Rosenberg 6a41c3c005 Fix another spot where this test varied for a Release build.
llvm-svn: 165347
2012-10-05 23:56:20 +00:00
Alex Rosenberg 17710a3b9a Make test resilient to Release build temp names.
llvm-svn: 165345
2012-10-05 23:33:39 +00:00
Alex Rosenberg ba036126cf Propagate calling convention for aliases and weakrefs.
llvm-svn: 165343
2012-10-05 23:12:53 +00:00
Alex Rosenberg eba9c5c259 FileCheckize test
llvm-svn: 165342
2012-10-05 23:12:48 +00:00
Aaron Ballman 57f590e674 Changing line endings from Windows to Unix. No functional changes.
llvm-svn: 165329
2012-10-05 19:46:32 +00:00
Michael Liao 4a7f8c23e0 Add intrinsic of MULX in BMI2 header
llvm-svn: 165325
2012-10-05 18:50:09 +00:00
Chad Rosier 3fd3330a62 Test case for r165275.
llvm-svn: 165276
2012-10-04 23:59:54 +00:00
Richard Smith 9f9e5826f2 If we flow off the end of a value-returning function:
- outside C++, return undef (behavior is not undefined unless the value is used)
 - in C++, with -fcatch-undefined-behavior, perform an appropriate trap
 - in C++, produce an 'unreachable' (behavior is undefined immediately)

llvm-svn: 165273
2012-10-04 23:52:29 +00:00
Bill Schmidt 7af848bf1f Fix the CodeGen/ppc64-varargs-struct.c test case to tolerate release builds.
llvm-svn: 165247
2012-10-04 20:33:57 +00:00
Bill Schmidt a7b7f7256e Add a test case for r156143, which enabled general varargs support for the
64-bit PPC SVR4 ABI.

The test verifies passing of structures, items with 16-byte alignment, and
small items that are passed right-justified in the parameter save area slot.

llvm-svn: 165245
2012-10-04 20:18:38 +00:00
Preston Gurd 5ea246cf13 Revert 165129
llvm-svn: 165231
2012-10-04 15:26:04 +00:00
Lang Hames 05a3e31a21 Test file-scoped FP_CONTRACT pragma.
llvm-svn: 165196
2012-10-04 03:07:37 +00:00
Eli Friedman 68be1649ee Permanently end the whole "pragma got handled by the parser too early"
mess by handling all pragmas which the parser touches uniformly.
<rdar://problem/12248901>, etc.

llvm-svn: 165195
2012-10-04 02:36:51 +00:00
Chad Rosier bea1fa1ac3 Update test case for r165174.
llvm-svn: 165175
2012-10-03 22:18:51 +00:00
Preston Gurd 7912de6829 Fix failure of newly added test, by using %clang instead of %clang_cc1
and by specifying a target.

llvm-svn: 165130
2012-10-03 16:52:40 +00:00
Preston Gurd a3d7df6fee Adds a test to verify that Clang does the optimization to use a
fast div/rem instruction (for Intel Atom).

Test case for llvm commit 165126.

Patch by Tyler Nowicki.

llvm-svn: 165129
2012-10-03 16:37:56 +00:00
Benjamin Kramer f5c3b9c7cb Matching block names with FileCheck requires asserts.
llvm-svn: 165118
2012-10-03 14:21:33 +00:00
Benjamin Kramer daa0961244 CodeGen: Fix a silly typo when emitting subs of block addresses.
Part of PR14005.

llvm-svn: 165117
2012-10-03 14:15:39 +00:00
Chad Rosier 7768299b98 [ms-inline asm] Fixup test case to be valid ms-style asm. Fix whitespace.
llvm-svn: 165045
2012-10-02 20:55:30 +00:00
NAKAMURA Takumi 18fc445af5 FP_CONTRACT: Fix two tests for -Asserts.
llvm-svn: 165024
2012-10-02 16:36:54 +00:00
Aaron Ballman e91c6be01e Allowing individual targets to determine whether a given calling convention is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs.
Fixes PR13782

llvm-svn: 165015
2012-10-02 14:26:08 +00:00
Lang Hames 5de91cc35f Add FP_CONTRACT support for clang.
Clang will now honor the FP_CONTRACT pragma and emit LLVM
fmuladd intrinsics for expressions of the form A * B + C (when they occur in a
single statement).

llvm-svn: 164989
2012-10-02 04:45:10 +00:00
Nico Weber 24d05b0f29 Mark two Clang tests as passing on ARM
Also move one of them from grep to FileCheck.
Patch from Joey Gouly <joey.gouly@arm.com>!

llvm-svn: 164929
2012-10-01 08:44:54 +00:00
Kostya Serebryany f6645c8071 fix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata
llvm-svn: 164928
2012-10-01 08:39:00 +00:00
NAKAMURA Takumi 060cfdc8e9 clang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.
llvm-svn: 164879
2012-09-29 02:00:04 +00:00
Dan Gohman 22695fcec3 Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.

llvm-svn: 164853
2012-09-28 21:58:29 +00:00
NAKAMURA Takumi 6bbfd1aeca clang/test/CodeGen/ms-inline-asm.c: It requires x86 codegen. Reported by Joey Gouly.
llvm-svn: 164775
2012-09-27 14:55:08 +00:00
Nico Weber c05ecd5b17 Fix two more tests that didn't do anything.
Found with
  find test -type f | xargs grep RUN: | grep '%clang' | grep -iv '%s' | grep -v '%t' | grep -v '\\$'

llvm-svn: 164678
2012-09-26 09:09:17 +00:00
Silviu Baranga 157f7c6742 This patch introduces A15 as a target in Clang.
llvm-svn: 163804
2012-09-13 15:06:00 +00:00
Chad Rosier b261a50b40 [ms-inline asm] Handle the enumeration of input and output expressions in a
more robust way to address a few FIXMEs.

The initial implementation, r163342, built the IR asm string and then tried to
patch things on the fly without enough context.  Specifically, it didn't skip
mnemonics nor did it track with assembly instruction an expression was related
to.  The new implementation patches the operands and then builds the final
IR string.

llvm-svn: 163756
2012-09-13 00:06:55 +00:00
Chad Rosier 24f3a14026 Whitespace.
llvm-svn: 163751
2012-09-12 23:03:48 +00:00
Chad Rosier e4e6424255 Fix test case for Release builds.
llvm-svn: 163737
2012-09-12 20:13:11 +00:00
Chad Rosier fb901cac60 [ms-inline asm] Add a test case.
llvm-svn: 163731
2012-09-12 18:34:34 +00:00
Chad Rosier bb8795e100 [ms-inline asm] Test case for r163729.
llvm-svn: 163730
2012-09-12 18:25:06 +00:00
Chad Rosier 57cd91f683 [ms-inline asm] If we have a single asm operand that maps to multiple
MCOperands then iterate over all of then when computing clobbers, inputs and
outputs.

On x86 the 1-to-many mapping is a memory operand that includes a BaseReg(reg),
MemScale(imm), MemIndexReg(reg), an Expr(MCExpr or imm) and a MemSegReg(reg).
Invalid register (Op.getReg() == 0) are not considered when computing clobber.

llvm-svn: 163728
2012-09-12 18:14:25 +00:00
NAKAMURA Takumi bf05d8dd91 clang/test/CodeGen/2008-01-25-ZeroSizedAggregate.c: [PR8833] Add REQUIRES: LP64. It fails with +Asserts for Win64.
llvm-svn: 163708
2012-09-12 14:26:34 +00:00
NAKAMURA Takumi fcd16e36c8 clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.
I think some of them could be rewritten to fit also LLP64.

llvm-svn: 163699
2012-09-12 10:45:40 +00:00
Chad Rosier bd7fdadb90 [ms-inline asm] Add $$ before numeric constants in the IR.
llvm-svn: 163581
2012-09-11 00:51:28 +00:00
Richard Smith 4d1458ed38 -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,
the trap BB out of the individual checks and into a common function, to prepare
for making this code call into a runtime library. Rename the existing EmitCheck
to EmitTypeCheck to clarify it and to move it out of the way of the new
EmitCheck.

llvm-svn: 163451
2012-09-08 02:08:36 +00:00
Chad Rosier 46b0a0adbe [ms-inline asm] Output empty asm statements for the directives we don't
handle.  Otherwise, the AsmParser will explode if we try to generate an
object files.

llvm-svn: 163345
2012-09-06 19:56:25 +00:00
Chad Rosier c05d2c908d [ms-inline asm] The IR representation of inline assembly enumerates the input
and output expressions much like that in GNU-style inline assembly. Output
expressions are first.  Do this for MS-style inline asms.

llvm-svn: 163342
2012-09-06 19:35:00 +00:00
Derek Schuff 09338a250a Use custom ABIInfo for le32/PNaCl argument codegen
This patch uses a new ABIInfo implementation specific to the le32
target, rather than falling back to DefaultABIInfo. Its behavior is
basically the same, but it also allows the regparm argument attribute.
It also includes basic tests for argument codegen and attributes.

llvm-svn: 163333
2012-09-06 17:37:28 +00:00
Chad Rosier 7cf5a44836 Update for r163231.
llvm-svn: 163232
2012-09-05 19:01:07 +00:00
Chad Rosier 5aee94d4ee [ms-inline asm] Update test case for r163181.
llvm-svn: 163182
2012-09-05 00:08:54 +00:00
Chad Rosier 85fff2ac11 [ms-inline asm] Remove the Inline Asm Non-Standard Dialect attribute. This
implementation does not co-exist well with how the sideeffect and alignstack
attributes are handled.

llvm-svn: 163173
2012-09-04 22:23:54 +00:00
Chad Rosier dea7964ddb [ms-inline asm] The MCInstrDesc only tracks register definitions. For now,
assume that if the 1st operands is an expression and the instruction mayStore,
then it is a memory definition.

llvm-svn: 163144
2012-09-04 16:39:38 +00:00
Chad Rosier 41b739517c Fix test case for Release builds.
llvm-svn: 162800
2012-08-28 22:22:54 +00:00
Chad Rosier 649dfc317d [ms-inline asm] Have MSAsmStmts use the generic EmitAsmStmt codegen function.
llvm-svn: 162796
2012-08-28 21:11:24 +00:00
Benjamin Kramer 320f188859 Make test pass in Release builds, which use a different naming scheme for llvm values.
llvm-svn: 162771
2012-08-28 18:11:31 +00:00
Michael Liao bf48b1b8e4 Merge test case for PR13704 into exprs.c to reduce test cases
llvm-svn: 162769
2012-08-28 17:46:11 +00:00
Michael Liao 48f498fccf Fix PR13704
- The increment needs to be signed value to preserve the original value when
  its data type is larger than 64-bit integer.

llvm-svn: 162766
2012-08-28 16:55:13 +00:00
Benjamin Kramer 46cbe77b49 CodeGen: When emitting stores for an initializer, only emit a GEP if we really need the store.
This avoids emitting many dead GEPs for large zero-initialized arrays.

llvm-svn: 162701
2012-08-27 21:35:58 +00:00
Simon Atanasyan 8f06f2fbbf Support MIPS DSP Rev2 intrinsics.
The patch reviewed by Akira Hatanaka.

llvm-svn: 162669
2012-08-27 12:29:20 +00:00
Richard Smith 3e056dea1b -fcatch-undefined-behavior: add the -ftrapv checks to the set of things caught
by this mode, and also check for signed left shift overflow. The rules for the
latter are a little subtle:

 * neither C89 nor C++98 specify the behavior of a signed left shift at all
 * in C99 and C11, shifting a 1 bit into the sign bit has undefined behavior
 * in C++11, with core issue 1457, shifting a 1 bit *out* of the sign bit has
   undefined behavior

As of this change, we use the C99 rules for all C language variants, and the
C++11 rules for all C++ language variants. Once we have individual
-fcatch-undefined-behavior= flags, this should be revisited.

llvm-svn: 162634
2012-08-25 00:32:28 +00:00
Richard Smith 69d0d2626a New -fcatch-undefined-behavior features:
* when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check
 * check that references are bound to appropriate storage
 * check that 'this' has appropriate storage in member accesses and member function calls

llvm-svn: 162523
2012-08-24 00:54:33 +00:00
Eli Friedman a5dd5684dc Use the alignment from lvalue emission to more accurately compute the alignment
of a pointer for builtin emission, instead of just depending on the type of the
pointee.  <rdar://problem/11314941>.

llvm-svn: 162425
2012-08-23 03:10:17 +00:00
Chad Rosier d997bd1422 [ms-inline asm] Start sending non-simple inline asms to the AsmParser.
The parser still can't handle all cases, so fall back to emitting a simple
MSAsmStmt if we get into trouble.

llvm-svn: 162382
2012-08-22 19:18:30 +00:00
Benjamin Kramer c4aecf9994 Make ceil/floor/nearbyint/rint/round const even with -fmath-errno.
The conditions described by POSIX can never happen with IEEE-754 floats.
When the function is const we can emit a single sse4.1 instruction for
it, without losing anything :)

llvm-svn: 162379
2012-08-22 18:50:01 +00:00
Benjamin Kramer 6f0bf8049a Math builtin definition tweaks.
There were missed optimizations when the system headers didn't have attributes
in place, specifically:

- Add copysign, exp2, log2, nearbyint, rint and trunc to the list.
  These are functions that get inlined by LLVM's optimizer, but only when they
  have the right attributes.
- Mark copysign, fabs, fmax, fmin and trunc const unconditionally.
  Previously these were only const with -fno-math-errno, but they never set
  errno per POSIX.

For ceil/floor/nearbyint/round I'm not aware of any implementation that sets
errno, but POSIX says it may signal overflow so I left them alone for now.

llvm-svn: 162375
2012-08-22 18:16:02 +00:00
Chad Rosier b84cc6cfa3 [ms-inline asm] Remove this test case and the associated special case code.
llvm-svn: 162288
2012-08-21 17:01:26 +00:00
Jack Carter 0980793f87 When this test case was first created it was
just trying to show it did not crash and burn.

This patch checks that the resultant .ll contents
are correct.

llvm-svn: 162249
2012-08-21 00:59:48 +00:00
Eli Friedman cf4ab0891d Fix InitListExpr::isStringLiteralInit so it handles various edge cases correctly. PR13643.
llvm-svn: 162226
2012-08-20 20:55:45 +00:00
Chad Rosier 3d4b98b4bc [ms-inline asm] Add a helper function, isMSAsmKeyword().
These require special handling, which we don't currently handle.  This is being
put in place to ensure we don't do invalid symbol table lookups or try to parse
invalid assembly.  The test cases just makes sure the latter isn't happening.

llvm-svn: 162050
2012-08-16 22:25:38 +00:00
Chad Rosier 8efa48dddb Fixup test case for Release builds.
llvm-svn: 162038
2012-08-16 18:47:29 +00:00
Chad Rosier 592b90a476 [ms-inline asm] Start tracking which tokens are registers and which are
variables, function or label references.  The former is a potential clobber.
The latter is either an input or an output.  Unfortunately, it's difficult to
test this patch at the moment, but the added test case will eventually do so.

llvm-svn: 162026
2012-08-16 17:10:59 +00:00
Tanya Lattner bd837a8bde Remove names from the CHECK lines.
llvm-svn: 162003
2012-08-16 00:22:16 +00:00
Tanya Lattner a9dd49fe5b Convert loads and stores of vec3 to vec4 to achieve better code generation. Add test case.
llvm-svn: 162002
2012-08-16 00:10:13 +00:00
Chad Rosier b32f3d5230 [ms-inline asm] Use a set container to remove redundant clobbers.
llvm-svn: 161991
2012-08-15 21:55:19 +00:00
Chad Rosier aa7c1cb5f8 [ms-inline asm] MSVC parses multiple __asm statements on a single line as one
statement.  For example,

  if (x)
    __asm out dx, ax  __asm out dx, ax

results in a single inline asm statement (i.e., both "out dx, ax" statements are
predicated on if(x)).

llvm-svn: 161986
2012-08-15 21:03:27 +00:00
John Criswell edc84507c7 Fix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
Changed the alignment of an LValue to be 64 bits so that we can handle
alignment values up to half of a 64-bit address space.

llvm-svn: 161971
2012-08-15 18:40:30 +00:00
Chad Rosier 73e325de55 [ms-inline asm] Add support for clobbers in CodeGen.
This is a reapplication of r161914 now that the scoping issue has been resolved
in r161966.

llvm-svn: 161967
2012-08-15 18:12:36 +00:00
Eric Christopher d9401e2e58 Revert this to try to bring the i386 bots back.
llvm-svn: 161931
2012-08-15 06:31:06 +00:00
Chad Rosier 2d5d1327c4 [ms-inline asm] Add support for clobbers in CodeGen.
llvm-svn: 161914
2012-08-15 00:43:09 +00:00
Chad Rosier a078a5e405 [ms-inline asm] More test cases to make sure buildMSAsmString() doesn't regress.
llvm-svn: 161908
2012-08-14 23:48:41 +00:00
Fariborz Jahanian 1ac111989d irgen: inline code for several of complex builtin
calls. // rdar://8315199

llvm-svn: 161891
2012-08-14 20:09:28 +00:00
Chad Rosier c97a6bbfd8 [ms-inline asm] Add a helpful assert.
llvm-svn: 161890
2012-08-14 19:22:06 +00:00
Bob Wilson 2605fef7db Avoid using i64 types for vld1q_lane/vst1q_lane intrinsics.
The backend has to legalize i64 types by splitting them into two 32-bit pieces,
which leads to poor quality code.  If we produce code for these intrinsics that
uses one-element vector types, which can live in Neon vector registers without
getting split up, then the generated code is much better.  Radar 11998303.

llvm-svn: 161879
2012-08-14 17:27:04 +00:00
Manman Ren 6c30e137d0 ARM: enable struct byval for AAPCS-VFP.
rdar://9877866

llvm-svn: 161790
2012-08-13 21:23:55 +00:00