14578 Commits

Author SHA1 Message Date
Evgeniy Stepanov
23c98ecd0f Disable TLS for stack protector on Android API<17.
The TLS slot did not exist back then.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23 21:06:35 +00:00
Ayman Musa
6f30b9797e [X86][AVX] Disable VCVTSS2SD & VCVTSD2SS memory folding and fix the register class of their first input when creating node in fast-isel.
(Quick fix to buildbot failure after rL295940 commit).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23 13:15:44 +00:00
Ayman Musa
ff35eecd7d [X86][AVX512] Remove VCVTSS2SDZ & VCVTSD2SSZ from memory folding tables as they introduce new read dependency when folding.
(Quick fix to buildbot fail). 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23 08:13:36 +00:00
Ayman Musa
70ad23eba8 [X86][AVX512] Change VCVTSS2SD and VCVTSD2SS node types to keep consistency between VEX/EVEX versions.
AVX versions of the converts work on f32/f64 types, while AVX512 version work on vectors.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295940 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23 07:24:21 +00:00
Simon Pilgrim
458f2a48cd [X86][SSE] getTargetConstantBitsFromNode - insert constant bits directly into masks.
Minor optimization, don't create temporary mask APInts that are just going to be OR'd into the accumulate masks - insert directly instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 15:38:13 +00:00
Simon Pilgrim
5eef3502f8 [X86][SSE] Use APInt::getBitsSet() instead of APInt::getLowBitsSet().shl() separately. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295845 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 15:04:55 +00:00
Benjamin Kramer
8218b76114 [GlobalISel] Fix compiler warnings and make assert assert something.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295827 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 12:59:47 +00:00
Igor Breger
8ae3570fa8 [X86][GlobalISel] Initial implementation , select G_ADD gpr, gpr
Summary: Initial implementation for X86InstructionSelector. Handle selection COPY and G_ADD/G_SUB gpr, gpr .

Reviewers: qcolombet, rovka, zvi, ab

Reviewed By: rovka

Subscribers: mgorny, dberris, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 12:25:09 +00:00
Ayman Musa
7f45e918f8 [X86] Fix memory operands definition for some instructions.
Change integer memory operands to FP memory operands to some FP instructions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 08:06:29 +00:00
Craig Topper
544076881b [AVX-512] Allow legacy scalar min/max intrinsics to select EVEX instructions when available
This patch introduces new X86ISD::FMAXS and X86ISD::FMINS opcodes. The legacy intrinsics now lower to this node. As do the AVX-512 masked intrinsics when the rounding mode is CUR_DIRECTION.

I've merged a copy of the tablegen multiclass avx512_fp_scalar into avx512_fp_scalar_sae. avx512_fp_scalar still needs to support CUR_DIRECTION appearing as a rounding mode for X86ISD::FADD_ROUND and others.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295810 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 06:54:18 +00:00
Evandro Menezes
450fce7072 [AArch64, X86] Add statistics for the MacroFusion pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 22:16:13 +00:00
Evandro Menezes
6a905f67f6 [AArch64, X86] Guard against both instrs being wild cards
If both instrs are wild cards, the result can be a crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295776 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 22:16:11 +00:00
Geoff Berry
fc170d8f5d [CodeGenPrepare] Sink and duplicate more 'and' instructions.
Summary:
Rework the code that was sinking/duplicating (icmp and, 0) sequences
into blocks where they were being used by conditional branches to form
more tbz instructions on AArch64.  The new code is more general in that
it just looks for 'and's that have all icmp 0's as users, with a target
hook used to select which subset of 'and' instructions to consider.
This change also enables 'and' sinking for X86, where it is more widely
beneficial than on AArch64.

The 'and' sinking/duplicating code is moved into the optimizeInst phase
of CodeGenPrepare, where it can take advantage of the fact the
OptimizeCmpExpression has already sunk/duplicated any icmps into the
blocks where they are used.  One minor complication from this change is
that optimizeLoadExt needed to be updated to always mark 'and's it has
determined should be in the same block as their feeding load in the
InsertedInsts set to avoid an infinite loop of hoisting and sinking the
same 'and'.

This change fixes a regression on X86 in the tsan runtime caused by
moving GVNHoist to a later place in the optimization pipeline (see
PR31382).

Reviewers: t.p.northover, qcolombet, MatzeB

Subscribers: aemerson, mcrosier, sebpop, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295746 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 18:53:14 +00:00
Simon Pilgrim
2ffda75993 [X86] EltsFromConsecutiveLoads SDLoc argument should be const&.
There appears never to have been a time that the reference was updated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295739 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 17:42:28 +00:00
Simon Pilgrim
3f5e9f4627 [X86][AVX2] Fix VPBROADCASTQ folding on 32-bit targets.
As i64 isn't a value type on 32-bit targets, we need to fold the VZEXT_LOAD into VPBROADCASTQ.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295733 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 16:41:44 +00:00
Simon Pilgrim
d14347a186 [X86][SSE] Prefer to combine shuffles to VZEXT over VZEXT_MOVL.
This matches what is already done during shuffle lowering and helps prevent the need for a zero-vector in cases where shuffles match both patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295723 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 15:09:00 +00:00
Igor Breger
253f60a6d8 [AVX512] Fix EXTRACT_VECTOR_ELT for v2i1/v4i1/v32i1/v64i1 with variable index.
Differential Revision: https://reviews.llvm.org/D30189



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295718 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 14:01:25 +00:00
Craig Topper
02e45aadbe [X86] Use SHLD with both inputs from the same register to implement rotate on Sandy Bridge and later Intel CPUs
Summary:
Sandy Bridge and later CPUs have better throughput using a SHLD to implement rotate versus the normal rotate instructions. Additionally it saves one uop and avoids a partial flag update dependency.

This patch implements this change on any Sandy Bridge or later processor without BMI2 instructions. With BMI2 we will use RORX as we currently do.

Reviewers: zvi

Reviewed By: zvi

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295697 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 06:39:13 +00:00
Craig Topper
97823bb7e5 [X86] Fix formatting. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295695 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 06:27:13 +00:00
Craig Topper
4d13821a7e [AVX-512] Use sse_load_f32/f64 in place of scalar_to_vector and scalar load in some patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295693 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 04:26:10 +00:00
Craig Topper
962f06c537 [AVX-512] Fix the ExeDomain for vcmpss/vcmpsd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295691 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 04:26:04 +00:00
Sanjoy Das
81f0f4690c Add a wrapper around copy_if in STLExtras; NFC
I will add one more use for this in a later change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-21 00:38:44 +00:00
Craig Topper
cce48e320d [AVX-512] Add a few more patterns for selecting masked vpternlog with broadcast loads where the passthru operand is not operand 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 17:44:09 +00:00
Simon Pilgrim
c8319a4345 [X86] Tidyup combineExtractVectorElt. NFCI.
Pull out repeated code for extraction index operand and source vector value type.

Use isNullConstant helper to check for zero extraction index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 16:09:45 +00:00
Igor Breger
05a06cba9e [X86] Fix EXTRACT_VECTOR_ELT with variable index from v32i16 and v64i8 vector.
Its more profitable to go through memory (1 cycles throughput)
than using VMOVD + VPERMV/PSHUFB sequence ( 2/3 cycles throughput) to implement EXTRACT_VECTOR_ELT with variable index.
IACA tool was used to get performace estimation (https://software.intel.com/en-us/articles/intel-architecture-code-analyzer)
For example for var_shuffle_v16i8_v16i8_xxxxxxxxxxxxxxxx_i8 test from vector-shuffle-variable-128.ll I get 26 cycles vs 79 cycles. 
Removing the VINSERT node, we don't need it any more.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295660 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 14:16:29 +00:00
Simon Pilgrim
03eb1209fc [X86][AVX512] Add support for ASHR v2i64/v4i64 support without VLX
Use v8i64 ASHR instructions if we don't have VLX.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 12:16:38 +00:00
Ayman Musa
5cb227868c [X86][AVX] Extend hasVEX_WPrefix bit to accept WIG value (W Ignore) + update all AVX instructions with the new value.
Add WIG value to all of AVX instructions which ignore the W-bit in their encoding, instead of giving them the default value of 0.
This patch is needed for a follow up work on EVEX2VEX pass (replacing EVEX encoded instructions with their corresponding VEX version when possible).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295643 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 08:27:54 +00:00
Craig Topper
43e46dfa9b [AVX-512] Add more patterns to fold masked VPTERNLOG with load when the passthru isn't operand 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295640 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 07:00:40 +00:00
Craig Topper
415a83febd [AVX-512] Fix mistake in the immediate swizzle for some of the VPTERNLOG patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295638 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 07:00:34 +00:00
Craig Topper
5686a0d2ba [AVX-512] Add more VPTERNLOG patterns to enable folding of broadcast loads that aren't in operand 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 02:47:42 +00:00
Craig Topper
ffea086747 [X86] Use memory form of shift right by 1 when the rotl immediate is one less than the operation size.
An earlier commit already did this for the register form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295626 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-20 00:37:23 +00:00
Craig Topper
87f9fa42d5 [AVX-512] Remove AddedComplexity from masked operations. The size of the patterns already increases their priority.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295619 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 21:44:35 +00:00
Simon Pilgrim
f042c820ef [X86] Use peekThroughOneUseBitcasts helper. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 21:40:51 +00:00
Davide Italiano
a228221b86 [X86] Prefer static_cast<> to C-style cast. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 21:35:41 +00:00
Craig Topper
97295ca181 [AVX-512] Disable peephole optimizations on the VPTERNLOG commute test. Add new patterns to enable isel to fold the loads on it own.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295616 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 21:32:15 +00:00
Simon Pilgrim
f8d4b524dd [X86][SSE] Use getTargetConstantBitsFromNode to find zeroable shuffle elements.
Replaces existing approach that could only search BUILD_VECTOR nodes.

Requires getTargetConstantBitsFromNode to discriminate cases with all/partial UNDEF bits in each element - this should also be useful when we get around to supporting getTargetShuffleMaskIndices with UNDEF elements. 

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 19:40:31 +00:00
Craig Topper
07a0236401 [AVX-512] Add patterns to recognize masked vpternlog when the passthrough operand is not operand 0.
This uses a SDNodeXForm to swizzle the appropriate immediate bits to allow this to be matched.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 19:36:58 +00:00
Simon Pilgrim
0c9c0d47aa [X86][SSE] Enable initial support for domain crossing at high shuffle combine depths.
As discussed on D27692, this permits another domain to be used to combine a shuffle at high depths.

We currently set the required depth at 4 or more combined shuffles, this is probably too high for most targets but is a good starting point and already helps avoid a number of costly variable shuffles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 17:19:38 +00:00
Simon Pilgrim
7754c0ada2 [X86][SSE] Generalize INSERTPS/SHUFPS/SHUFPD combines across domains.
Relax the INSERTPS/SHUFPS/SHUFPD combines to support integer inputs if permitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295606 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 15:15:40 +00:00
Simon Pilgrim
395e4206ab [X86][SSE] Add domain crossing support for target shuffle combines.
Add the infrastructure to flag whether float and/or int domains are permitable.

A future patch will enable domain crossing based off shuffle depth and the value types of the source vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295604 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 14:12:25 +00:00
Craig Topper
9ca276657a [AVX-512] Add broadcast VPTERNLOG instructions to special case commuting switch.
The instructions are marked commutable, but without special handling we don't get the immediate correct.

While here also remove the masked memory forms that aren't commutable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 08:03:26 +00:00
Craig Topper
9981ab3f2d [X86] Remove patterns for MOVSD with v4i32 types. We don't appear to really need them and if we do we should just use a bitcast to a 64-bit element type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295589 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 02:08:48 +00:00
Craig Topper
f5547b3497 [X86] Tighten up some of the SDNode type constraints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295588 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 01:54:47 +00:00
Simon Pilgrim
56f5f0cf29 [X86] Fix enumeral/non-enumeral conditional expression warning.
gcc only allows you to mix enums / ints if they have the same signedness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295586 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 00:04:30 +00:00
Simon Pilgrim
a21a4863ea Fix signed/unsigned comparison warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295580 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 22:56:17 +00:00
Craig Topper
4deede4ddb [X86][XOP] Reduce the size of a multiclass by moving more stuff to parameters instead of doing 128-bit and 256-bit simultaneously.
This requires some instructions to be renamed to move the Y earlier in the instruction name. The new names are more consistent with other instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295579 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 22:53:43 +00:00
Simon Pilgrim
5ff0a24f6e [X86] Fix enumeral/non-enumeral comparison warning.
gcc only allows you to mix enums / ints if they have the same signedness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295576 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 22:40:58 +00:00
Simon Pilgrim
f9e2c1f957 [X86][SSE] Avoid repeated calls to SDValue::getValueType.
Added assertion to check input type of X86ISD::VZEXT during target known bits calculation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 22:25:27 +00:00
Craig Topper
58ee25f913 Recommit "[X86] Remove XOP VPCMOV intrinsics and autoupgrade them to native IR."
Clang has now been fixed to not use these intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295571 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 21:50:58 +00:00
Sanjay Patel
4c507d5052 [x86] fold sext (xor Bool, -1) --> sub (zext Bool), 1
This is the same transform that is current used for:
select Bool, 0, -1



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295568 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 21:03:28 +00:00