Commit Graph

19239 Commits

Author SHA1 Message Date
Geoff Berry 5d534b6a11 [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

llvm-svn: 295746
2017-02-21 18:53:14 +00:00
Simon Pilgrim 5afda30930 [X86][AVX512] Update VPBROADCASTQ test to combine from VPERMQ instead of VPERMI2Q.
VPERMI2Q doesn't have shuffle decoding from re-materializable constants.

llvm-svn: 295736
2017-02-21 17:04:11 +00:00
Simon Pilgrim f321ab6dd2 [X86][AVX] Rename shuffle combine tests to show combined shuffle type. NFCI.
llvm-svn: 295735
2017-02-21 16:45:31 +00:00
Simon Pilgrim 791955819c [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.

llvm-svn: 295733
2017-02-21 16:41:44 +00:00
Simon Pilgrim f98a32fa7f [X86][AVX2] Add AVX512 test targets to AVX2 shuffle combines.
llvm-svn: 295731
2017-02-21 16:29:28 +00:00
Simon Pilgrim 4cc6dd0cf6 [X86][AVX] Add tests showing missed VPBROADCASTQ folding on 32-bit targets.
As i64 isn't a value type on 32-bit targets, we fail to fold the VZEXT_LOAD into VPBROADCASTQ.

Also shows that we're not decoding VPERMIV3 shuffles very well....

llvm-svn: 295729
2017-02-21 16:05:35 +00:00
Simon Pilgrim 3546156122 [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.

llvm-svn: 295723
2017-02-21 15:09:00 +00:00
Simon Pilgrim 0c094f504c [X86][SSE] Added SSE41 shuffle combining test file.
Currently just contains one case where we combine to VZEXT_MOVL instead of VZEXT which would avoid the need for a zero vector to be generated

llvm-svn: 295721
2017-02-21 14:51:15 +00:00
Igor Breger 812f319794 [AVX512] Fix EXTRACT_VECTOR_ELT for v2i1/v4i1/v32i1/v64i1 with variable index.
Differential Revision: https://reviews.llvm.org/D30189

llvm-svn: 295718
2017-02-21 14:01:25 +00:00
Diana Picus 613b65696a [ARM] GlobalISel: Lower calls to void() functions
For now, we hardcode a BLX instruction, and generate an ADJCALLSTACKDOWN/UP pair
with amount 0.

llvm-svn: 295716
2017-02-21 11:33:59 +00:00
Craig Topper fe78d95a49 [X86] Remove ssse3 intrinsic tests from the avx intrinsics test file.
They are all covered by the SSSE3 intrinsics test with SSSE3, AVX, and AVX512 command lines.

llvm-svn: 295708
2017-02-21 08:06:08 +00:00
Craig Topper 55e2de869d [X86] Remove sse4.2 intrinsic tests from the avx intrinsics test file. Fix some other consistency issues.
They are all covered by the SSE4.2 intrinsics test with SSE4.2, AVX, and AVX512 command lines.

Merge sse42.ll into the other intrinsics test. Rename sse42_64.ll to be named like other intrinsic tests.

llvm-svn: 295707
2017-02-21 08:06:05 +00:00
Craig Topper 25191b4ac3 [X86] Remove sse4.1 intrinsic tests from the avx intrinsics test file.
They are all covered by the SSE4.1 intrinsics test with SSE4.1, AVX, and AVX512 command lines.

llvm-svn: 295706
2017-02-21 08:06:02 +00:00
Craig Topper da8e6f1337 [X86] Remove sse3 intrinsic tests from the avx intrinsics test file.
They are all covered by the SSE3 intrinsics test with SSE2, AVX, and AVX512 command lines.

llvm-svn: 295705
2017-02-21 08:05:59 +00:00
Craig Topper 002549b8be [X86] Remove aes intrinsic tests from the avx intrinsics test file.
They are all covered by the AES intrinsics test with a legacy command line and an AVX command line.

llvm-svn: 295702
2017-02-21 07:32:18 +00:00
Craig Topper 2a71fd95e8 [X86] Add an AVX command line and regenerate AES intrinsics test using the update_llc_test_checks.py
llvm-svn: 295701
2017-02-21 07:32:14 +00:00
Craig Topper dbf6f367e9 [X86] Remove sse2 intrinsic tests from the avx intrinsics test file.
They are all covered by the SSE2 intrinsics test with SSE2, AVX, and AVX512 command lines.

Also remove an unneeded lfence intrinsic test since it was already covered.

llvm-svn: 295700
2017-02-21 07:32:11 +00:00
Craig Topper 0d47fdcf3f [X86] Remove sse1 intrinsic tests from the avx intrinsics test file.
They are all covered by the SSE intrinsics test with SSE, AVX, and AVX512 command lines.

Also remove an unneeded sfence intrinsic test since it was already covered.

llvm-svn: 295699
2017-02-21 07:32:03 +00:00
Craig Topper d88389aa7e [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

llvm-svn: 295697
2017-02-21 06:39:13 +00:00
Craig Topper d9fe664868 [AVX-512] Use sse_load_f32/f64 in place of scalar_to_vector and scalar load in some patterns.
llvm-svn: 295693
2017-02-21 04:26:10 +00:00
Craig Topper 63b7d71844 [AVX-512] Add test cases showing failure to fold zero extending scalar loads in scalar intrinsics without the peephole pass.
llvm-svn: 295692
2017-02-21 04:26:07 +00:00
Taewook Oh 4cf5c1087c [BranchFolding] Update debug location along with the update of branch instruction.
Summary:
Currently, BranchFolder drops DebugLoc for branch instructions in some places. For example, for the test code attached, the branch instruction of 'entry' block has a DILocation of

```
!12 = !DILocation(line: 6, column: 3, scope: !11)
```

, but this information is gone when then block is lowered because BranchFolder misses it. This patch is a fix for this issue.

Reviewers: qcolombet, aprantl, craig.topper, MatzeB

Reviewed By: aprantl

Subscribers: llvm-commits

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

llvm-svn: 295684
2017-02-21 00:12:38 +00:00
Craig Topper e8beaff021 [X86] Add additonal check lines to one of the rotate tests.
llvm-svn: 295682
2017-02-20 23:38:51 +00:00
Craig Topper a80f90e66b [X86] FileCheckize one of the rotate tests.
llvm-svn: 295681
2017-02-20 23:38:48 +00:00
Craig Topper bb10c0f1ec [X86] FileCheckize one of the rotate tests.
llvm-svn: 295676
2017-02-20 19:44:10 +00:00
Craig Topper 2012dda9a0 [AVX-512] Add a few more patterns for selecting masked vpternlog with broadcast loads where the passthru operand is not operand 0.
llvm-svn: 295673
2017-02-20 17:44:09 +00:00
Simon Pilgrim e9a8145adb [X86][SSE] Regenerate extracted bitcasted constant tests and add 32-bit test target
llvm-svn: 295669
2017-02-20 15:57:14 +00:00
Simon Pilgrim 72d666e443 [X86][SSE] Regenerate re-materialized store tests and add 64-bit test target
llvm-svn: 295666
2017-02-20 15:20:37 +00:00
Simon Pilgrim 5a33d1c266 [X86][SSE] Regenerate vselect widening tests and add 32-bit test target
llvm-svn: 295665
2017-02-20 15:16:43 +00:00
Igor Breger fda32d266a [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

llvm-svn: 295660
2017-02-20 14:16:29 +00:00
Simon Pilgrim 5910ebe720 [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

llvm-svn: 295656
2017-02-20 12:16:38 +00:00
Sanne Wouda 47eb9723de [ARM] Add a div regression test for Cortex-M23
Summary:
This file was missed in the commit for Cortex-M23 and Cortex-M33
support.  See https://reviews.llvm.org/D29073?id=85814 .

Reviewers: rengolin, javed.absar, samparker

Reviewed By: samparker

Subscribers: llvm-commits, aemerson

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

llvm-svn: 295655
2017-02-20 12:05:07 +00:00
Simon Pilgrim 50b958c07a [SelectionDAG] Add scalarization support for ISD::*_EXTEND_VECTOR_INREG opcodes.
Thanks to Mikael Holmén for the initial test case

llvm-svn: 295652
2017-02-20 11:55:58 +00:00
Craig Topper c6c68f5958 [AVX-512] Add more patterns to fold masked VPTERNLOG with load when the passthru isn't operand 0.
llvm-svn: 295640
2017-02-20 07:00:40 +00:00
Craig Topper 5aef828ba7 [AVX-512] Add tests for missed opportunities to fold masked VPTERNLOG with load when the passthru op isn't operand 0.
llvm-svn: 295639
2017-02-20 07:00:37 +00:00
Craig Topper a5fa2e40f9 [AVX-512] Fix mistake in the immediate swizzle for some of the VPTERNLOG patterns.
llvm-svn: 295638
2017-02-20 07:00:34 +00:00
Craig Topper cb5b45cc36 [AVX-512] Use a better immediate in the VPTERNLOG commuting tests so its easier to spot bad swizzling.
llvm-svn: 295637
2017-02-20 07:00:31 +00:00
Craig Topper 5b4e36aafa [AVX-512] Add more VPTERNLOG patterns to enable folding of broadcast loads that aren't in operand 2.
llvm-svn: 295634
2017-02-20 02:47:42 +00:00
Craig Topper c184b671d9 [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.

llvm-svn: 295626
2017-02-20 00:37:23 +00:00
Craig Topper 0f14411b57 [X86] Add test cases showing missed opportunities to use rotate right by 1 instructions when operation reads/writes memory.
llvm-svn: 295625
2017-02-20 00:37:20 +00:00
Craig Topper 489057715e [AVX-512] Disable peephole optimizations on the VPTERNLOG commute test. Add new patterns to enable isel to fold the loads on it own.
llvm-svn: 295616
2017-02-19 21:32:15 +00:00
Simon Pilgrim d590de2998 [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. 

llvm-svn: 295613
2017-02-19 19:40:31 +00:00
Craig Topper 4e794c71a6 [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.

llvm-svn: 295612
2017-02-19 19:36:58 +00:00
Craig Topper ab1afa85ba [AVX-512] Add test cases that show failure to select masked VPTERNLOG when a select is used to force the passthru operand to be not operand 0.
llvm-svn: 295611
2017-02-19 19:36:54 +00:00
Simon Pilgrim 4271186f9c [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.

llvm-svn: 295608
2017-02-19 17:19:38 +00:00
Craig Topper 218d1a020e [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.

llvm-svn: 295602
2017-02-19 08:03:26 +00:00
Craig Topper 94de4b9330 [AVX-512] Add patterns to show missed opportunities for folding vpternlog with broadcast loads. Also demonstrates a bug in the commuting of broadcast vpternlog instructions when we are able to select them.
llvm-svn: 295601
2017-02-19 08:03:23 +00:00
NAKAMURA Takumi 486dfe11af llvm/test/CodeGen/AMDGPU/r600.alu-limits.ll should require +Asserts. This would run into infinite loop anyways with -Asserts.
llvm-svn: 295591
2017-02-19 02:31:06 +00:00
Craig Topper de10312bea Recommit "[X86] Remove XOP VPCMOV intrinsics and autoupgrade them to native IR."
Clang has now been fixed to not use these intrinsics.

llvm-svn: 295571
2017-02-18 21:50:58 +00:00
Sanjay Patel dc8a24ea4c [x86] remove stale comments from tests; NFC
llvm-svn: 295569
2017-02-18 21:07:37 +00:00