Commit Graph

33209 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
3637babc4c CodeGen: Use the new DebugLoc API, NFC
Update lib/CodeGen (and lib/Target) to use the new `DebugLoc` API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 19:14:47 +00:00
Justin Holewinski
d85053fc3f [NVPTX] Add options for PTX 4.1/4.2 and SM 3.2/3.7/5.2/5.3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 18:12:50 +00:00
Yaron Keren
6e92e7b09a Remove more superfluous .str() and replace std::string concatenation with Twine.
Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:42:36 +00:00
Sanjay Patel
65e878bd80 more space; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233554 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:31:32 +00:00
Ulrich Weigand
5738b77176 [SystemZ] Fix LLVM crash on unoptimized code
Compiling the following function with -O0 would crash, since LLVM would
hit an assertion in getTestUnderMaskCond:

  int test(unsigned long x)
  {
    return x >= 0 && x <= 15;
  }

Fixed by detecting the case in the caller of getTestUnderMaskCond.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233541 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 13:46:59 +00:00
Ulrich Weigand
b42e01326d [SystemZ] Remove TargetMachine CPU auto-detection
As was done for X86 in r206094.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233540 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 13:46:25 +00:00
Daniel Sanders
35efeb5e16 [mips] Support 9-bit offsets for the 'R' inline assembly memory constraint.
Summary:
The 'R' constraint is actually supposed to be much more complicated than
this and is defined in terms of whether it will cause macro expansion in
the assembler. 'R' is getting less useful due to architecture changes and
ought to be replaced by other constraints. We therefore implement 9-bit
offsets which will work for all subtargets and all instructions.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8440


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233537 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 13:27:25 +00:00
Elena Demikhovsky
10e73aeede AVX-512: blank lines, duplicated tests, no functional changes
see comments http://reviews.llvm.org/D6835


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233528 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 09:29:28 +00:00
Elena Demikhovsky
f5f12f1e92 AVX-512: added intrinsics for VPAND, VPOR and VPXOR
by Asaf Badouh (asaf.badouh@intel.com)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 08:30:34 +00:00
Craig Topper
5ffc995ff3 [X86] Remove FeatureAES for 'corei7' CPU. 'corei7' should match 'nehalem' which doesn't have AES. Having AES and not PCLMUL makes 'corei7' halfway between Nehalem and Westmere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 06:31:11 +00:00
Elena Demikhovsky
a8f971683a AVX-512: Fixed the "commutative" property flag in VPANDN instruction
By Asaf Badouh (asaf.badouh@intel.com)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-29 09:14:29 +00:00
Akira Hatanaka
971af2987a Delete MCInstPrinter::AvailableFeatures.
All the ports have been fixed to read the feature bits from the subtarget passed
to the print methods. Also, delete the call to setAvailableFeatures in the
constructor of NVPTX's instprinter as the instprinter wasn't using the feature
bits anywhere.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233486 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 21:07:24 +00:00
Akira Hatanaka
e03685b10a [X86] Read the feature bits from the subtarget that is passed to printInst
instead of from MCInstPrinter::AvailableFeatures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233485 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 20:56:05 +00:00
Hal Finkel
2eaf50f5fb [PowerPC] Add asm parser support for bitmask forms of rotate-and-mask instructions
The asm syntax for the 32-bit rotate-and-mask instructions can take a 32-bit
bitmask instead of an (mb, me) pair. This syntax is not specified in the Power
ISA manual, but is accepted by GNU as, and is documented in IBM's Assembler
Language Reference. The GNU Multiple Precision Arithmetic Library (gmp)
contains assembly that uses this syntax.

To implement this, I moved the isRunOfOnes utility function from
PPCISelDAGToDAG.cpp to PPCMCTargetDesc.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 19:42:41 +00:00
Akira Hatanaka
bcdb993025 Partially revert the changes I made in r233473 to keep the code concise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 04:40:43 +00:00
Akira Hatanaka
c74135ba1b clang-format X86ATTInstPrinter.{h,cpp} before I make changes to these files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233473 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 04:25:41 +00:00
Akira Hatanaka
2841bc6858 [SparcInstPrinter] Use the subtarget that is passed to the print function
instead of the one passed to the constructor.

Unfortunately, I don't have a test case for this change. In order to test my
change, I will have to run the code after line 90 in printSparcAliasInstr. I
couldn't make that happen because printAliasInstr would always handle the
printing of fcmp instructions that the code after line 90 is supposed to handle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-28 04:03:51 +00:00
Akira Hatanaka
57e9efecb0 [ARM] Enable changing instprinter's behavior based on the per-function
subtarget.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233451 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 23:41:42 +00:00
Akira Hatanaka
4bb318dc49 clang-format ARMInstPrinter.{h,cpp} before I make changes to these files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233448 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 23:24:22 +00:00
Akira Hatanaka
f2f2ef70a0 [AArch64InstPrinter] Use the feature bits of the subtarget passed to the print
method.

This enables the instprinter to print a different system register name based on
the feature bits of the per-function subtarget. 

Differential Revision: http://reviews.llvm.org/D8668 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 20:37:20 +00:00
Akira Hatanaka
f09378397e [MCInstPrinter] Enable MCInstPrinter to change its behavior based on the
per-function subtarget.

Currently, code-gen passes the default or generic subtarget to the constructors
of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which
enables some targets (AArch64, ARM, and X86) to change their instprinter's
behavior based on the subtarget feature bits. Since the backend can now use
different subtargets for each function, instprinter has to be changed to use the
per-function subtarget rather than the default subtarget.

This patch takes the first step towards enabling instprinter to change its
behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to
AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the
various print methods table-gen auto-generates. 

I will follow up with changes to instprinters of AArch64, ARM, and X86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 20:36:02 +00:00
Marek Olsak
920bbddfe0 R600/SI: Fix VOP2 VI encoding
Broken by "R600/SI: Refactor VOP2 instruction defs".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 19:10:06 +00:00
Alexei Starovoitov
4193093152 [bpf] add support for bpf pseudo instruction
Expose bpf pseudo load instruction via intrinsic. It is used by front-ends that
can encode file descriptors directly into IR instead of relying on relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 18:51:42 +00:00
Yaron Keren
2a9bbcbbad Remove superfluous .str() and replace std::string concatenation with Twine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 17:51:30 +00:00
Vladimir Sukharev
0c27224d25 [AArch64] Don't store available subtarget features in AArch64SysReg::SysRegMapper
Subtarget features must not be a part of the target machine. So, they are now not being stored in SysRegMapper, but provided each time fromString()/toString() are called

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8655


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 17:11:29 +00:00
Rafael Espindola
121eb4257d Close unique sections when switching away from them.
It is not possible to switch back to unique secitons, so close them
automatically when switching away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233380 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 15:01:40 +00:00
Derek Schuff
32b33c2c30 Use movw/movt instead of constant pool loads to lower byval parameter copies
Summary:
The ARM backend can use a loop to implement copying byval parameters before
a call. In non-thumb2 mode it uses a constant pool load to materialize the
trip count. For targets that need movt instead (e.g. Native Client), use
the same code as in thumb2 mode to materialize the trip count.

Reviewers: jfb, t.p.northover

Differential Revision: http://reviews.llvm.org/D8442

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 22:11:00 +00:00
Renato Golin
d6e2911a4f Adds an option to disable ARM ld/st optim pass
Enabled by default, but it's useful when debugging with llc.

Patch by Ranjeet Singh.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 18:38:04 +00:00
Vladimir Sukharev
c8a807c1c5 [ARM] Add v8.1a "Rounding Double Multiply Add/Subtract" extension
Reviewers: t.p.northover

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8503


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233301 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 18:29:02 +00:00
Vladimir Sukharev
ed11613334 [AArch64] Rename Pairs to Mappings in AArch64NamedImmMapper
Third element is to be added soon to "struct AArch64NamedImmMapper::Mapping". So its instances are renamed from ...Pairs to ...Mappings

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8582


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233300 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:57:39 +00:00
Vladimir Sukharev
05641295c3 [AArch64] Move initializations of AArch64NamedImmMapper out of void AArch64Operand::print(...)
class AArch64NamedImmMapper is to become dependent of SubTargetFeatures, while class AArch64Operand don't have access to the latter. 

So, AArch64NamedImmMapper constructor invocations are refactored away from methods of AArch64Operand.

Reviewers: jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8579


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233297 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:29:53 +00:00
Sanjay Patel
4ce65681f2 comment cleanup; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233293 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:18:17 +00:00
Benjamin Kramer
aa66f225d2 Remove outdated README-SSE.txt entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:12:16 +00:00
Benjamin Kramer
8f820e9495 InstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0
Anding and comparing with zero can be done in a single instruction on
most archs so this is a bit cheaper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:12:06 +00:00
Vladimir Sukharev
27d12f3e6e [AArch64, ARM] Add v8.1a architecture and generic cpu
New architecture and cpu added, following http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: t.p.northover

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8505


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 17:05:54 +00:00
Sanjay Patel
5de4af6195 Use SDValue bool checks; NFC intended
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 16:55:43 +00:00
Toma Tabacu
06a8dfd1ee [mips] Move the setATReg definition inside the MipsAssemblerOptions class. NFC.
Summary: This groups all of the MipsAssemblerOptions functionality together, making it more reader-friendly.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8445

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233271 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 13:08:55 +00:00
Andrea Di Biagio
971eb1b382 [X86][FastIsel] Teach how to select vector load instructions.
This patch teaches fast-isel how to select 128-bit vector load instructions.
Added test CodeGen/X86/fast-isel-vecload.ll

Differential Revision: http://reviews.llvm.org/D8605


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 11:29:02 +00:00
Eric Christopher
3a77909dae Add computeFSAdditions to the function based subtarget creation
for PPC due to some unfortunate default setting via TargetMachine
creation. I've added a FIXME on how this can be unraveled in the
backend and a test to make sure we successfully legalize 64-bit things
if we say we're 64-bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 00:50:23 +00:00
Nico Weber
7424d9321e Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233226 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 22:34:16 +00:00
Andrew Kaylor
5b99ebad2c Fix remaining MSVC warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233220 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 21:33:24 +00:00
Krzysztof Parzyszek
d6d4592ff0 Revert r233206
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233213 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 20:21:16 +00:00
Krzysztof Parzyszek
1ab309435a [Hexagon] Keep the bare getSubtargetImpl for now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 19:51:52 +00:00
Kit Barton
bd9a548881 Add Hardware Transactional Memory (HTM) Support
This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], but currently only the
'PowerPC HTM Low Level Built-in Function' are implemented.

The HTM instructions follows the RC ones and the transaction initiation result
is set on RC0 (with exception of tcheck). Currently approach is to create a
register copy from CR0 to GPR and comapring. Although this is suboptimal, since
the branch could be taken directly by comparing the CR0 value, it generates code
correctly on both test and branch and just return value. A possible future
optimization could be elimitate the MFCR instruction to branch directly.

The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.

This is send along a clang 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/D8247


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 19:36:23 +00:00
Sanjay Patel
e53dbeb2ad [X86, AVX] improve insertion into zero element of 256-bit vector
This patch allows AVX blend instructions to handle insertion into the low
element of a 256-bit vector for the appropriate data types.

For f32, instead of:

   vblendps	$1, %xmm1, %xmm0, %xmm1 ## xmm1 = xmm1[0],xmm0[1,2,3]
   vblendps	$15, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]

we get:

   vblendps	$1, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]

For f64, instead of:

   vmovsd	%xmm1, %xmm0, %xmm1     ## xmm1 = xmm1[0],xmm0[1]
   vblendpd	$3, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0,1],ymm0[2,3]

we get:

   vblendpd	$1, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0],ymm0[1,2,3]

For the hardware-neglected integer data types, I left a TODO comment in the
code and added regression tests for a follow-on patch.

Differential Revision: http://reviews.llvm.org/D8609



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233199 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 17:36:01 +00:00
Benjamin Kramer
eaf3cbd897 [APInt] Add an isSplat helper and use it in some places.
To complement getSplat. This is more general than the binary
decomposition method as it also handles non-pow2 splat sizes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233195 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 16:49:59 +00:00
Benjamin Kramer
17a29a4847 [Hexagon] Pattern match a CTZ loop into a call to countTrailingZeros.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 15:36:57 +00:00
Benjamin Kramer
4d09974cf3 [ARM] Rewrite .save/.vsave emission with bit math
Hopefully makes it a bit easier to understand what's going on.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233191 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 15:27:58 +00:00
Craig Topper
5238b7f47a [X86] Remove GetCpuIDAndInfo, GetCpuIDAndInfoEx and DetectFamilyModel functions from X86 MC layer. They haven't been used since CPU autodetection was removed from X86Subtarget.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233170 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25 04:16:50 +00:00
Reid Kleckner
d639e1975d X86: Fix frameescape when not using an FP
We can't use TargetFrameLowering::getFrameIndexOffset directly, because
Win64 really wants the offset from the stack pointer at the end of the
prologue. Instead, use X86FrameLowering::getFrameIndexOffsetFromSP(),
which is a pretty close approximiation of that. It fails to handle cases
with interestingly large stack alignments, which is pretty uncommon on
Win64 and is TODO.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233137 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 23:46:01 +00:00
Andrew Kaylor
1e4e27a7a6 Disabling warnings for MSVC build to enable /W4 use.
Differential Revision: http://reviews.llvm.org/D8572



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233133 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 23:37:10 +00:00
David Blaikie
4e933df738 Opaque Pointer Types: GEP API migrations to specify the gep type explicitly
The changes to InstCombine (& SCEV) do seem a bit silly - it doesn't make
anything obviously better to have the caller access the pointers element
type (the thing I'm trying to remove) than the GEP itself, but it's a
helpful migration step. This will allow me to more obviously lock down
GEP (& Load, etc) API usage, then fix all the code that accesses pointer
element types except the places that need to be removed (most of the
InstCombines) anyway - at which point I'll need to just remove all that
code because it won't be meaningful anymore (there will be no pointer
types, so no bitcasts to combine)

SCEV looks like it'll need some restructuring - we'll have to do a bit
more work for GEP canonicalization, since it'll depend on how it's used
if we can even manage to canonicalize it to a non-ugly GEP. I guess we
can do some fun stuff like voting (do 2 out of 3 load from the GEP with
a certain type that gives a pretty GEP? Does every typed use of the GEP
use either a specific type or a generic type (i8*, etc)?)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233131 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 23:34:31 +00:00
Peter Collingbourne
4b8dfba3a1 AArch64: use a different means to determine whether to byte swap relocations.
This code depended on a bug in the FindAssociatedSection function that would
cause it to return the wrong result for certain absolute expressions. Instead,
use EvaluateAsRelocatable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 21:47:03 +00:00
Sanjay Patel
fe76881930 [X86, AVX] recognize shufflevector with zero input as a vperm2 (PR22984)
vperm2x128 instructions have the special ability (aka free hardware capability)
to shuffle zero values into a vector.

This patch recognizes that type of shuffle and generates the appropriate
control byte.

https://llvm.org/bugs/show_bug.cgi?id=22984

Differential Revision: http://reviews.llvm.org/D8563



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233100 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 19:19:07 +00:00
David Blaikie
dcd8c45f20 Refactor: Simplify boolean expressions in AArch64 target
Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

Reviewed By: rengolin

Differential Revision: http://reviews.llvm.org/D8525

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233089 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 16:24:01 +00:00
Daniel Sanders
06426f54cb [mips] Support 16-bit offsets for 'm' inline assembly memory constraint.
Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8435

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 15:19:14 +00:00
Marek Olsak
63d8e012ca R600/SI: Insert more NOPs after READLANE on VI, don't use NOPs on CI
This is a candidate for stable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:38 +00:00
Marek Olsak
a2705bbd42 R600/SI: Select V_BFE_U32 for and+shift with a non-literal offset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:34 +00:00
Marek Olsak
226f794fba R600/SI: Custom-select 32-bit S_BFE from bitwise opcodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:27 +00:00
Marek Olsak
945fab3447 R600/SI: Improve BFM support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:21 +00:00
Marek Olsak
3f05a5e0ad R600/SI: Use V_FRACT_F64 for faster 64-bit floor on SI
Other f64 opcodes not supported on SI can be lowered in a similar way.

v2: use complex VOP3 patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:15 +00:00
Marek Olsak
91c066ae15 R600/SI: Expand fract to floor, then only select V_FRACT on CI
V_FRACT is buggy on SI.

R600-specific code is left intact.

v2: drop the multiclass, use complex VOP3 patterns

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 13:40:08 +00:00
Michael Kuperstein
765aab84d6 Revert "Use std::bitset for SubtargetFeatures"
This reverts commit r233055.

It still causes buildbot failures (gcc running out of memory on several platforms, and a self-host failure on arm), although less than the previous time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233068 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 12:56:59 +00:00
Simon Atanasyan
a1bcd75ddd [mips] Simplify boolean expressions in Mips target with clang-tidy
No functional changes.

Patch by Richard Thomson.

Differential Revision: http://reviews.llvm.org/D8522

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 12:24:56 +00:00
Daniel Sanders
b1058310c1 [mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint.
Summary:
Previous behaviour of 'R' and 'm' has been preserved for now. They will be
improved in subsequent commits.

The offset permitted by ZC varies according to the subtarget since it is
intended to match the restrictions of the pref, ll, and sc instructions.

The restrictions on these instructions are:
* For microMIPS: 12-bit signed offset.
* For Mips32r6/Mips64r6: 9-bit signed offset.
* Otherwise: 16-bit signed offset.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8414

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 11:26:34 +00:00
Michael Kuperstein
d3ab717935 Use std::bitset for SubtargetFeatures
Previously, subtarget features were a bitfield with the underlying type being uint64_t. 
Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset.
No functional change.

The first time this was committed (r229831), it caused several buildbot failures. 
At least some of the ARM ones were due to gcc/binutils issues, and should now be fixed.

Differential Revision: http://reviews.llvm.org/D8542

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-24 09:17:25 +00:00
Ahmed Bougacha
c9ad3ab624 [AArch64, ARM] Enable GlobalMerge with -O3 rather than -O1.
The pass used to be enabled by default with CodeGenOpt::Less (-O1).
This is too aggressive, considering the pass indiscriminately merges
all globals together.

Currently, performance doesn't always improve, and, on code that uses
few globals (e.g., the odd file- or function- static), more often than
not is degraded by the optimization.  Lengthy discussion can be found
on llvmdev (AArch64-focused;  ARM has similar problems):
  http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-February/082800.html
Also, it makes tooling and debuggers less useful when dealing with
globals and data sections.

GlobalMerge needs to better identify those cases that benefit, and this
will be done separately.  In the meantime, move the pass to run with
-O3 rather than -O1, on both ARM and AArch64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 21:17:36 +00:00
David Blaikie
6a4686f3f1 Refactor: Simplify boolean expressions in R600 target
Simplify boolean expressions with `true` and `false` using `clang-tidy`

Patch by Richard Thomson.

Differential Revision: http://reviews.llvm.org/D8520

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233020 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 20:56:44 +00:00
David Blaikie
3fb6269121 Refactor: Simplify boolean expressions in x86 target
Simplify boolean expressions with `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

Differential Revision: http://reviews.llvm.org/D8519

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233002 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 19:42:36 +00:00
Benjamin Kramer
1bfcd1f675 Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 19:32:43 +00:00
Matt Arsenault
a9da1cee40 R600/SI: Merge tables for commuting
Don't use a separate table for compares anymore,
and use the same VOP2_REV class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:41 +00:00
Matt Arsenault
16ef3632cf R600/SI: Only use one range of isCommutable for compares
Also don't count the class instructions as isCompare anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:38 +00:00
Matt Arsenault
88ed640930 R600/SI: Remove redundant unsetting of hasSideEffects
These are already set in the base class for the instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232990 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:36 +00:00
Matt Arsenault
7ec044c97b R600/SI: Move hasSideEffects setting into VOPCX classes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:35 +00:00
Matt Arsenault
59a5e979b5 R600/SI: Allow commuting compares
This enables very common cases to switch to the
smaller encoding.

All of the standard LLVM canonicalizations of comparisons
are the opposite of what we want. Compares with constants
are moved to the RHS, but the first operand can be an inline
immediate, literal constant, or SGPR using the 32-bit VOPC
encoding.

There are additional bad canonicalizations that should
also be fixed, such as canonicalizing ge x, k to gt x, (k + 1)
if this makes k no longer an inline immediate value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232988 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:30 +00:00
Matt Arsenault
b53594d1cb R600/SI: Use right class for cmpsx f64 instructions
Use VOPCX_F64 to not need the let Defs = [EXEC]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232987 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:23 +00:00
Matt Arsenault
3aaa5548e3 R600/SI: Remove cond operand to VOPCX classes
It isn't used, and these will probably never be directly selected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232986 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:45:20 +00:00
Benjamin Kramer
df93f4bb0b Purge unused includes throughout libSupport.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232976 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 18:07:13 +00:00
Chad Rosier
c1813d8fe1 [AArch64] Enable rematerialization of float 0 values.
Patch by Geoff Berry<gberry@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 17:19:34 +00:00
Bradley Smith
a75fecc370 Revert "[ARM] Add more pattern matching for f16 <-> f64 conversions"
This change is incorrect since it converts double rounding into single rounding,
which can produce different results. Instead this optimization will be done by
modifying Clang's codegen to not produce double rounding in the first place.

This reverts commit r232954.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232962 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 16:52:52 +00:00
Eli Bendersky
437c2863f0 Simplify boolean expressions with true and false using clang-tidy
Patch by Richard (legalize@xmission.com)

Differential Revision: http://reviews.llvm.org/D8521


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232961 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 16:26:23 +00:00
James Molloy
2f729838f1 [ARM] Remove target-specific ITOFP/FPTOI nodes
Anton tried this 5 years ago but it was reverted due to extra VMOVs
being emitted. This can be easily fixed with a liberal application
of patterns - matching loads/stores and extractelts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232958 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 16:15:16 +00:00
Tom Stellard
fd58f22744 R600/SI: Fix crash in SIInstrInfo::areLoadsFromSameBasePtr()
This function assumed that SMRD instructions always have immediate
offsets, which is not always the case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 16:06:01 +00:00
Colin LeMahieu
fdfad962a4 [Hexagon] Simplify boolean expression
Patch by Richard
http://reviews.llvm.org/D8523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232955 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 16:01:03 +00:00
Bradley Smith
de5be4657f [ARM] Add more pattern matching for f16 <-> f64 conversions
Specifically when the conversion is done in two steps, f16 -> f32 -> f64.

For example:

%1 = tail call float @llvm.convert.from.fp16.f32(i16 %0)
%conv = fpext float %1 to double

to:

vcvtb.f64.f16


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 15:59:54 +00:00
Benjamin Kramer
bd8e1b1dfe Move private classes into anonymous namespaces
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 12:30:58 +00:00
Petar Jovanovic
15863e5e5f Fix sign extension for MIPS64 in makeLibCall function
Fixing sign extension in makeLibCall for MIPS64. In MIPS64 architecture all
32 bit arguments (int, unsigned int, float 32 (soft float)) must be sign
extended. This fixes test "MultiSource/Applications/oggenc/".

Patch by Strahinja Petrovic.

Differential Revision: http://reviews.llvm.org/D7791


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 12:28:13 +00:00
Daniel Sanders
eb7e9ccad8 [aarch64] Distinguish the 'Q' and 'm' inline assembly memory constraints.
Summary:
But still handle them the same way since I don't know how they differ on
this target.

Clang also has code for 'Ump', 'Utf', 'Usa', and 'Ush' but calls
llvm_unreachable() on this code path so they are not converted to a
constraint id at the moment.

No functional change intended.

Reviewers: t.p.northover

Subscribers: aemerson, llvm-commits

Differential Revision: http://reviews.llvm.org/D8177


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232941 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-23 11:33:15 +00:00
David Majnemer
a36668c3f0 Silence a GCC warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232923 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-22 21:27:10 +00:00
Simon Pilgrim
3445d7bea0 Fixed MSVC compile warning issue introduced in r232837
- was reporting 'warning C4715: 'getType32' : not all control paths return a value'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232913 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-22 13:38:36 +00:00
Benjamin Kramer
fd48a80e14 [SimplifyLibCalls] Turn memchr(const, C, const) into a bitfield check.
strchr("123!", C) != nullptr is a common pattern to check if C is one
of 1, 2, 3 or !. If the largest element of the string is smaller than
the target's register size we can easily create a bitfield and just
do a simple test for set membership.

int foo(char C) { return strchr("123!", C) != nullptr; } now becomes

	cmpl	$64, %edi ## range check
	sbbb	%al, %al
	movabsq	$0xE000200000001, %rcx
	btq	%rdi, %rcx ## bit test
	sbbb	%cl, %cl
	andb	%al, %cl ## and the two conditions
	andb	$1, %cl
	movzbl	%cl, %eax ## returning an int
	ret

(imho the backend should expand this into a series of branches, but
that's a different story)

The code is currently limited to bit fields that fit in a register, so
usually 64 or 32 bits. Sadly, this misses anything using alpha chars
or {}. This could be fixed by just emitting a i128 bit field, but that
can generate really ugly code so we have to find a better way. To some
degree this is also recreating switch lowering logic, but we can't
simply emit a switch instruction and thus change the CFG within
instcombine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232902 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 21:09:33 +00:00
Eric Christopher
4638c99333 Remove the target independent TargetMachine::getSubtarget and
TargetMachine::getSubtargetImpl routines.

This keeps the target independent code free of bare subtarget
calls while the remainder of the backends are migrated, or not
if they don't wish to support per-function subtargets as would
be needed for function multiversioning or LTO of disparate
cpu subarchitecture types, e.g.

clang -msse4.2 -c foo.c -emit-llvm -o foo.bc
clang -c bar.c -emit-llvm -o bar.bc
llvm-link foo.bc bar.bc -o baz.bc
llc baz.bc

and get appropriate code for what the command lines requested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 04:22:23 +00:00
Eric Christopher
ae6fc14d54 Remove the bare getSubtargetImpl call from the AArch64 port. As part
of this add a test that shows we can generate code for functions
that specifically enable a subtarget feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232884 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 04:04:50 +00:00
Eric Christopher
bc473edd7b Remove the bare getSubtargetImpl call from the PPC port. As part
of this add a test that shows we can generate code with
for functions that differ by subtarget feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232882 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:36:02 +00:00
Eric Christopher
b793348a99 Grab a subtarget off of an AMDGPUTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232880 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:17:25 +00:00
Eric Christopher
6f125f52d3 Cache the Function dependent subtarget on the MachineFunction.
As preparation for removing the getSubtargetImpl() call from
TargetMachine go ahead and flip the switch on caching the function
dependent subtarget and remove the bare getSubtargetImpl call
from the X86 port. As part of this add a few tests that show we
can generate code and assemble on X86 based on features/cpu on
the Function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232879 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:13:10 +00:00
Eric Christopher
773e6614fb Grab the cached subtarget off of the MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232878 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:13:07 +00:00
Eric Christopher
fac8953a4f Grab a subtarget off of a MipsTargetMachine rather than a
bare target machine in preparation for the TargetMachine bare
getSubtarget/getSubtargetImpl calls going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232877 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:13:05 +00:00
Eric Christopher
1154706a62 Simplify the query for a subtarget in the NVPTX pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232876 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:13:03 +00:00
Eric Christopher
ba617ac1cc Change getISAEncoding to use the target triple to determine
thumb-ness similar to the rest of the Module level asm printing
infrastructure as debug info finalization happens after the function
may be missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232875 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 03:13:01 +00:00