summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* update test to reflect r110876 change.Devang Patel2010-08-121-1/+1
| | | | llvm-svn: 110884
* Revise r110163: don't mark weak functions nounwind, because the optimizerJohn McCall2010-08-111-0/+7
| | | | | | treats that as a contract to be fulfilled by any replacements. llvm-svn: 110864
* Remove rsqrtps_nr256 and sqrtps_nr256 builtins, at least until we need themBruno Cardoso Lopes2010-08-111-2/+0
| | | | llvm-svn: 110844
* ARM: Recognize single precision float register names.Daniel Dunbar2010-08-111-0/+14
| | | | | | | - We don't recognize double or NEON register names yet -- we don't have the infrastructure to generate the right clobbers for them. llvm-svn: 110775
* ARM: Swap which registers we consider real / aliases to match LLVM and llvm-gcc.Daniel Dunbar2010-08-111-0/+8
| | | | llvm-svn: 110774
* Remove 256-bit cast built-ins and make the AVX intrinsic call llvm ↵Bruno Cardoso Lopes2010-08-111-6/+0
| | | | | | __builtin_shufflevector with the appropriate arguments llvm-svn: 110771
* Remove 256-bit unpack built-ins and make the AVX intrinsic call llvm ↵Bruno Cardoso Lopes2010-08-111-4/+0
| | | | | | __builtin_shufflevector with the appropriate arguments llvm-svn: 110768
* Remove 256-bit shuffle built-ins and make the AVX intrinsic call llvm ↵Bruno Cardoso Lopes2010-08-111-2/+0
| | | | | | __builtin_shufflevector with the appropriate arguments llvm-svn: 110766
* Something's wrong with this test on other platforms. I'll probably need to ↵John Thompson2010-08-101-23/+0
| | | | | | simplify it later. For now revert. llvm-svn: 110738
* Slightly revised handling of mult-alt constraints, to avoid an assert, until ↵John Thompson2010-08-101-0/+23
| | | | | | we have the full fix. llvm-svn: 110706
* Do not use DIGlobalVariable to emit debugging information for enums.Devang Patel2010-08-101-0/+8
| | | | llvm-svn: 110697
* Even if a constant's evaluated value is used, emit debug info for the ↵Devang Patel2010-08-101-0/+5
| | | | | | constant variable. llvm-svn: 110660
* Make replicate intrinsics use shufflevector instead of dup builtins, also ↵Bruno Cardoso Lopes2010-08-101-3/+0
| | | | | | remove the dup builtins llvm-svn: 110646
* There is no need to pubish file static variable's name. Do not rely on this ↵Devang Patel2010-08-101-1/+1
| | | | | | code gen bug to check whether debug info is generated for such variables or not. llvm-svn: 110640
* Thread local variables aren't considered common linkage.Eric Christopher2010-08-081-0/+1
| | | | llvm-svn: 110530
* Correct -ftrapv to trap on errors, instead of calling theChris Lattner2010-08-071-24/+3
| | | | | | | | | | | | | | | | __overflow_handler entrypoint that David Chisnall made up. Calling __overflow_handler is not part of the contract of -ftrapv provided by GCC, and should never have been checked in in the first place. According to: http://permalink.gmane.org/gmane.comp.compilers.clang.devel/8699 David is using this for some of arbitrary precision integer stuff or something, which is not an appropriate thing to implement on this. llvm-svn: 110490
* Prevent these tests from dirtying the tree with output files that aren't evenChandler Carruth2010-08-063-4/+3
| | | | | | used for the test. llvm-svn: 110431
* We don't want to support built-ins which aren't needed by the intrinsics. ↵Bruno Cardoso Lopes2010-08-051-16/+0
| | | | | | Remove them llvm-svn: 110399
* Fix a major bug with -ftrapv and ++/--. Patch by David Keaton!John McCall2010-08-051-3/+65
| | | | llvm-svn: 110347
* Tests for #pragma GCC visibility.Eli Friedman2010-08-051-0/+24
| | | | llvm-svn: 110316
* Add more AVX 256-bit intrinsics and test cases for themBruno Cardoso Lopes2010-08-041-0/+36
| | | | llvm-svn: 110178
* Fix a warning on a test.John McCall2010-08-031-0/+1
| | | | llvm-svn: 110165
* Do a very simple pass over every function we emit to infer whether we canJohn McCall2010-08-031-4/+14
| | | | | | | mark it nounwind based on whether it contains any non-nounwind calls. <rdar://problem/8087431> llvm-svn: 110163
* Support x86 AVX 256-bit instructions built-ins. Right now support all of ↵Bruno Cardoso Lopes2010-08-031-2/+112
| | | | | | | | | | them, but as soon as we properly codegen the simple vector operations, remove the unnecessary built-ins/intrinsics from clang and llvm. Also add tests for the new built-ins llvm-svn: 110096
* Only run the jump-checker if there's a branch-protected scope *and* there'sJohn McCall2010-08-011-2/+7
| | | | | | | | | | a switch or goto somewhere in the function. Indirect gotos trigger the jump-checker regardless, because the conditions there are slightly more elaborate and it's too marginal a case to be worth optimizing. Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918 llvm-svn: 109962
* There is no reason for this test to invoke 'llc'.Daniel Dunbar2010-07-301-1/+1
| | | | llvm-svn: 109847
* fix rdar://8251384, another case where we could access beyond theChris Lattner2010-07-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | end of a struct. This improves the case when the struct being passed contains 3 floats, either due to a struct or array of 3 things. Before we'd generate this IR for the testcase: define float @bar(double %X.coerce0, double %X.coerce1) nounwind { entry: %X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2] %0 = bitcast %struct.foof* %X to %1* ; <%1*> [#uses=2] %1 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %X.coerce0, double* %1 %2 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1] store double %X.coerce1, double* %2 %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1] %tmp1 = load float* %tmp ; <float> [#uses=1] ret float %tmp1 } which compiled (with optimization) to: _bar: ## @bar ## BB#0: ## %entry movd %xmm1, %rax movd %eax, %xmm0 ret Now we produce: define float @bar(double %X.coerce0, float %X.coerce1) nounwind { entry: %X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2] %0 = bitcast %struct.foof* %X to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %X.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <float*> [#uses=1] store float %X.coerce1, float* %2 %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1] %tmp1 = load float* %tmp ; <float> [#uses=1] ret float %tmp1 } and: _bar: ## @bar ## BB#0: ## %entry movaps %xmm1, %xmm0 ret llvm-svn: 109776
* handle a case where we could access off the end of a functionChris Lattner2010-07-291-0/+6
| | | | | | that Eli pointed out, rdar://8249586 llvm-svn: 109762
* in release mode, irbuilder doesn't add names to instructions,Chris Lattner2010-07-291-2/+2
| | | | | | this will hopefully fix the osuosl clang-i686-darwin10 builder. llvm-svn: 109760
* This is a little bit far, but optimize cases like:Chris Lattner2010-07-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct a { struct c { double x; int y; } x[1]; }; void foo(struct a A) { } into: define void @foo(double %A.coerce0, i32 %A.coerce1) nounwind { entry: %A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1] %0 = bitcast %struct.a* %A to %struct.c* ; <%struct.c*> [#uses=2] %1 = getelementptr %struct.c* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %A.coerce0, double* %1 %2 = getelementptr %struct.c* %0, i32 0, i32 1 ; <i32*> [#uses=1] store i32 %A.coerce1, i32* %2 instead of: define void @foo(double %A.coerce0, i64 %A.coerce1) nounwind { entry: %A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1] %0 = bitcast %struct.a* %A to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %A.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1] store i64 %A.coerce1, i64* %2 I only do this now because I never want to look at this code again :) llvm-svn: 109738
* implement a todo: pass a eight-byte that consists of aChris Lattner2010-07-291-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | small integer + padding as that small integer. On code like: struct c { double x; int y; }; void bar(struct c C) { } This means that we compile to: define void @bar(double %C.coerce0, i32 %C.coerce1) nounwind { entry: %C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=2] %0 = getelementptr %struct.c* %C, i32 0, i32 0 ; <double*> [#uses=1] store double %C.coerce0, double* %0 %1 = getelementptr %struct.c* %C, i32 0, i32 1 ; <i32*> [#uses=1] store i32 %C.coerce1, i32* %1 instead of: define void @bar(double %C.coerce0, i64 %C.coerce1) nounwind { entry: %C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=3] %0 = bitcast %struct.c* %C to %0* ; <%0*> [#uses=2] %1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1] store double %C.coerce0, double* %1 %2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1] store i64 %C.coerce1, i64* %2 which gives SRoA heartburn. This implements rdar://5711709, a nice low number :) llvm-svn: 109737
* Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' alwaysChris Lattner2010-07-291-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a "coerce to" type which often matches the default lowering of Clang type to LLVM IR type, but the coerce case can be handled by making them not be the same. This simplifies things and fixes issues where X86-64 abi lowering would return coerce after making preferred types exactly match up. This caused us to compile: typedef float v4f32 __attribute__((__vector_size__(16))); v4f32 foo(v4f32 X) { return X+X; } into this code at -O0: define <4 x float> @foo(<4 x float> %X.coerce) nounwind { entry: %retval = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %coerce = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2] %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X.coerce, <4 x float>* %coerce %X = load <4 x float>* %coerce ; <<4 x float>> [#uses=1] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] store <4 x float> %add, <4 x float>* %retval %0 = load <4 x float>* %retval ; <<4 x float>> [#uses=1] ret <4 x float> %0 } Now we get: define <4 x float> @foo(<4 x float> %X) nounwind { entry: %X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3] store <4 x float> %X, <4 x float>* %X.addr %tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1] %add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1] ret <4 x float> %add } This implements rdar://8248065 llvm-svn: 109733
* ignore structs that wrap vectors in IR, the abstraction shouldn't add penalty.Chris Lattner2010-07-291-0/+10
| | | | | | | | | | | | | | | | | Before we'd compile the example into something like: %coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1] %1 = bitcast <4 x float>* %coerce.dive2 to <2 x double>* ; <<2 x double>*> [#uses=1] %2 = load <2 x double>* %1, align 1 ; <<2 x double>> [#uses=1] ret <2 x double> %2 Now we produce: %coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1] %0 = load <4 x float>* %coerce.dive2, align 1 ; <<4 x float>> [#uses=1] ret <4 x float> %0 llvm-svn: 109732
* move the 'pretty 16-byte vector' inferring code up to be sharedChris Lattner2010-07-291-1/+1
| | | | | | with return values, improving stuff that returns __m128 etc. llvm-svn: 109731
* now that we have CGT around, we can start using preferred typesChris Lattner2010-07-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for return values too. Instead of compiling something like: struct foo { int *X; float *Y; }; struct foo test(struct foo *P) { return *P; } to: %1 = type { i64, i64 } define %1 @test(%struct.foo* %P) nounwind { entry: %retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] %P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2] store %struct.foo* %P, %struct.foo** %P.addr %tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1] %tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false) %0 = bitcast %struct.foo* %retval to %1* ; <%1*> [#uses=1] %1 = load %1* %0, align 1 ; <%1> [#uses=1] ret %1 %1 } We now get the result more type safe, with: define %struct.foo @test(%struct.foo* %P) nounwind { entry: %retval = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] %P.addr = alloca %struct.foo*, align 8 ; <%struct.foo**> [#uses=2] store %struct.foo* %P, %struct.foo** %P.addr %tmp = load %struct.foo** %P.addr ; <%struct.foo*> [#uses=1] %tmp1 = bitcast %struct.foo* %retval to i8* ; <i8*> [#uses=1] %tmp2 = bitcast %struct.foo* %tmp to i8* ; <i8*> [#uses=1] call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 16, i32 8, i1 false) %0 = load %struct.foo* %retval ; <%struct.foo> [#uses=1] ret %struct.foo %0 } That memcpy is completely terrible, but I don't know how to fix it. llvm-svn: 109729
* pass argument vectors in a type that corresponds to the user type ifChris Lattner2010-07-281-0/+8
| | | | | | | | possible. This improves the example to pass <4 x float> instead of <2 x double> but we still get awful code, and still don't get the return value right. llvm-svn: 109700
* use Get8ByteTypeAtOffset for the return value path as well so weChris Lattner2010-07-281-0/+7
| | | | | | don't get errors similar to PR7714 on the return path. llvm-svn: 109689
* fix PR7714 by not referencing off the end of a struct when passed by value inChris Lattner2010-07-281-0/+14
| | | | | | | x86-64 abi. This also improves codegen as well. Some refactoring is needed of this code. llvm-svn: 109681
* Fix flags in global block descriptor whenFariborz Jahanian2010-07-281-2/+2
| | | | | | | block returns structs. Fies radar 8241648. Executable test added to llvm test suite. llvm-svn: 109620
* 2nd argument of __builtin_expect must be evaluatedFariborz Jahanian2010-07-261-0/+11
| | | | | | | if it hs side-effect to matchgcc's behaviour. Addresses radar 8172109. llvm-svn: 109467
* Switch some random local-decl cleanups over to using lazy cleanups. Turn onJohn McCall2010-07-211-1/+1
| | | | | | | the block-release unwind cleanup: we're never going to test it if we don't turn it on. llvm-svn: 108992
* Fix a goof in my previous patch -- not all of the builtins return a value, someChandler Carruth2010-07-181-3/+8
| | | | | | fixed return types. llvm-svn: 108657
* Improve the representation of the atomic builtins in a few ways. First, we makeChandler Carruth2010-07-181-1/+5
| | | | | | | | | | | | | | | their call expressions synthetically have the "deduced" types based on their first argument. We only insert conversions in the AST for arguments whose values require conversion to match the value type expected. This keeps PR7600 closed by maintaining the return type, but avoids assertions due to unexpected implicit casts making the type unsigned (test case added from Daniel). The magic is moved into the codegen for the atomic builtin which inserts the casts as needed at the IR level to raise the type to an integer suitable for the LLVM intrinsic. This shouldn't cause any real change in functionality, but now we can make the builtin be more truly polymorphic. llvm-svn: 108638
* Fix for PR3800: make sure not to evaluate the expression for a read-writeEli Friedman2010-07-161-0/+19
| | | | | | asm operand twice. llvm-svn: 108489
* Builtins/ARM: __clear_cache doesn't seem to have a consistent prototype, declareDaniel Dunbar2010-07-161-1/+1
| | | | | | | the builtin as void __clear_cache(...) to workaround this, which appears to match what GCC does. llvm-svn: 108487
* IRgen: Support user defined attributes on block runtime functions.Daniel Dunbar2010-07-161-0/+20
| | | | | | | | | | | | | | | | | | - This issue here is that /usr/include/Blocks.h wants to define some of the block runtime globals as weak, depending on the target. This doesn't work in Clang because we aren't using the AST decl for these globals. - The fix is a pretty gross hack which just watches all the decls for the specific blocks globals we need to know about; if we see one we use it, otherwise we use the hand coded type. In time, I would like to clean this up by changing IRgen to ask Sema/AST for the decl, which would then be lazily loaded from the builtin table if necessary. This could be used in a whole host of places in IRgen and would get rid of a lot of grotty hand coding of LLVM IR; however, we need some extra Sema support for this as well as support for builtin global variables. llvm-svn: 108482
* Improve test case. Thanks EliDouglas Gregor2010-07-151-0/+1
| | | | llvm-svn: 108470
* Don't suppress the emission of available_externally functions markedDouglas Gregor2010-07-151-0/+14
| | | | | | with always_inline attribute. Thanks to Howard for the tip. llvm-svn: 108469
* When forming a function call or message send expression, be sure toDouglas Gregor2010-07-131-3/+3
| | | | | | | | | | | | | | | | | strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
* Reinstate the optimization suppressing available_externally functionsDouglas Gregor2010-07-133-5/+17
| | | | | | | | at -O0. The only change from the previous patch is that we don't try to generate virtual method thunks for an available_externally function. llvm-svn: 108230
OpenPOWER on IntegriCloud