97147 Commits

Author SHA1 Message Date
Craig Topper
d6e27240f3 [X86] Simplify control flow. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 18:43:21 +00:00
Craig Topper
4036e68fea [X86] Add a hasOneUse check to selectScalarSSELoad to keep the same load from being folded multiple times.
Summary: When selectScalarSSELoad is looking for a scalar_to_vector of a scalar load, it makes sure the load is only used by the scalar_to_vector. But it doesn't make sure the scalar_to_vector is only used once. This can cause the same load to be folded multiple times. This can be bad for performance. This also causes the chain output to be duplicated, but not connected to anything so chain dependencies will not be satisfied.

Reviewers: RKSimon, zvi, delena, spatel

Subscribers: andreadb, llvm-commits

Differential Revision: https://reviews.llvm.org/D26790

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287983 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 17:29:25 +00:00
Sanjay Patel
adc3b91add [InstCombine] don't drop metadata in FoldOpIntoSelect()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 15:23:20 +00:00
Sanjay Patel
572676fe52 add optional param to copy metadata when creating selects; NFC
There are other spots where we can use this; we're currently dropping 
metadata in some places, and there are proposed changes where we will
want to propagate metadata.

IRBuilder's CreateSelect() already has a parameter like this, so this
change makes the regular 'Create' API line up with that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287976 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 15:01:59 +00:00
Craig Topper
1c279fa9dd [AVX-512] Add unmasked EVEX vpmovzx/sx instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 08:21:52 +00:00
Craig Topper
d3611566cf [AVX-512] Add masked 128/256-bit integer add/sub instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287974 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 08:21:48 +00:00
Craig Topper
73b5f3ece9 [AVX-512] Add masked 512-bit integer add/sub instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287972 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 07:21:00 +00:00
Craig Topper
208b20033b [AVX-512] Teach LowerFormalArguments to use the extended register class when available. Fix the avx512vl stack folding tests to clobber more registers or otherwise they use xmm16 after this change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287971 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 07:20:57 +00:00
Craig Topper
3f93ecf433 [AVX-512] Add VLX versions of VDIVPD/PS and VMULPD/PS to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 07:20:53 +00:00
Tom Stellard
0bada48294 AMDGPU/SI: Use float as the operand type for amdgcn.interp intrinsics
Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

Differential Revision: https://reviews.llvm.org/D26724

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 02:26:04 +00:00
Craig Topper
24f3ff6091 [X86][XOP] Add a reversed reg/reg form for VPROT instructions.
The W bit distinquishes which operand is the memory operand. But if the mod bits are 3 then the memory operand is a register and there are two possible encodings. We already did this correctly for several other XOP instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287961 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 02:14:00 +00:00
Craig Topper
7f41923e8b [X86] Add SSE, AVX, and AVX2 version of MOVDQU to the load/store folding tables for consistency.
Not sure this is truly needed but we had the floating point equivalents, the aligned equivalents, and the EVEX equivalents. So this just makes it complete.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287960 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 02:13:58 +00:00
Craig Topper
089ef05ca6 [AVX-512] Put the AVX-512 sections of the load folding tables into mostly alphabetical order. This is consistent with the older sections of the table. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287956 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 23:21:34 +00:00
David Majnemer
6634682067 Replace some callers of setTailCall with setTailCallKind
We were a little sloppy with adding tailcall markers.  Be more
consistent by using setTailCallKind instead of setTailCall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 22:35:09 +00:00
Marek Olsak
2a24827c23 AMDGPU/SI: Add back reverted SGPR spilling code, but disable it
suggested as a better solution by Matt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 17:37:09 +00:00
Simon Pilgrim
a9e6de7c73 Use SDValue helpers instead of explicitly going via SDValue::getNode(). NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 17:25:21 +00:00
Simon Pilgrim
552822ce0c Use SDValue helper instead of explicitly going via SDValue::getNode(). NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 17:19:53 +00:00
Craig Topper
97ab1ab89a [AVX-512] Add support for changing VSHUFF64x2 to VSHUFF32x4 when its feeding a vselect with 32-bit element size.
Summary:
Shuffle lowering may have widened the element size of a i32 shuffle to i64 before selecting X86ISD::SHUF128. If this shuffle was used by a vselect this can prevent us from selecting masked operations.

This patch detects this and changes the element size to match the vselect.

I don't handle changing integer to floating point or vice versa as its not clear if its better to push such a bitcast to the inputs of the shuffle or to the user of the vselect. So I'm ignoring that case for now.

Reviewers: delena, zvi, RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27087

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287939 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:48:05 +00:00
Craig Topper
4baf78ff09 [AVX-512] Add VPERMT2* and VPERMI2* instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287937 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:33:53 +00:00
Marek Olsak
82bcf466c2 Revert "AMDGPU: Implement SGPR spilling with scalar stores"
This reverts commit 4404d0d6e354e80dd7f8f0a0e12d8ad809cf007e.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:34 +00:00
Marek Olsak
2d7b98b563 Revert "AMDGPU: Fix MMO when splitting spill"
This reverts commit 79d4f8b8b1ce430c3d5dac4fc72a9eebaed24fe1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:27 +00:00
Marek Olsak
dec75f5432 Revert "AMDGPU: Fix adding extra implicit def of register"
This reverts commit e834ce5976567575621901fb967b8018b9916d71.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:22 +00:00
Marek Olsak
47526ba32e Revert "AMDGPU: Fix not setting kill flag on temp reg when spilling"
This reverts commit 057bbbe4ae170247ba37f08f2e70ef185267d1bb.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:19 +00:00
Marek Olsak
2acdc08776 Revert "AMDGPU: Make m0 unallocatable"
This reverts commit 124ad83dae04514f943902446520c859adee0e96.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287932 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:15 +00:00
Marek Olsak
e2c9a9f4aa Revert "AMDGPU: Remove m0 spilling code"
This reverts commit f18de36554eb22416f8ba58e094e0272523a4301.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:06 +00:00
Marek Olsak
238ebfa19d Revert "AMDGPU: Preserve m0 value when spilling"
This reverts commit a5a179ffd94fd4136df461ec76fb30f04afa87ce.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287930 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 16:03:02 +00:00
Abhilash Bhandari
a14bdf2ab4 [Loop Unswitch] Patch to selective unswitch only the reachable branch instructions.
Summary:
The iterative algorithm for Loop Unswitching may render some of the branches unreachable in the unswitched loops.
Given the exponential nature of the algorithm, this is quite an overhead.
This patch fixes this problem by selectively unswitching only those branches within a loop that are reachable from the loop header.

Reviewers: Michael Zolothukin, Anna Thomas, Weiming Zhao.
Subscribers: llvm-commits.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287925 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 14:07:44 +00:00
Simon Dardis
f5ba24d071 [mips] Correct jal expansion for local symbols in .local directives.
This patch corrects the behaviour of code such as:

   .local foo
   jal foo
foo:
to use the correct jal expansion when writing ELF files.

Patch by: Daniel Sanders

Reviewers: zoran.jovanovic, seanbruno, vkalintiris

Differential Revision: https://reviews.llvm.org/D24722



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287918 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 11:06:43 +00:00
Craig Topper
3f9deb738c [X86] Invert an 'if' and early out to fix a weird indentation. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 02:29:24 +00:00
Craig Topper
78c076a97b [X86] Size a SmallVector to the worst case mask size for a 512-bit shuffle. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287908 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 02:29:21 +00:00
Craig Topper
670c05a5b2 [DAGCombine] Teach DAG combine that if both inputs of a vselect are the same, then the condition doesn't matter and the vselect can be removed.
Selects with scalar condition already handle this correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 21:48:52 +00:00
Serge Rogatch
ef5c24c358 Test commit access.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 18:51:47 +00:00
Simon Pilgrim
a1807de6bc Fix unused variable warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287889 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 15:24:47 +00:00
Benjamin Kramer
452417f3fd [X86] Don't round trip a unique_ptr through a raw pointer for assignment.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287888 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 15:17:39 +00:00
Simon Pilgrim
911bcb3c53 [X86][SSE] Improve UINT_TO_FP v2i32 -> v2f64
Vectorize UINT_TO_FP v2i32 -> v2f64 instead of scalarization (albeit still on the SIMD unit).

The codegen matches that generated by legalization (and is in fact used by AVX for UINT_TO_FP v4i32 -> v4f64), but has to be done in the x86 backend to account for legalization via 4i32.

Differential Revision: https://reviews.llvm.org/D26938

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287886 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 15:12:56 +00:00
Simon Pilgrim
5d31f856ab [X86][AVX512] Add support for v2i64 fptosi/fptoui/sitofp/uitofp on AVX512DQ-only targets
Use 512-bit instructions with subvector insertion/extraction like we do in a number of similar circumstances

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 14:46:55 +00:00
Simon Pilgrim
1a88fd21d5 [X86][AVX512DQVL] Add awareness of vcvtqq2ps and vcvtuqq2ps implicit zeroing of upper 64-bits of xmm result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287878 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 14:02:30 +00:00
Simon Pilgrim
ac42cfa241 [X86][AVX512DQVL] Add support for v2i64 -> v2f32 SINT_TO_FP/UINT_TO_FP lowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287877 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 13:38:59 +00:00
Nikolai Bozhenov
242e374435 [x86] Fixing PR28755 by precomputing the address used in CMPXCHG8B
The bug arises during register allocation on i686 for
CMPXCHG8B instruction when base pointer is needed. CMPXCHG8B
needs 4 implicit registers (EAX, EBX, ECX, EDX) and a memory address,
plus ESI is reserved as the base pointer. With such constraints the only
way register allocator would do its job successfully is when the addressing
mode of the instruction requires only one register. If that is not the case
- we are emitting additional LEA instruction to compute the address.

It fixes PR28755.

Patch by Alexander Ivchenko <alexander.ivchenko@intel.com>

Differential Revision: https://reviews.llvm.org/D25088


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287875 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 13:23:35 +00:00
Nikolai Bozhenov
8ac75a18fc [x86] Minor refactoring of X86TargetLowering::EmitInstrWithCustomInserter
Move the definitions of three variables out of the switch.

Patch by Alexander Ivchenko <alexander.ivchenko@intel.com>

Differential Revision: https://reviews.llvm.org/D25192


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 13:15:49 +00:00
Nikolai Bozhenov
5f72eeb850 [x86] Rewrite getAddressFromInstr helper function
- It does not modify the input instruction
- Second operand of any address is always an Index Register,
  make sure we actually check for that, instead of a check for
  an immediate value

Patch by Alexander Ivchenko <alexander.ivchenko@intel.com>

Differential Revision: https://reviews.llvm.org/D24938


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287873 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 13:05:43 +00:00
Simon Pilgrim
846003aeb4 [X86] Generalize CVTTPD2DQ/CVTTPD2UDQ and CVTDQ2PD/CVTUDQ2PD opcodes. NFCI
Replace the CVTTPD2DQ/CVTTPD2UDQ and CVTDQ2PD/CVTUDQ2PD opcodes with general versions.

This is an initial step towards similar FP_TO_SINT/FP_TO_UINT and SINT_TO_FP/UINT_TO_FP lowering to AVX512 CVTTPS2QQ/CVTTPS2UQQ and CVTQQ2PS/CVTUQQ2PS with illegal types.

Differential Revision: https://reviews.llvm.org/D27072

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287870 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 12:13:46 +00:00
Peter Collingbourne
045ffc4b32 Object: Add IRObjectFile::getTargetTriple().
This lets us remove a use of IRObjectFile::getModule() in llvm-nm.

Differential Revision: https://reviews.llvm.org/D27074

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287846 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 01:13:09 +00:00
Peter Collingbourne
4384b55c02 Object: Simplify the IRObjectFile symbol iterator implementation.
Change the IRObjectFile symbol iterator to be a pointer into a vector of
PointerUnions representing either IR symbols or asm symbols.

This change is in preparation for a future change for supporting multiple
modules in an IRObjectFile. Although it causes an increase in memory
consumption, we can deal with that issue separately by introducing a bitcode
symbol table.

Differential Revision: https://reviews.llvm.org/D26928

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287845 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:41:05 +00:00
Matt Arsenault
a5a179ffd9 AMDGPU: Preserve m0 value when spilling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:26:50 +00:00
Matt Arsenault
1cb6ce6960 TRI: Add hook to pass scavenger during frame elimination
The scavenger was not passed if requiresFrameIndexScavenging was
enabled. I need to be able to test for the availability of an
unallocatable register here, so I can't create a virtual register for
it.

It might be better to just always use the scavenger and stop
creating virtual registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:26:47 +00:00
Matt Arsenault
f18de36554 AMDGPU: Remove m0 spilling code
Since m0 isn't allocatable it should never be spilled anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:26:44 +00:00
Matt Arsenault
124ad83dae AMDGPU: Make m0 unallocatable
m0 may need to be written for spill code, so
we don't want general code uses relying on the
value stored in it.

This introduces a few code quality regressions where copies
from m0 are not coalesced into copies of a copy of m0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:26:40 +00:00
Davide Italiano
6c4098223f [lib/LTO] Rename few instances of Lto to LTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 00:23:09 +00:00
Greg Clayton
56037652a8 Rely on a single DWARF version instead of having two copies
This patch makes AsmPrinter less reliant on DwarfDebug by relying on the DWARF version in the AsmPrinter's MCStreamer's MCContext. This allows us to remove the redundant DWARF version from DwarfDebug. It also lets us change code that used to access the AsmPrinter's DwarfDebug just to get to the DWARF version by changing the DWARF version accessor on AsmPrinter so that it grabs the version from its MCStreamer's MCContext.

Differential Revision: https://reviews.llvm.org/D27032


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 23:30:37 +00:00