Commit Graph

1488 Commits

Author SHA1 Message Date
Richard Smith feea883de4 Implement support for 18 of the GNU-compatible __atomic builtins.
This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.

llvm-svn: 154579
2012-04-12 05:08:17 +00:00
Richard Smith b1e36c662b Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.

llvm-svn: 154513
2012-04-11 17:55:32 +00:00
Richard Smith aa22a8cdcf AtomicExpr: make ASTStmtReader a friend and remove setters. Also fix saving
of an uninitialized Stmt* in serialization of __atomic_init and add a test of
atomics serialization.

llvm-svn: 154448
2012-04-10 22:49:28 +00:00
Eric Christopher eacf8056b1 This test actually needs label names.
PR9796

llvm-svn: 154422
2012-04-10 18:36:52 +00:00
Eric Christopher 0241e32304 For debug and coverage analysis if we're not optimizing go ahead
and emit a relatively empty block for a plain break statement. This
enables us to track where we went through a switch.

PR9796 & rdar://11215207

llvm-svn: 154420
2012-04-10 18:20:19 +00:00
Eli Friedman 1fa36050ab Make the variant of __builtin_shufflevector that takes the shuffle indexes as a vector actually usable. Patch by David Neto. PR12465.
llvm-svn: 154128
2012-04-05 21:48:40 +00:00
Eric Christopher b7e28ccb3d Add more constraint registers for mips.
Patch by Jack Carter. Testcase cleanup by me.

llvm-svn: 153921
2012-04-03 01:16:32 +00:00
Craig Topper 74c17c65e4 Correctly check argument types for some vector macros in smmintrin.h. Put parentheses around uses of vector macro arguments.
llvm-svn: 153732
2012-03-30 07:01:17 +00:00
Craig Topper 97f042f2d6 Add _mm_minpos_epu16 to smmintrin.h. Fixes PR12399.
llvm-svn: 153726
2012-03-30 05:41:28 +00:00
Craig Topper 678a53c350 Fix shuffle vector calculation for mm_permute_ps. Fixes PR 12401.
llvm-svn: 153724
2012-03-30 05:09:18 +00:00
Bill Wendling 82b87f19e2 The UTF16 string referenced by a CFString should go into the __TEXT,__ustring
section. A 'normal' string will go into the __TEXT,__const section, but this
isn't good for UTF16 strings. The __ustring section allows for coalescing, among
other niceties (such as allowing the linker to easily split up strings).

Instead of outputting the UTF16 string as a series of bytes, output it as a
series of shorts. The back-end will then nicely place the UTF16 string into the
correct section, because it's a mensch.
<rdar://problem/10655949>

llvm-svn: 153710
2012-03-30 00:26:17 +00:00
David Chisnall abf320d40e Relax the test slightly so that it should pass on other people's computers.
llvm-svn: 153670
2012-03-29 18:41:08 +00:00
David Chisnall db365f38ea Call out to GCC-compatible runtime functions for atomic ops that we can't use
LLVM intrinsics for.

I have an implementation of these functions, which wants to go in a libgcc_s
equivalent in compiler-rt.  It's currently here:

http://people.freebsd.org/~theraven/atomic.c

It will be committed to compiler-rt as soon as I work out where would be a
sensible place to put it...

llvm-svn: 153666
2012-03-29 18:01:11 +00:00
Eric Christopher 8b6d051ea2 Add better support for $fp and $sp for mips inline asm support.
Patch by Jack Carter.

llvm-svn: 153530
2012-03-27 19:56:11 +00:00
Daniel Dunbar eec0abefb6 [tests] Fix test failure in release mode.
llvm-svn: 153460
2012-03-26 20:18:16 +00:00
Kostya Serebryany 141e46faf0 add tbaa metadata to vtable pointer loads/stores
llvm-svn: 153447
2012-03-26 17:03:51 +00:00
Rafael Espindola 5c0034a7c6 Add back r153360 with a fix for enums that cover all the 32 bit values.
Thanks to NAKAMURA Takumi for finding it!

llvm-svn: 153383
2012-03-24 16:50:34 +00:00
NAKAMURA Takumi 2681efcc95 Revert r153360 (and r153380), "Second part of PR12251. Produce the range metadata in clang for booleans and".
For i686 targets (eg. cygwin), I saw "Range must not be empty!" in verifier.

It produces (i32)[0x80000000:0x80000000) from (uint64_t)[0xFFFFFFFF80000000ULL:0x0000000080000000ULL), for signed i32 on MDNode::Range.

llvm-svn: 153382
2012-03-24 14:43:42 +00:00
Rafael Espindola 54355820e8 Second part of PR12251. Produce the range metadata in clang for booleans and
c++ enums.

llvm-svn: 153360
2012-03-24 00:28:06 +00:00
Bill Wendling f351774f7b Small cleanup.
llvm-svn: 153292
2012-03-22 23:34:01 +00:00
Bill Wendling 9382fdb163 Use correct FileCheck regexp.
llvm-svn: 153291
2012-03-22 23:32:07 +00:00
Bill Wendling 3b9eaa177d When an MMX output variable is tied to the input variable, we have to implicitly
cast the value to x86_mmx. This gives the ASM string the correct call signature.
<rdar://problem/10919182>

llvm-svn: 153290
2012-03-22 23:25:07 +00:00
Matt Beaumont-Gay 1617ee30fb line endings
llvm-svn: 153289
2012-03-22 23:15:04 +00:00
Eli Friedman 610bb87e17 Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me).
llvm-svn: 153285
2012-03-22 22:36:39 +00:00
Eli Friedman fefe0d07ea Don't try to create "store atomic" instructions of non-integer types; they aren't supported at the moment. PR12040.
llvm-svn: 152891
2012-03-16 01:48:04 +00:00
Eli Friedman 6f87b44fe3 When a variable has a specified asm name, but isn't using the register storage class, the asm name doesn't specify a register. PR12244.
llvm-svn: 152873
2012-03-15 23:12:51 +00:00
Chad Rosier 9c76d24f9c [frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matches
the behavior of gcc with respect to the -fno-inline and -fno-inline-functions
flags.

llvm-svn: 152861
2012-03-15 22:31:42 +00:00
James Molloy 4813fc8ed6 Fix codegen for vld{3,4}_dup intrinsics.
Patch by Silviu Baranga!

llvm-svn: 152788
2012-03-15 09:12:01 +00:00
Chad Rosier 883b2579aa [frontend] Add support for disabling the "inline" keyword using
-fno-inline-functions.

This behaves much like -fno-inline in gcc, but based on a discussion with 
Daniel it was decided that -fno-inline-functions should subsume -fno-inline.
Please speak up if you object.  The -fno-inline flag remains ignored.
Final part of rdar://10972766

llvm-svn: 152754
2012-03-14 23:32:11 +00:00
Roman Divacky 3ffe746ca8 Fix the long double to be of width/align 64. Rename va_list_test to
powerpc_types and add testing for the (long) double there.

llvm-svn: 152647
2012-03-13 19:20:17 +00:00
James Molloy a7139221f8 Use ZeroLengthBitfieldAlignment for AAPCS, as well as APCS-GNU.
llvm-svn: 152552
2012-03-12 09:14:10 +00:00
Daniel Dunbar f07b5ec0dc IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.
- We do this when it is easy to determine that the backend will pass them on
   the stack properly by itself.

Currently LLVM codegen is really bad in some cases with byval, for example, on
the test case here (which is derived from Sema code, which likes to pass
SourceLocations around)::

  struct s47 { unsigned a; };
  void f47(int,int,int,int,int,int,struct s47);
  void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); }

we used to emit code like this::

  ...
  movl	%esi, -8(%rbp)
  movl	-8(%rbp), %ecx
  movl	%ecx, (%rsp)
  ...

to handle moving the struct onto the stack, which is just appalling.

Now we generate::

  movl	%esi, (%rsp)

which seems better, no?

llvm-svn: 152462
2012-03-10 01:03:58 +00:00
Chad Rosier 64d6be979f [driver] What was implemented in r152130 was actually -fno-inline-functions, not
-fno-inline.
Part of rdar://10972766

llvm-svn: 152145
2012-03-06 21:17:19 +00:00
Chad Rosier 9a099ea3eb Whitespace.
llvm-svn: 152134
2012-03-06 19:14:53 +00:00
Chad Rosier 806031896d [driver] Add support for -fno-inline.
rdar://10972766

llvm-svn: 152130
2012-03-06 18:49:20 +00:00
Chris Lattner 332673d39d From his comment in PR12168, Eli seems confused about the alignment assumptions
we're making.  We only ignore implicit casts.  Add a testcase showing that
we get the right behavior with explicit casts.

llvm-svn: 151994
2012-03-04 00:56:24 +00:00
Chris Lattner aaa18fad7d add a testcase for PR12094 and fix a crash on pointer to incomplete type,
reported by Richard Smith.

llvm-svn: 151993
2012-03-04 00:52:12 +00:00
Chad Rosier ff3f99bf0a I referenced the incorrect rdar in my previous commit (r151745). Add the
correct radar number to the test case for tracking purposes.
rdar://10551066

llvm-svn: 151746
2012-02-29 20:18:57 +00:00
Chad Rosier b1cfc6864f Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiated
by the BAA pass, which uses the default TargetLibraryInfo constructor.
Unfortunately, the default TargetLibraryInfo constructor assumes all library
calls are available and thus ignores -fno-builtin.
rdar://10947759

llvm-svn: 151745
2012-02-29 20:14:59 +00:00
James Molloy 6f8780bed1 Reapply r151638 and r151641.
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.

These are now fixed, with regression tests added to catch them both (not Darwin-specific).

Original log:
====================

Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h

Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

====================

llvm-svn: 151712
2012-02-29 10:24:19 +00:00
Argyrios Kyrtzidis 5929ef2ee7 Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

llvm-svn: 151667
2012-02-28 23:39:14 +00:00
James Molloy 051390fffa Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.

llvm-svn: 151638
2012-02-28 18:12:11 +00:00
Eli Friedman afa84ae85b Add missing code for compound literals of complex type. <rdar://problem/10938628>
llvm-svn: 151549
2012-02-27 20:26:13 +00:00
Chad Rosier d6a56db7b6 Test case for r151429/r151430, which ensures llvm.lifetime intrinsics are not
being emitted at -O0, but are emitted when optimizations are enabled.

llvm-svn: 151533
2012-02-27 18:45:03 +00:00
Eli Friedman cb3785e450 Fix a stupid mistake in r151133. Reported to me by Joerg Sonnenberger.
llvm-svn: 151407
2012-02-24 23:53:49 +00:00
Aaron Ballman 0c84ebb539 Turned on support for __declspecs: noreturn, noinline, nothrow and naked in MS compatibility mode.
llvm-svn: 151295
2012-02-23 22:46:33 +00:00
Chandler Carruth a2a5410e6d Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
match the behavior of GCC. Also add a test for these intrinsics, which
apparently have *zero* tests. =[ Not surprisingly, Clang crashed when
compiling these.

Fix the bug in CodeGen where we failed to bitcast the argument type to
x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the
new 3dnow-builtins.c test.

This is one issue impacting the efforts to get Clang to emulate the
Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made
available there.

llvm-svn: 150948
2012-02-20 07:35:45 +00:00
David Chisnall 0867d9cfbc Implement #pragma redefine_extname.
This fixes PR5172 and allows clang to compile C++ programs on Solaris using the system headers.

llvm-svn: 150881
2012-02-18 16:12:34 +00:00
Evgeniy Stepanov 0247b99171 Loosen the test from r150238 a bit to make some of our bots happy.
llvm-svn: 150242
2012-02-10 10:04:01 +00:00
Evgeniy Stepanov 3fae4aeae4 Fix function prolog codegen whe coerce-to type is a struct.
This changes function prolog in such a way as to avoid out-of-bounds
stack store in the case when coerce-to type has a larger storage size
than the real argument type.

Fixes PR11905.

llvm-svn: 150238
2012-02-10 09:30:15 +00:00