summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Make sure 'knm' and 'cannonlake' are accepted by builtin_cpu_isCraig Topper2017-11-191-0/+2
| | | | llvm-svn: 318619
* [CodeGen] change const-ness of complex callsSanjay Patel2017-11-183-116/+116
| | | | | | | | | | | | | | | | | After clarification about the C standard, POSIX, and implementations: The C standard allows errno-setting, and it's (unfortunately for optimization) even more clearly stated in the newer additions to the standards. We can leave these functions as always constant ('c') because they don't actually do any math and therefore won't set errno: cimag ( http://en.cppreference.com/w/c/numeric/complex/cimag ) creal ( http://en.cppreference.com/w/c/numeric/complex/creal ) cproj ( http://en.cppreference.com/w/c/numeric/complex/cproj ) conj (http://en.cppreference.com/w/c/numeric/complex/conj ) Differential Revision: https://reviews.llvm.org/D39611 llvm-svn: 318598
* Try to fix the instrument-functions testsHans Wennborg2017-11-141-2/+2
| | | | | | | | | On e.g. PPC the return value and argument were marked 'signext'. This makes the test expectations a bit more flexible. Follow-up to r318199. llvm-svn: 318214
* Switch -mcount and -finstrument-functions to emit EnterExitInstrumenter ↵Hans Wennborg2017-11-143-11/+52
| | | | | | | | | | | | | | | | attributes This updates -mcount to use the new attribute names (LLVM r318195), and switches over -finstrument-functions to also use these attributes rather than inserting instrumentation in the frontend. It also adds a new flag, -finstrument-functions-after-inlining, which makes the cygprofile instrumentation get inserted after inlining rather than before. Differential Revision: https://reviews.llvm.org/D39331 llvm-svn: 318199
* [PM] Require a registered x86 target for this test which uses the x86Chandler Carruth2017-11-141-0/+2
| | | | | | triple. llvm-svn: 318137
* [PM] Wire up support for the bounds checking sanitizer with the new PM.Chandler Carruth2017-11-141-0/+2
| | | | | | | | | | | | | | | Not much interesting here. Mostly wiring things together. One thing worth noting is that the approach is substantially different from the old PM. Here, the -O0 case works fundamentally differently in that we just directly build the pipeline without any callbacks or other cruft. In some ways, this is nice and clean. However, I don't like that it causes the sanitizers to be enabled with different changes at different times. =/ Suggestions for a better way to do this are welcome. Differential Revision: https://reviews.llvm.org/D39085 llvm-svn: 318131
* [CodeGen] fix const-ness of cbrt and fmaSanjay Patel2017-11-133-23/+51
| | | | | | | | | | | cbrt() is always constant because it can't overflow or underflow. Therefore, it can't set errno. fma() is not always constant because it can overflow or underflow. Therefore, it can set errno. But we know that it never sets errno on GNU / MSVC, so make it constant in those environments. Differential Revision: https://reviews.llvm.org/D39641 llvm-svn: 318093
* [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clangTeresa Johnson2017-11-131-0/+10
| | | | | | | | | | | | | Recommit of r317951 and r317951 along with what I believe should fix the remaining buildbot failures - the target triple should be specified for both the ThinLTO pre-thinlink compile and backend (post-thinlink) compile to ensure it is consistent. Original description: The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). llvm-svn: 318042
* [X86] test/testn intrinsics lowering to IR. clang sideUriel Korach2017-11-134-46/+116
| | | | | | | | | Change Header files of the intrinsics for lowering test and testn intrinsics to IR code. Removed test and testn builtins from clang Differential Revision: https://reviews.llvm.org/D38737 llvm-svn: 318035
* ChangeJina Nahias2017-11-131-3/+3
| | | | | | | | | | // CHECK: shufflevector <8 x double> %0, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9> To // CHECK: shufflevector <8 x double> %{{.*}}, <8 x double> %{{.*}}, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 8, i32 9> for fixing 318025 commit warning Change-Id: Id48a1fe1f247fe6a0b84e7189f18d2e637678e79 llvm-svn: 318031
* [x86][AVX512] Lowering shuffle i/f intrinsics to LLVM IRJina Nahias2017-11-132-24/+44
| | | | | | | | | This patch, together with a matching llvm patch (https://reviews.llvm.org/D38671), implements the lowering of X86 shuffle i/f intrinsics to IR. Differential Revision: https://reviews.llvm.org/D38672 Change-Id: I9b3c2f2b34323bd9ccb21d0c1832f848b88ec047 llvm-svn: 318025
* Revert "[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang"Teresa Johnson2017-11-111-10/+0
| | | | | | | This reverts commit r317951 and r317952. The new test is aborting on some bots and I'll need to investigate later. llvm-svn: 317959
* Add x86-registered-target to REQUIRES for new testTeresa Johnson2017-11-111-0/+1
| | | | | | Should fix test added in r317951. llvm-svn: 317952
* [ThinLTO] Handle -fdebug-pass-manager for backend invocations via clangTeresa Johnson2017-11-101-0/+9
| | | | | | | | | | | | | | Summary: The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). Reviewers: danielcdh Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D39923 llvm-svn: 317951
* [X86] Reduce the number of FMA builtins needed by the frontend by adding ↵Craig Topper2017-11-102-32/+104
| | | | | | | | | | | | negates to operands of the fmadd and fmaddsub builtins. The backend should be able to combine the negates to create fmsub, fnmadd, and fnmsub. faddsub converting to fsubadd still needs work I think, but should be very doable. This matches what we already do for the masked builtins. This only covers the packed builtins. Scalar builtins will be done after FMA4 is fixed. llvm-svn: 317873
* Fix a bug with the use of __builtin_bzero in a conditional expression.John McCall2017-11-091-0/+13
| | | | | | Patch by Bharathi Seshadri! llvm-svn: 317776
* Change noplt.c to work for non-x86 targets.Sriraman Tallam2017-11-071-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D39759 llvm-svn: 317627
* [NVPTX] Implement __nvvm_atom_add_gen_d builtin.Justin Lebar2017-11-071-0/+23
| | | | | | | | | | | | | | | Summary: This just seems to have been an oversight. We already supported the f64 atomic add with an explicit scope (e.g. "cta"), but not the scopeless version. Reviewers: tra Subscribers: jholewinski, sanjoy, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D39638 llvm-svn: 317623
* New clang option -fno-plt which avoids the PLT and lazy binding while making ↵Sriraman Tallam2017-11-071-0/+9
| | | | | | | | external calls. Differential Revision: https://reviews.llvm.org/D39079 llvm-svn: 317605
* [CodeGen] split math and complex tests into separate files; NFCISanjay Patel2017-11-074-425/+418
| | | | | | | The files are already large, and we may need to add even more RUNs to distinguish differences based on OS, environment, or other platform things. llvm-svn: 317583
* lowering broadcastmJina Nahias2017-11-062-20/+74
| | | | | Change-Id: I0661abea3e3742860e0a03ff9e4fcdc367eff7db llvm-svn: 317456
* [CodeGen] add remquo to list of recognized library callsSanjay Patel2017-11-041-4/+8
| | | | | | | | | | | | This is just an oversight because we already do recognize __builtin_remquo() with the same signature. http://en.cppreference.com/w/c/numeric/math/remquo http://pubs.opengroup.org/onlinepubs/9699919799/functions/remquo.html Differential Revision: https://reviews.llvm.org/D39615 llvm-svn: 317407
* [CodeGen] add libcall attr tests to show errno-related diffs; NFCSanjay Patel2017-11-031-0/+732
| | | | | | See rL317220 for the builtin siblings. llvm-svn: 317336
* [CodeGen] fix const-ness of builtin equivalents of <math.h> and <complex.h> ↵Sanjay Patel2017-11-022-133/+131
| | | | | | | | | | | | | | | | functions that might set errno This just makes const-ness of the builtins match const-ness of their lib function siblings. We're deferring fixing some of these that are obviously wrong to follow-up patches. Hopefully, the bugs are visible in the new test file (added at rL317220). As the description in Builtins.def says: "e = const, but only when -fmath-errno=0". This is step 2 of N to fix builtins and math calls as discussed in D39204. Differential Revision: https://reviews.llvm.org/D39481 llvm-svn: 317265
* [CodeGen] add builtin attr tests to show errno-related diffs; NFCSanjay Patel2017-11-021-0/+777
| | | | llvm-svn: 317220
* [CFI] Add CFI-icall pointer type generalizationVlad Tsyrklevich2017-10-313-6/+33
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows generalizing pointers in type signatures used for cfi-icall by enabling the -fsanitize-cfi-icall-generalize-pointers flag. This works by 1) emitting an additional generalized type signature metadata node for functions and 2) llvm.type.test()ing for the generalized type for translation units with the flag specified. This flag is incompatible with -fsanitize-cfi-cross-dso because it would require emitting twice as many type hashes which would increase artifact size. Reviewers: pcc, eugenis Reviewed By: pcc Subscribers: kcc Differential Revision: https://reviews.llvm.org/D39358 llvm-svn: 317044
* [CodeGen] map sqrt libcalls to llvm.sqrt when errno is not setSanjay Patel2017-10-313-23/+31
| | | | | | | | | | | | | | | | | The LLVM sqrt intrinsic definition changed with: D28797 ...so we don't have to use any relaxed FP settings other than errno handling. This patch sidesteps a question raised in PR27435: https://bugs.llvm.org/show_bug.cgi?id=27435 Is a programmer using __builtin_sqrt() invoking the compiler's intrinsic definition of sqrt or the mathlib definition of sqrt? But we have an answer now: the builtin should match the behavior of the libm function including errno handling. Differential Revision: https://reviews.llvm.org/D39204 llvm-svn: 317031
* [CodeGen] Generate TBAA info for reference loadsIvan A. Kosarev2017-10-301-14/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D39177 llvm-svn: 316896
* Filter out invalid 'target' items from being passed to LLVMErich Keane2017-10-271-8/+8
| | | | | | | | | | | | | | | | | Craig noticed that CodeGen wasn't properly ignoring the values sent to the target attribute. This patch ignores them. This patch also sets the 'default' for this checking to 'supported', since only X86 has implemented the support for checking valid CPU names and Feature Names. One test was changed to i686, since it uses a lakemont, which would otherwise be prohibited in x86_64. Differential Revision: https://reviews.llvm.org/D39357 llvm-svn: 316783
* Simplify codegen and debug info generation for block context parameters.Adrian Prantl2017-10-261-0/+20
| | | | | | | | | | | | | | | | | | | | The exisiting code goes out of its way to put block parameters into an alloca only at -O0, and then describes the funciton argument with a dbg.declare, which is undocumented in the LLVM-CFE contract and does not actually behave as intended after LLVM r642022. This patch just generates the alloca unconditionally, the mem2reg pass will eliminate it at -O1 and up anyway and points the dbg.declare to the alloca as intended (which mem2reg will then correctly rewrite into a dbg.value). This reapplies r316684 with some dead code removed. rdar://problem/35043980 Differential Revision: https://reviews.llvm.org/D39305 llvm-svn: 316689
* Revert "Simplify codegen and debug info generation for block context ↵Adrian Prantl2017-10-261-20/+0
| | | | | | | | parameters." This reverts commit r316684 while investigating buildbot breakage. llvm-svn: 316686
* Simplify codegen and debug info generation for block context parameters.Adrian Prantl2017-10-261-0/+20
| | | | | | | | | | | | | | | | | | The exisiting code goes out of its way to put block parameters into an alloca only at -O0, and then describes the funciton argument with a dbg.declare, which is undocumented in the LLVM-CFE contract and does not actually behave as intended after LLVM r642022. This patch just generates the alloca unconditionally, the mem2reg pass will eliminate it at -O1 and up anyway and points the dbg.declare to the alloca as intended (which mem2reg will then correctly rewrite into a dbg.value). rdar://problem/35043980 Differential Revision: https://reviews.llvm.org/D39305 llvm-svn: 316684
* [X86] Add a target attribute test for no-sse4.Craig Topper2017-10-261-6/+9
| | | | llvm-svn: 316681
* CodeGen: fix PPC Darwin variadicsSaleem Abdulrasool2017-10-251-0/+28
| | | | | | | | | Darwin uses char * for the variadic list type (va_list). We use the PPC SVR4 ABI for PPC, which uses a structure type for the va_list. When constructing the GEP, we would fail due to the incorrect handling for the va_list. Correct this to use the right type. llvm-svn: 316599
* [CodeGen] add tests for __builtin_sqrt*; NFCSanjay Patel2017-10-201-0/+9
| | | | | | | I don't know if this is correct, but this is what we currently do. More discussion in PR27108 and PR27435 and D27618. llvm-svn: 316250
* [CodeGen] Fix generation of TBAA info for array-to-pointer conversionsIvan A. Kosarev2017-10-201-0/+18
| | | | | | | | | | Resolves: Fatal error: Offset not zero at the point of scalar access. http://llvm.org/PR34992 Differential Revision: https://reviews.llvm.org/D39083 llvm-svn: 316211
* [CGExprScalar] Add missing types in function GetIntrinsicGuozhi Wei2017-10-191-1/+24
| | | | | | | | In function GetIntrinsic, not all types are covered. Types double and long long are missed, type long is wrongly treated same as int, it should be same as long long. These problems cause compiler crashes when compiling code in PR31161. This patch fixed the problem. Differential Revision: https://reviews.llvm.org/D38820 llvm-svn: 316179
* [Hexagon] Handling of new HVX flags and target-featuresSumanth Gundapaneni2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has the following changes A new flag "-mhvx-length={64B|128B}" is introduced to specify the length of the vector. Previously we have used "-mhvx-double" for 128 Bytes. This adds the target-feature "+hvx-length{64|128}b" The "-mhvx" flag must be provided on command line to enable HVX for Hexagon. If no -mhvx-length flag is specified, a default length is picked from the arch mentioned in this priority order from either -mhvx=vxx or -mcpu. For v60 and v62 the default length is 64 Byte. For unknown versions, the length is 128 Byte. The -mhvx flag adds the target-feature "+hvxv{hvx_version}" The 64 Byte mode is soon going to be deprecated. A warning is emitted if 64 Byte is enabled. A warning is still emitted for the default 64 Byte as well. This warning can be suppressed with a -Wno flag. The "-mhvx-double" and "-mno-hvx-double" flags are deprecated. A warning is emitted if the driver sees them on commandline. "-mhvx-double" is an alias to "-mhvx-length=128B" The compilation will error out if -mhvx-length is specified with out an -mhvx/-mhvx= flag The macro HVX_LENGTH is defined and is set to the length of the vector. Eg: #define HVX_LENGTH 64 The macro HVX_ARCH is defined and is set to the version of the HVX. Eg: #define HVX_ARCH 62 Differential Revision: https://reviews.llvm.org/D38852 llvm-svn: 316102
* [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue ↵Ivan A. Kosarev2017-10-171-0/+23
| | | | | | | | base info Differential Revision: https://reviews.llvm.org/D38796 llvm-svn: 315984
* Basic: make the nan family pureSaleem Abdulrasool2017-10-171-12/+8
| | | | | | | | | | The nan family of math routines do not rely on global state. They do however depend on their parameter. This fits the description of pure: Functions which have no effects except the return value and their return value depends only on the parameters and/or global variables. Mark the family as `readonly`. llvm-svn: 315968
* Basic: adjust attributes on `nan` LIBBUILTINsSaleem Abdulrasool2017-10-131-296/+296
| | | | | | | | | | | | The `nan` family of functions will inspect the contents of the parameter that they are passed. As a result, the function cannot be annotated as `const`. The documentation of the `const` attribute explicitly states this: Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Adjust the annotations on this family of functions. llvm-svn: 315741
* [CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70Artem Belevich2017-10-121-0/+166
| | | | | | Differential Revision: https://reviews.llvm.org/D38742 llvm-svn: 315624
* [X86] Add CLWB intrinsic. clang partCraig Topper2017-10-121-0/+9
| | | | | | | | | | | | Reviewers: RKSimon, zvi, igorb Reviewed By: RKSimon Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38781 llvm-svn: 315607
* [X86] Use -ffreestanding instead of using the mm_malloc.h include guard hack ↵Craig Topper2017-10-124-11/+7
| | | | | | on more of the builtin tests. llvm-svn: 315594
* [COFF, ARM64] Add MS builtins __dmb, __dsb, __isbMartin Storsjo2017-10-121-0/+26
| | | | | | Differential Revision: https://reviews.llvm.org/D38821 llvm-svn: 315567
* [X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.Craig Topper2017-10-111-0/+1
| | | | | | The compiler-rt implementation already supported it, it just wasn't exposed. llvm-svn: 315517
* [CGExprScalar] In EmitCompare trunc the result if it has different type as ↵Guozhi Wei2017-10-101-0/+11
| | | | | | | | | | | | | | | | E->getType() Usually compare expression should return i1 type, so EmitScalarConversion is called before return return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType(), E->getExprLoc()); But when ppc intrinsic is called to compare vectors, the ppc intrinsic can return i32 even E->getType() is BoolTy, in this case EmitScalarConversion does nothing, an i32 type result is returned and causes crash later. This patch detects this case and truncates the result before return. Differential Revision: https://reviews.llvm.org/D38656 llvm-svn: 315358
* Driver: hoist the `wchar_t` handling to the driverSaleem Abdulrasool2017-10-065-6/+6
| | | | | | | | | | | | | | | | Move the logic for determining the `wchar_t` type information into the driver. Rather than passing the single bit of information of `-fshort-wchar` indicate to the frontend the desired type of `wchar_t` through a new `-cc1` option of `-fwchar-type` and indicate the signedness through `-f{,no-}signed-wchar`. This replicates the current logic which was spread throughout Basic into the `RenderCharacterOptions`. Most of the changes to the tests are to ensure that the frontend uses the correct type. Add a new test set under `test/Driver/wchar_t.c` to ensure that we calculate the proper types for the various cases. llvm-svn: 315126
* Refine generation of TBAA information in clangIvan A. Kosarev2017-10-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is an attempt to clarify and simplify generation and propagation of TBAA information. The idea is to pack all values that describe a memory access, namely, base type, access type and offset, into a single structure. This is supposed to make further changes, such as adding support for unions and array members, easier to prepare and review. DecorateInstructionWithTBAA() is no more responsible for converting types to tags. These implicit conversions not only complicate reading the code, but also suggest assigning scalar access tags while we generally prefer full-size struct-path tags. TBAAPathTag is replaced with TBAAAccessInfo; the latter is now the type of the keys of the cache map that translates access descriptors to metadata nodes. Fixed a bug with writing to a wrong map in getTBAABaseTypeMetadata() (former getTBAAStructTypeInfo()). We now check for valid base access types every time we dereference a field. The original code only checks the top-level base type. See isValidBaseType() / isTBAAPathStruct() calls. Some entities have been renamed to sound more adequate and less confusing/misleading in presence of path-aware TBAA information. Now we do not lookup twice for the same cache entry in getAccessTagInfo(). Refined relevant comments and descriptions. Differential Revision: https://reviews.llvm.org/D37826 llvm-svn: 315048
* [CodeGen] Emit a helper function for __builtin_os_log_format to reduceAkira Hatanaka2017-10-061-179/+335
| | | | | | | | | | | | | | | | | | | | | | | | | | | | code size. Currently clang expands a call to __builtin_os_log_format into a long sequence of instructions at the call site, causing code size to increase in some cases. This commit attempts to reduce code size by emitting a helper function that can be shared by calls to __builtin_os_log_format with similar formats and arguments. The helper function has linkonce_odr linkage to enable the linker to merge identical functions across translation units. Attribute 'noinline' is attached to the helper function at -Oz so that the inliner doesn't inline functions that can potentially be merged. This commit also fixes a bug where the generated IR writes past the end of the buffer when "%m" is the last specifier appearing in the format string passed to __builtin_os_log_format. Original patch by Duncan Exon Smith. rdar://problem/34065973 rdar://problem/34196543 Differential Revision: https://reviews.llvm.org/D38606 llvm-svn: 315045
OpenPOWER on IntegriCloud