18652 Commits

Author SHA1 Message Date
James Y Knight
ed5107d663 [Sparc] Don't overlap variable-sized allocas with other stack variables.
On SparcV8, it was previously the case that a variable-sized alloca
might overlap by 4-bytes the last fixed stack variable, effectively
because 92 (the number of bytes reserved for the register spill area) !=
96 (the offset added to SP for where to start a DYNAMIC_STACKALLOC).

It's not as simple as changing 96 to 92, because variables that should
be 8-byte aligned would then be misaligned.

For now, simply increase the allocation size by 8 bytes for each dynamic
allocation -- wastes space, but at least doesn't overlap. As the large
comment says, doing this more efficiently will require larger changes in
llvm.

Also adds some test cases showing that we continue to not support
dynamic stack allocation and over-alignment in the same function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 22:13:28 +00:00
Simon Pilgrim
d9bc309e9c [DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1)) combine for splatted vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 22:01:09 +00:00
Simon Pilgrim
908c768e1c [X86][SSE] Regenerated known-bits test with srem->urem fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285124 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:24:33 +00:00
Simon Pilgrim
b03ba30cbf [DAGCombiner] Enable srem(x.y) -> urem(x,y) combine for vectors
SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285123 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:20:18 +00:00
Simon Pilgrim
4864d89aff [X86][SSE] Added vector srem combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285121 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:14:11 +00:00
Simon Pilgrim
b4f0b6e6d3 [X86][SSE] Added vector urem combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285119 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:10:12 +00:00
Simon Pilgrim
baad275225 [DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors
SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285118 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:56:42 +00:00
Simon Pilgrim
09845fdead [X86][SSE] Added vector sdiv combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:25:47 +00:00
Evandro Menezes
9d6f1231e9 Add option to specify minimum number of entries for jump tables
Add an option to allow easier experimentation by target maintainers with the
minimum number of entries to create jump tables.  Also clarify the name of
the other existing option governing the creation of jump tables.

Differential revision: https://reviews.llvm.org/D25883

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:53:51 +00:00
Evandro Menezes
301f71ecd1 Switch lowering: improve partitioning of jump tables
When there's a tie between partitionings of jump tables, consider also cases
that result in no jump tables, but in one or a few cases.  The motivation is
that many contemporary processors typically perform case switches fairly
quickly.

Differential revision: https://reviews.llvm.org/D25212

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285099 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:11:43 +00:00
Dan Gohman
d29493db4e [WebAssembly] Add immediate fields to call_indirect and memory operators.
call_indirect, grow_memory, and current_memory now have immediate
operands in the 0xd binary encoding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:55:52 +00:00
Ulrich Weigand
2677f9fdf7 [SystemZ] Do not use LOC(G) for volatile loads
It is not safe to use LOAD ON CONDITION to implement access to a memory
location marked "volatile", since the architecture leaves it unspecified
whether or not an access happens if the condition is false.

The current code already appears to care about that:
  def LOC  : CondUnaryRSY<"loc",  0xEBF2, nonvolatile_load, GR32, 4>;

Unfortunately, that "nonvolatile_load" operator is simply ignored
by the CondUnaryRSY class, and there was no test to catch it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 15:39:15 +00:00
Simon Pilgrim
16ce778275 [X86][SSE] Add support for (V)PMOVSX* constant folding
We already have (V)PMOVZX* combining support, this is the beginning of handling (V)PMOVSX* similarly - other combines in combineVSZext can be generalized in future patches.

This unearthed an interesting bug in that we were generating illegal build vectors on 32-bit targets - it was proving difficult to create a test for it from PMOVZX, but it fired immediately with PMOVSX. I've created a more general form of the existing getConstVector to handle these cases - ideally this should be handled in non-target-specific code but I couldn't find an equivalent.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 14:29:25 +00:00
Zvi Rackover
3ed32c90ce [DAGCombine] Preserve shuffles when one of the vector operands is constant
Summary:
Do *not* perform combines such as:

    vector_shuffle<4,1,2,3>(build_vector(Ud, C0, C1 C2), scalar_to_vector(X))
    ->
    build_vector(X, C0, C1, C2)

Keeping the shuffle allows lowering the constant build_vector to a materialized
constant vector (such as a vector-load from the constant-pool or some other idiom).

Reviewers: delena, igorb, spatel, mkuper, andreadb, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 12:14:19 +00:00
Craig Topper
53bf46f680 [AVX-512] Add support for creating SIGN_EXTEND_VECTOR_INREG and ZERO_EXTEND_VECTOR_INREG for 512-bit vectors to support vpmovzxbq and vpmovsxbq.
Summary: The one tricky thing about this is that the sign/zero_extend_inreg uses v64i8 as an input type which isn't legal without BWI support. Though the vpmovsxbq and vpmovzxbq instructions themselves don't require BWI. To support this we need to add custom lowering for ZERO_EXTEND_VECTOR_INREG with v64i8 input. This can mostly reuse the existing sign extend code with a couple checks for sign extend vs zero extend added.

Reviewers: delena, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 04:00:29 +00:00
Simon Pilgrim
8d980444a4 [SelectionDAG] Update ComputeNumSignBits SRA/SHL handlers to accept scalar or vector splats
Use isConstOrConstSplat helper.

Also use APInt instead of getZExtValue directly to avoid out of range issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 21:47:19 +00:00
Sanjay Patel
ddbec7c447 [x86] add tests for {-1,0,1} select of constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285005 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 19:13:29 +00:00
Mandeep Singh Grang
b831a5dabd [llvm] Remove redundant --check-prefix=CHECK from tests
Reviewers: MatzeB, mcrosier, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 18:57:55 +00:00
Ehsan Amiri
300e976507 [PPC] Generate positive FP zero using xor insn instead of loading from constant area
https://reviews.llvm.org/D23614

Currently we load +0.0 from constant area. That can change to be generated using
XOR instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284995 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 17:31:09 +00:00
Eli Friedman
05c107461e Revert r284580+r284917. ("Synthesize TBB/TBH instructions")
The optimization has correctness issues, so reverting for now to fix tests
on thumb1 targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284993 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 17:20:50 +00:00
Evandro Menezes
6334b62e52 [AArch64] Optionally use the Newton series for reciprocal estimation
Add support for estimating the square root or its reciprocal and division or
reciprocal using the combiner generic Newton series.

Differential revision: https://reviews.llvm.org/D25291

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284986 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 16:14:58 +00:00
Ehsan Amiri
5ba8f14a10 [PPC] Better codegen for AND, ANY_EXT, SRL sequence
https://reviews.llvm.org/D24924

This improves the code generated for a sequence of AND, ANY_EXT, SRL instructions. This is a targetted fix for this special pattern. The pattern is generated by target independet dag combiner and so a more general fix may not be necessary. If we come across other similar cases, some ideas for handling it are discussed on the code review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284983 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 15:46:58 +00:00
Sanjay Patel
83768272ee [x86] regenerate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 15:43:40 +00:00
Nicolai Haehnle
e07033aa42 AMDGPU: Fix Two Address problems with v_movreld
Summary:
The v_movreld machine instruction is used with three operands that are
in a sense tied to each other (the explicit VGPR_32 def and the implicit
VGPR_NN def and use). There is no way to express that using the currently
available operand bits, and indeed there are cases where the Two Address
instructions pass does the wrong thing.

This patch introduces a new set of pseudo instructions that are identical
in intended semantics as v_movreld, but they only have two tied operands.

Having to add a new set of pseudo instructions is admittedly annoying, but
it's a fairly straightforward and solid approach. The only alternative I
see is to try to teach the Two Address instructions pass about Three Address
instructions, and I'm afraid that's trickier and is going to end up more
fragile.

Note that v_movrels does not suffer from this problem, and so this patch
does not touch it.

This fixes several GL45-CTS.shaders.indexing.* tests.

Reviewers: tstellarAMD, arsenm

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 14:56:02 +00:00
Craig Topper
bc9b41f1b1 [AVX-512] Remove masked pmin/pmax intrinsics and autoupgrade to native IR.
Clang patch to replace 512-bit vector and 64-bit element versions with native IR will follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284955 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 04:04:16 +00:00
Sanjay Patel
0800ef1513 [DAG] enhance computeKnownBits to handle SRL/SRA with vector splat constant
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284953 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-23 23:13:31 +00:00
Simon Pilgrim
ae8e401759 [X86][AVX512VL] Added support for combining target 256-bit shuffles to AVX512VL VPERMV3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 20:15:39 +00:00
Simon Pilgrim
d83c830dc4 [X86][AVX512] Added support for combining target shuffles to AVX512 VPERMV3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284921 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 19:53:59 +00:00
James Molloy
13608f305f [ARM] Fix crash in ConstantIslands
tPCRelJT may not be the first instruction in a block. Check that instead of dereferencing a broken iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284917 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 09:58:37 +00:00
Zvi Rackover
6fa81ba24f [X86] Apply the Update LLC Test Checks tool on the mmx-bitcast test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 07:15:00 +00:00
Craig Topper
061426e6a1 [X86] Add support for printing shuffle comments for VALIGN instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-22 06:51:56 +00:00
Sanjay Patel
1b0519f03d [x86] add test for missing vector SRA combine via computeKnownBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284896 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 23:02:31 +00:00
Tom Stellard
a0d7657789 AMDGPU/SI: Fix crash caused by r284267
Reviewers: arsenm, nhaehnle

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284875 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 20:25:11 +00:00
Sanjay Patel
8751486522 [DAG] enhance computeKnownBits to handle SHL with vector splat constant
Also, use APInt to avoid crashing on types larger than vNi64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284874 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 20:16:27 +00:00
Peter Collingbourne
7d77c5caa7 X86: Improve BT instruction selection for 64-bit values.
If a 64-bit value is tested against a bit which is known to be in the range
[0..31) (modulo 64), we can use the 32-bit BT instruction, which has a slightly
shorter encoding.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 19:57:55 +00:00
Simon Pilgrim
b859d6d852 [X86][AVX512BWVL] Added support for lowering v16i16 shuffles to AVX512BWVL vpermw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 19:54:38 +00:00
Simon Pilgrim
714d9ba4ef [X86][AVX512BWVL] Added support for combining target v16i16 shuffles to AVX512BWVL vpermw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 19:40:29 +00:00
Simon Pilgrim
fcb8cd9f1b [X86][AVX512] Added support for combining target shuffles to AVX512 vpermpd/vpermq/vpermps/vpermd/vpermw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284858 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 19:18:09 +00:00
Sanjay Patel
be29b1044e [DAG] fold negation of sign-bit
0 - X --> 0, if the sub is NUW
0 - X --> 0, if X is 0 or the minimum signed value and the sub is NSW
0 - X --> X, if X is 0 or the minimum signed value

This is the DAG equivalent of:
https://reviews.llvm.org/rL284649

plus the fold for the NUW case which already existed in InstSimplify.

Note that we miss a vector fold because of a deficiency in the DAG version of
computeKnownBits().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284844 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 17:24:26 +00:00
Sanjay Patel
7ff284e6ae [x86] add tests for potential negation folds
These are the backend equivalents for the tests added in r284627.
The patterns may emerge late, so we should have folds for these in the DAG too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 16:56:29 +00:00
Krzysztof Parzyszek
b77f18e769 [Hexagon] Handle spills of partially defined double vector registers
After register allocation it is possible to have a spill of a register
that is only partially defined. That in itself it fine, but creates a
problem for double vector registers. Stores of such registers are pseudo
instructions that are expanded into pairs of individual vector stores,
and in case of a partially defined source, one of the stores may use
an entirely undefined register. To avoid this, track the defined parts
and only generate actual stores for those.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 16:38:29 +00:00
Derek Schuff
dc833052ac [WebAssembly] Fix for 0xc call_indirect changes
Summary:
Need to reorder the operands to have the callee as the last argument.
Adds a pseudo-instruction, and a pass to lower it into a real
call_indirect.

This is the first of two options for how to fix the problem.

Reviewers: dschuff, sunfish

Subscribers: jfb, beanz, mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284840 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 16:38:07 +00:00
Simon Pilgrim
c2abd3ebe2 [X86][SSE] Regenerated sext/zext constant folding tests and added i686 tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 16:22:16 +00:00
Simon Pilgrim
51f1efc164 [X86][SSE] Regenerated chained pmovsx store tests and added i686 tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284833 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 15:51:24 +00:00
Sanjay Patel
f8de69b006 [DAG] use SDNode flags 'nsz' to enable fadd/fsub with zero folds
As discussed in D24815, let's start the process of killing off the broken fast-math global
state housed in TargetOptions and eliminate the need for function-level fast-math attributes.

Here we enable two similar folds that are possible when we don't care about signed-zero:
fadd nsz x, 0 --> x
fsub nsz 0, x --> -x

Note that although the test cases include a 'sin' function call, I'm side-stepping the 
FMF-on-calls question (and lack of support in the DAG) for now. It's not needed for these
tests - isNegatibleForFree/GetNegatedExpression just look through a ISD::FSIN node.

Also, when we create an FNEG node and propagate the Flags of the FSUB to it, this doesn't
actually do anything today because Flags are silently dropped for any node that is not a
binary operator.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284824 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 14:36:58 +00:00
Simon Pilgrim
01109e8b73 [X86][AVX512] Add mask/maskz writemask support to subvector broadcast shuffle decode comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284821 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 12:14:24 +00:00
Simon Pilgrim
4b5784c2cd [X86][AVX] Add 32-bit target tests for vector lzcnt/tzcnt to demonstrate missed folding opportunities
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284816 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 10:50:52 +00:00
Benjamin Kramer
02d2642a5d Fix WebAssembly test after r284757.
The change to MachineSink shuffles code around, disable it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 09:51:41 +00:00
Craig Topper
7413606415 [AVX-512] Add tests to show opportunities for commuting vpermi2/vpermt2 instructions.
Commuting will be added in a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284808 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-21 05:55:40 +00:00
Konstantin Zhuravlyov
e0e811c4ce [AMDGPU] Emit constant address space data in .rodata section and use relocations instead of fixups (amdhsa only)
Differential Revision: https://reviews.llvm.org/D25693


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284759 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 18:12:38 +00:00