summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* [SystemZ] Fix some ABI corner casesUlrich Weigand2015-03-303-0/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running the GCC's inter-compiler ABI compatibility test suite uncovered a couple of errors in clang's SystemZ ABI implementation. These all affect only rare corner cases: - Short vector types GCC synthetic vector types defined with __attribute__ ((vector_size ...)) are always passed and returned by reference. (This is not documented in the official ABI document, but is the de-facto ABI implemented by GCC.) clang would do that only for vector sizes >= 16 bytes, but not for shorter vector types. - Float-like aggregates and empty bitfields clang would consider any aggregate containing an empty bitfield as first element to be a float-like aggregate. That's obviously wrong. According to the ABI doc, the presence of an empty bitfield makes an aggregate to be *not* float-like. However, due to a bug in GCC, empty bitfields are ignored in C++; this patch changes clang to be compatible with this "feature" of GCC. - Float-like aggregates and va_arg The va_arg implementation would mis-detect some aggregates as float-like that aren't actually passed as such. This applies to aggregates that have only a single element of type float or double, but using an aligned attribute that increases the total struct size to more than 8 bytes. This error occurred because the va_arg implement used to have an copy of the float-like aggregate detection logic (i.e. it would call the isFPArgumentType routine, but not perform the size check). To simplify the logic, this patch removes the duplicated logic and instead simply checks the (possibly coerced) LLVM argument type as already determined by classifyArgumentType. llvm-svn: 233543
* [mips] Add support for 'ZC' inline assembly memory constraint.Daniel Sanders2015-03-301-0/+19
| | | | | | | | | | | | | | Summary: Also add tests for 'R' and 'm'. Reviewers: atanasyan Reviewed By: atanasyan Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8449 llvm-svn: 233542
* [PowerPC] Remove assembly testing from test/CodeGen/ppc64-elf-abi.cBill Schmidt2015-03-261-21/+0
| | | | | | | | | Eric Christopher pointed out that we have a check for assembly code generation in a clang test, which isn't cool. We already have Driver and back-end CodeGen tests for the .abiversion handling, so this testing is unnecessary anyway. Make it go away. llvm-svn: 233314
* Reapply r232888 after applying a fix for -msse4 code generation.Eric Christopher2015-03-251-0/+21
| | | | | | | As a note, any target that uses fake target features via command line options will have similar problems. llvm-svn: 233227
* Add Hardware Transactional Memory (HTM) SupportKit Barton2015-03-251-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07 (POWER8). The intrinsic support is based on GCC one [1], with both 'PowerPC HTM Low Level Built-in Functions' and 'PowerPC HTM High Level Inline Functions' implemented. Along with builtins a new driver switch is added to enable/disable HTM instruction support (-mhtm) and a header with common definitions (mostly to parse the TFHAR register value). The HTM switch also sets a preprocessor builtin HTM. The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on powerpc64 and powerpc64le. This is send along a llvm patch to enabled the builtins and option switch. [1] https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html Phabricator Review: http://reviews.llvm.org/D8248 llvm-svn: 233205
* Adding back a CHECK that works with r233110Sanjay Patel2015-03-241-1/+2
| | | | llvm-svn: 233111
* Removing a CHECK that is about to go wrong.Sanjay Patel2015-03-241-2/+1
| | | | | | | | | | | | | | | | | | | | I'm about to commit a patch for: http://reviews.llvm.org/D8567 That patch will break this one existing test case in Clang. I'm not sure if this file is intending to create a Clang dependency on the LLVM IR optimizer, but that's the consequence of specifying -O3 on this test file. My hope is to avoid buildbot rage by removing this check, committing the LLVM patch, and then fixing this check. I don't know how to make a simultaneous commit to Clang and LLVM. I will commit the correct CHECK line fix for this test shortly. llvm-svn: 233109
* Adds a warning for unrecognized argument to #pragma comment() on PS4.Yunzhong Gao2015-03-231-1/+0
| | | | | | | | | | | PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but only handles the case of #pragma comment(lib). This patch adds a warning if any other arguments are encountered. This patch also refactors the code in ParsePragma.cpp a little bit to make it more obvious that some codes are being shared between -fms-extensions and PS4. llvm-svn: 233015
* [CodeGen] Properly support the half FP type with non-native operations.Ahmed Bougacha2015-03-231-134/+148
| | | | | | | | | | | | | | | | | | | | | | On AArch64, the -fallow-half-args-and-returns option is the default. With it, the half type is considered legal (rather than the i16 used normally for __fp16), but no operation is, except conversions and load/stores and such. The previous behavior was tantamount to saying LangOpts.NativeHalfType was implied by LangOpts.HalfArgsAndReturns, which isn't true. Instead, teach the various parts of CodeGen that already know about half (using the intrinsics or not) about this weird in-between case, where the "half" type is legal, but operations on it aren't. This is a smaller intermediate step to the end-goal of removing the intrinsic, always using "half", and letting the backend legalize. Builds on r232968. rdar://20045970, rdar://17468714 Differential Revision: http://reviews.llvm.org/D8367 llvm-svn: 232971
* [CodeGen] Convert double -> __fp16 in one step.Ahmed Bougacha2015-03-231-5/+21
| | | | | | | | | | | | | | Fix the CodeGen so that for types bigger than float, instead of converting to fp16 via the sequence "InTy -> float -> fp16", we perform conversions in just one step. This avoids the double rounding which potentially changes results from a natural IEEE-754 operation. rdar://17594379, rdar://17468714 Differential Revision: http://reviews.llvm.org/D4602 Part of: http://reviews.llvm.org/D8367 llvm-svn: 232968
* Revert "Add CodeGen support for adding cpu attributes on functions based on"Daniel Jasper2015-03-231-21/+0
| | | | | | | This breaks CodeGen for an internal target. I'll get repro instructions to you. llvm-svn: 232930
* Add CodeGen support for adding cpu attributes on functions based onEric Christopher2015-03-211-0/+21
| | | | | | | | | | | | | the target-cpu, if different from the triple's cpu, and target-features as they're written that are passed down from the driver. Together with LLVM r232885 this should allow the LTO'ing of binaries that contain modules compiled with different code generation options on a subset of architectures with full backend support (x86, powerpc, aarch64). llvm-svn: 232888
* fixed vperm2* intrinsics to check for shufflesSanjay Patel2015-03-201-3/+3
| | | | | | | This corresponds to llvm r232852: http://reviews.llvm.org/rL232852 llvm-svn: 232857
* MS ABI: Accept calls to an unprototyped declaration of _setjmpDavid Majnemer2015-03-201-1/+4
| | | | | | This fixes PR22961. llvm-svn: 232824
* [Modules] Implement __builtin_isinf_sign in Clang.Chandler Carruth2015-03-191-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Somehow, we never managed to implement this fully. We could constant fold it like crazy, including constant folding complex arguments, etc. But if you actually needed to generate code for it, error. I've implemented it using the somewhat obvious lowering. Happy for suggestions on a more clever way to lower this. Now, what you might ask does this have to do with modules? Fun story. So it turns out that libstdc++ actually uses __builtin_isinf_sign to implement std::isinf when in C++98 mode, but only inside of a template. So if we're lucky, and we never instantiate that, everything is good. But once we try to instantiate that template function, we need this builtin. All of my customers at least are using C++11 and so they never hit this code path. But what does that have to do with modules? Fun story. So it turns out that with modules we actually observe a bunch of bugs in libstdc++ where their <cmath> header clobbers things exposed by <math.h>. To fix these, we have to provide global function definitions to replace the macros that C99 would have used. And it turns out that ::isinf needs to be implemented using the exact semantics used by the C++98 variant of std::isinf. And so I started to fix this bug in libstdc++ and ceased to be able to compile libstdc++ with Clang. The yaks are legion. llvm-svn: 232778
* Basic: Update clang to reflect changes made to LLVM datalayoutDavid Majnemer2015-03-171-2/+2
| | | | | | | We now give x86-64 COFF targets a different mangling code, update clang to use it. llvm-svn: 232571
* Global inline assembler blocks are merged before parsing, so no specificJoerg Sonnenberger2015-03-161-0/+5
| | | | | | | | | | | | | location data is available. If pragma handling wants to look up the position, it finds the LLVM buffer and wants to compare it with the special built-in buffer, failing badly. Extend to the special handling of the built-in buffer to also check for the inline asm buffer. Expect only a single asm buffer. Sort it between the built-in buffers and the normal file buffers. Fixes the assert part of PR 22576. llvm-svn: 232389
* Add a bunch of missing "CHECK" colons in tests. NFC.Ahmed Bougacha2015-03-142-4/+6
| | | | llvm-svn: 232237
* Make tests more robust. No functional change.Robert Lougher2015-03-132-10/+10
| | | | | | | In preparation for recommit of revision 232190, change tests so that they are resilient to operands being commuted by the reassociate pass. llvm-svn: 232206
* Test case updates for explicit type parameter to the gep operatorDavid Blaikie2015-03-1326-264/+264
| | | | llvm-svn: 232187
* Update test case to make it easier to automatically port to typeless pointer ↵David Blaikie2015-03-131-2/+2
| | | | | | gep operator changes coming soon llvm-svn: 232185
* [X86, AVX2] Replace inserti128 and extracti128 intrinsics with generic shufflesSanjay Patel2015-03-121-4/+32
| | | | | | | | | | | | This is nearly identical to the v*f128_si256 parts of r231792 and r232052. AVX2 introduced proper integer variants of the hacked integer insert/extract C intrinsics that were created for this same functionality with AVX1. This should complete the front end fixes for insert/extract128 intrinsics. Corresponding LLVM patch to follow. llvm-svn: 232109
* [X86, AVX] replace vextractf128 intrinsics with generic shufflesSanjay Patel2015-03-122-7/+42
| | | | | | | | | | | This is very much like D8088 (checked in at r231792). Now that we've replaced the vinsertf128 intrinsics, do the same for their extract twins. Differential Revision: http://reviews.llvm.org/D8275 llvm-svn: 232052
* Under duress, move check for target support of __builtin_setjmp/Joerg Sonnenberger2015-03-111-34/+0
| | | | | | __builtin_longjmp to Sema as requested by John McCall. llvm-svn: 231986
* [PowerPC] ABI support for the QPX vector instruction setHal Finkel2015-03-112-0/+33
| | | | | | | | | | | | | | Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer, has recently been added to the LLVM PowerPC backend. This vector instruction set requires some ABI modifications because the ABI on the BG/Q expects <4 x double> vectors to be provided with 32-byte stack alignment, and to be handled as native vector types (similar to how Altivec vectors are handled on mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this the default ABI when QPX is supported, and have updated the ABI handling code to provide QPX vectors with the correct stack alignment and associated register-assignment logic. llvm-svn: 231960
* Add builtins for the 64-bit vector integer arithmetic instructions added in ↵Kit Barton2015-03-111-0/+605
| | | | | | | | | | POWER8. These are the Clang-related changes for the instructions added to LLVM in http://reviews.llvm.org/D7959. Phabricator review: http://reviews.llvm.org/D8041 llvm-svn: 231931
* Remove a bugus test.Rafael Espindola2015-03-111-22/+0
| | | | | | | | | This was using the driver to test LLVM. I checked that disabling the code path that the test was testing causes llvm tests to fail. llvm-svn: 231895
* [X86, AVX] Replace vinsertf128 intrinsics with generic shuffles.Sanjay Patel2015-03-102-3/+39
| | | | | | | | | | | | | | We want to replace as much custom x86 shuffling via intrinsics as possible because pushing the code down the generic shuffle optimization path allows for better codegen and less complexity in LLVM. This is the sibling patch for the LLVM half of this change: http://reviews.llvm.org/D8086 Differential Revision: http://reviews.llvm.org/D8088 llvm-svn: 231792
* Suppress a couple of tests, clang/test/CodeGen/catch-undef-behavior.c and ↵NAKAMURA Takumi2015-03-091-0/+1
| | | | | | one, for -Asserts for now. They were introduced in r231711. llvm-svn: 231717
* [UBSan] Split -fsanitize=shift into -fsanitize=shift-base and ↵Alexey Samsonov2015-03-091-8/+12
| | | | | | | | | | | | | | | | -fsanitize=shift-exponent. This is a recommit of r231150, reverted in r231409. Turns out that -fsanitize=shift-base check implementation only works if the shift exponent is valid, otherwise it contains undefined behavior itself. Make sure we check that exponent is valid before we proceed to check the base. Make sure that we actually report invalid values of base or exponent if -fsanitize=shift-base or -fsanitize=shift-exponent is specified, respectively. llvm-svn: 231711
* ARM: use ABI-specified alignment for byval parameters.Tim Northover2015-03-092-5/+5
| | | | | | | | | | | | | | | | When passing a type with large alignment byval, we were specifying the type's alignment rather than the alignment that the backend is actually capable of producing (ABIAlign). This would be OK (if odd) assuming the backend dealt with it prooperly, unfortunately it doesn't and trying to pass types with "byval align 16" can cause it to set fp incorrectly and trash the stack during the prologue. I'll be fixing that in a separate patch, but Clang should still be emitting IR that's as close to its intent as possible. rdar://20059039 llvm-svn: 231706
* Revert "[UBSan] Split -fsanitize=shift into -fsanitize=shift-base and ↵Alexey Samsonov2015-03-051-6/+9
| | | | | | | | | | | -fsanitize=shift-exponent." It's not that easy. If we're only checking -fsanitize=shift-base we still need to verify that exponent has sane value, otherwise UBSan-inserted checks for base will contain undefined behavior themselves. llvm-svn: 231409
* Temporary XFAILs for HexagonRick Foos2015-03-041-0/+1
| | | | | | | | | | | | | | Summary: Temporary XFAIL's until patches done. Reviewers: echristo, adasgupt, colinl Reviewed By: colinl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8044 llvm-svn: 231318
* Add Clang support for PPC cryptography builtinsNemanja Ivanovic2015-03-043-0/+403
| | | | | | Review: http://reviews.llvm.org/D7951 llvm-svn: 231291
* Fix test/CodeGen/builtins.c for platforms that don't lower sjljReid Kleckner2015-03-042-0/+4
| | | | | | | | Opt in Win64 to supporting sjlj lowering. We have the backend lowering, so I think this was just an oversight because WinX86_64TargetCodeGenInfo doesn't inherit from X86_64TargetCodeGenInfo. llvm-svn: 231280
* Prevent test from writing files.Daniel Jasper2015-03-041-4/+4
| | | | llvm-svn: 231247
* Adjust the changes from r230255 to bail out if the backend can't lowerJoerg Sonnenberger2015-03-041-17/+14
| | | | | | | __builtin_setjmp/__builtin_longjmp and don't fall back to the libc functions. llvm-svn: 231245
* DebugInfo: Remove useless testDuncan P. N. Exon Smith2015-03-031-24/+0
| | | | | | | | This test doesn't provide any value (it just checks that the frontend produces exactly one compile unit), and it certainly isn't doing what the comment says. Noticed via IRC review of my update to it in r231083. llvm-svn: 231152
* [UBSan] Split -fsanitize=shift into -fsanitize=shift-base and ↵Alexey Samsonov2015-03-031-9/+6
| | | | | | | | | | | | | | | | | | | | | -fsanitize=shift-exponent. -fsanitize=shift is now a group that includes both these checks, so exisiting users should not be affected. This change introduces two new UBSan kinds that sanitize only left-hand side and right-hand side of shift operation. In practice, invalid exponent value (negative or too large) tends to cause more portability problems, including inconsistencies between different compilers, crashes and inadequeate results on non-x86 architectures etc. That is, -fsanitize=shift-exponent failures should generally be addressed first. As a bonus, this change simplifies CodeGen implementation for emitting left shift (separate checks for base and exponent are now merged by the existing generic logic in EmitCheck()), and LLVM IR for these checks (the number of basic blocks is reduced). llvm-svn: 231150
* DebugInfo: Move new hierarchy into place (clang)Duncan P. N. Exon Smith2015-03-0324-52/+74
| | | | | | | Update testcases for LLVM change in r231082 to use the new debug info hierarchy. llvm-svn: 231083
* Lower _mm256_broadcastsi128_si256 directly to a vector shuffle.Juergen Ributzka2015-03-031-1/+1
| | | | | | | | | | | | | | Originally we were using the same GCC builtins to lower this AVX2 vector intrinsic. Instead we will now lower it directly to a vector shuffle. This will not only allow LLVM to generate better code, but it will also allow us to remove the GCC intrinsics. Reviewed by Andrea This is related to rdar://problem/18742778. llvm-svn: 231081
* Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie2015-02-2781-860/+860
| | | | llvm-svn: 230795
* Update Clang tests to handle explicitly typed gep changes in LLVM.David Blaikie2015-02-2736-542/+542
| | | | llvm-svn: 230783
* Reland __leave tests (r230717 and r230720, reverted in r230740).Nico Weber2015-02-271-2/+133
| | | | | | | | | The only change is that line 266 changed from // CHECK: br label %[[except]] to // CHECK: br label %[[except:[^ ]*]] llvm-svn: 230764
* Revert r230717 (and subsequent r230720).Daniel Jasper2015-02-271-133/+2
| | | | | | | The tests keeps failing on build bots: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2355/testReport/junit/Clang/CodeGen/exceptions_seh_leave_c/ llvm-svn: 230740
* [X86] Remove pblendw and pblendd builtins that aren't being used by the ↵Craig Topper2015-02-271-1/+0
| | | | | | intrinsic headers. llvm-svn: 230738
* [OPENMP] Codegen for "#pragma omp atomic write"Alexey Bataev2015-02-271-6/+6
| | | | | | | | | | For global reg lvalue - use regular store through global register. For simple lvalue - use simple atomic store. For bitfields, vector element, extended vector elements - the original value of the whole storage (for vector elements) or of some aligned value (for bitfields) is atomically read, the part of this value for the given lvalue is modified and then use atomic compare-and-exchange operation to try to atomically write modified value (if it was not modified). Also, changes in this patch fix the bug for '#pragma omp atomic read' applied to extended vector elements. Differential Revision: http://reviews.llvm.org/D7369 llvm-svn: 230736
* Add last missing __leave test.Nico Weber2015-02-271-1/+69
| | | | llvm-svn: 230720
* Add another __leave test.Nico Weber2015-02-271-2/+65
| | | | llvm-svn: 230717
* Don't crash on leaving nested __finally blocks through an EH edge.Nico Weber2015-02-262-7/+98
| | | | | | | | | | | | | | | The __finally emission block tries to be clever by removing unused continuation edges if there's an unconditional jump out of the __finally block. With exception edges, the EH continuation edge isn't always unused though and we'd crash in a few places. Just don't be clever. That makes the IR for __finally blocks a bit longer in some cases (hence small and behavior-preserving changes to existing tests), but it makes no difference in general and it fixes the last crash from PR22553. http://reviews.llvm.org/D7918 llvm-svn: 230697
OpenPOWER on IntegriCloud