23669 Commits

Author SHA1 Message Date
Craig Topper
f8f7710cb8 [X86] Add the 16 and 8-bit CRC32 instructions to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321958 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:48:20 +00:00
Craig Topper
82ce446218 [X86] Add 128 and 256-bit VPOPCNTD/Q instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321953 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:27 +00:00
Craig Topper
c303d203b8 [X86] Add EVEX vcvtph2ps to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:24 +00:00
Craig Topper
1d84174569 [X86] Remove cvtps2ph xmm->xmm from store folding tables. Add the evex versions of cvtps2ph to the store folding tables.
The memory form of the xmm->xmm version only writes 64-bits. If we use it in the folding tables and its get used for a stack spill, only half the slot will be written. Then a reload may read all 128-bits which will pull in garbage. But without the spill the upper bits of the register would have been zero. By not folding we would preserve the zeros.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321950 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:23 +00:00
Craig Topper
fb75f48283 [X86] Add load folding pattern to EVEX vcvttss2si/vcvtsd2si.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321945 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 21:02:26 +00:00
Sanjay Patel
df87029dcf [x86, MemCmpExpansion] allow 2 pairs of loads per block (PR33325)
This is the last step needed to fix PR33325:
https://bugs.llvm.org/show_bug.cgi?id=33325

We're trading branch and compares for loads and logic ops. 
This makes the code smaller and hopefully faster in most cases.

The 24-byte test shows an interesting construct: we load the trailing scalar 
elements into vector registers and generate the same pcmpeq+movmsk code that 
we expected for a pair of full vector elements (see the 32- and 64-byte tests).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321934 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 16:16:04 +00:00
Craig Topper
5013a6d16e [X86] Call lowerShuffleAsRepeatedMaskAndLanePermute from lowerV4I64VectorShuffle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321929 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 06:08:04 +00:00
Craig Topper
ee663094e4 [X86] Run dos2unix on a test file. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321928 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 06:08:02 +00:00
Krzysztof Parzyszek
ac780ae7ed [Hexagon] Even simpler patterns for sign- and zero-extending HVX vectors
Recommit r321897 with updated testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321908 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 22:31:11 +00:00
Bjorn Pettersson
39ebb68152 [DebugInfo] Align comments in debug_loc section
Summary:
This commit updates the BufferByteStreamer, used by DebugLocStream
to buffer bytes/comments to put in the debug_loc section, to
make sure that the Buffer and Comments vectors are synced.
Previously, when an SLEB128 or ULEB128 was emitted together with
a comment, the vectors could be out-of-sync if the LEB encoding
added several entries to the Buffer vectors, while we only added
a single entry to the Comments vector.

The goal with this is to get the comments in the debug_loc
section in the .s file correctly aligned.

Example (using ARM as target):
Instead of

  .byte 144                     @ sub-register DW_OP_regx
  .byte 128                     @ 256
  .byte 2                       @ DW_OP_piece
  .byte 147                     @ 8
  .byte 8                       @ sub-register DW_OP_regx
  .byte 144                     @ 257
  .byte 129                     @ DW_OP_piece
  .byte 2                       @ 8
  .byte 147                     @
  .byte 8                       @

we now get

  .byte 144                     @ sub-register DW_OP_regx
  .byte 128                     @ 256
  .byte 2                       @
  .byte 147                     @ DW_OP_piece
  .byte 8                       @ 8
  .byte 144                     @ sub-register DW_OP_regx
  .byte 129                     @ 257
  .byte 2                       @
  .byte 147                     @ DW_OP_piece
  .byte 8                       @ 8

Reviewers: JDevlieghere, rnk, aprantl

Reviewed By: aprantl

Subscribers: davide, Ka-Ka, uabelho, aemerson, javed.absar, kristof.beyls, llvm-commits, JDevlieghere

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321907 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 22:20:30 +00:00
Krzysztof Parzyszek
2dd4edf571 Revert r321894: it requires a part of another commit that is not ready yet
Commit message:
[Hexagon] Add patterns for sext_inreg of HVX vector types


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321904 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 21:57:43 +00:00
Craig Topper
c85dd32732 [X86] Stop printing moves between VR64 and GR64 with 'movd' mnemonic. Use 'movq' instead.
This behavior existed to work with an old version of the gnu assembler on MacOS that only accepted this form. Newer versions of GNU assembler and the current LLVM derived version of the assembler on MacOS support movq as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321898 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:55:12 +00:00
Krzysztof Parzyszek
dcbe415819 [Hexagon] Add patterns for truncating HVX vector types
Only non-bool vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321895 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:48:03 +00:00
Krzysztof Parzyszek
3509d6c9b9 [Hexagon] Add patterns for sext_inreg of HVX vector types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321894 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:46:41 +00:00
Krzysztof Parzyszek
d32592f248 [Hexagon] Add a bitcast to required type in LowerHvxMul
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321893 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:45:34 +00:00
Krzysztof Parzyszek
47b41454e7 [Hexagon] Add pattern for vsplat to v8i8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321892 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:43:56 +00:00
Simon Pilgrim
a3a875b34d [X86] Regenerate illegal move test
Recommitting after fixing case-sensitive issue in the RUN command

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321868 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 14:24:03 +00:00
Florian Hahn
545ec94b43 [AArch64] Fix -mcpu option in aarch64-combine-fmul-fsub.mir (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321865 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 11:17:48 +00:00
Sam Parker
8681051b9e [DAGCombine] Fix for PR37563
While searching for loads to be narrowed, equal sized loads were not
added to the list, resulting in anyext loads not being converted to
zext loads.

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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321862 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 08:47:23 +00:00
Aditya Nandakumar
09d2d44675 [GISel]: Don't create G_MUL with 1 during translation of GEP
When element size is 1, it's just wasteful to create MUL with 1.
https://reviews.llvm.org/D41738

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321857 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 02:56:28 +00:00
Simon Pilgrim
c0fafaac48 [X86] Add srem/udiv/urem by one combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 22:08:36 +00:00
Evandro Menezes
b3a26d8ca6 [AArch64] Improve code generation of vector build
Instead of using, for example, `dup v0.4s, wzr`, which transfers between
register files, use the more efficient `movi v0.4s, #0` instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321824 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 21:43:12 +00:00
Simon Pilgrim
8da0e49815 [X86] Add scalar undef sdiv/srem/udiv/urem combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321823 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 21:33:19 +00:00
Alexey Bataev
6072d5d178 [DEBUG] Add initial tests for debug info for NVPTX target, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321822 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 21:07:07 +00:00
Craig Topper
d5b26bc052 [X86] Correct the execution domain for AVX1 VBROADCASTF128 to be FP instead of integer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321821 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 20:56:21 +00:00
Amara Emerson
0f0caba04f Revert "[X86] Regenerate test"
This reverts r321814 as it was failing make check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321819 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 20:20:44 +00:00
Simon Pilgrim
6e771122dd [X86] Regenerate test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321814 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 18:48:42 +00:00
Simon Pilgrim
7ad07c388d [X86] Add common CHECK prefix for tests without SSE/AVX codegen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 18:23:46 +00:00
Simon Pilgrim
d3b16b238c Regenerate broadcast constant comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321808 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 18:21:33 +00:00
Simon Pilgrim
2000943126 [X86] Show missed combine for X/X for SDIV/UDIV and X%X for SREM/UREM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321807 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 18:20:46 +00:00
Diana Picus
ece975ca81 [ARM GlobalISel] Select G_PHI
Select G_PHI to PHI and manually constrain the result register. This is
very similar to how COPY is handled, so extract and reuse some of that
code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321797 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 13:09:25 +00:00
Diana Picus
07bd08dd75 [ARM GlobalISel] Add RegBankSelect tests for G_PHI
RegBankSelect already handles G_PHI with some generic code. Add a couple
of tests for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321796 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 13:09:20 +00:00
Diana Picus
f279d7e5c0 [ARM GlobalISel] Legalize scalar G_PHI
Mark G_PHI as Legal for s32 and p0, and also for s64 if we have hard
float. Widen any smaller types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321795 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 13:09:14 +00:00
Diana Picus
79a984ff1c [ARM GlobalISel] Fix selection of pointer constants
We used to handle G_CONSTANT with pointer type by forcing the type of
the result register to s32 and then letting TableGen handle it.
Unfortunately, setting the type only works for generic virtual
registers, that haven't yet been constrained to a register class (e.g.
those used only by a COPY later on). If the result register has already
been constrained as a use of a previously selected instruction, then
setting the type will assert.

It would be nice to be able to teach TableGen to select pointer
constants the same as integer constants, but since it's such an edge
case (at the moment the only pointer constant that we're generally
interested in is 0, and that is mostly used for comparisons and selects,
which are also not supported by TableGen) it's probably not worth the
effort right now. Instead, handle pointer constants with some trivial
handwritten code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321793 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 10:54:57 +00:00
Sam Parker
bbe71a0c6f [X86] Codegen test for PR37563
Adding test to ease review of D41628.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321791 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 09:42:27 +00:00
Simon Pilgrim
fed8082832 [DAGCombine] Handle out of range EXTRACT_VECTOR_ELT indices
Handle this in DAGCombiner::visitEXTRACT_VECTOR_ELT the same as we already do in SelectionDAG::getNode and use APInt instead of getZExtValue.

This should also fix oss-fuzz #4910

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 22:42:33 +00:00
Matt Arsenault
aca5381bd1 StructurizeCFG: Fix broken backedge detection
The work order was changed in r228186 from SCC order
to RPO with an arbitrary sorting function. The sorting
function attempted to move inner loop nodes earlier. This
was was apparently relying on an assumption that every block
in a given loop / the same loop depth would be seen before
visiting another loop. In the broken testcase, a block
outside of the loop was encountered before moving onto
another block in the same loop. The testcase would then
structurize such that one blocks unconditional successor
could never be reached.

Revert to plain RPO for the analysis phase. This fixes
detecting edges as backedges that aren't really.

The processing phase does use another visited set, and
I'm unclear on whether the order there is as important.
An arbitrary order doesn't work, and triggers some infinite
loops. The reversed RPO list seems to work and is closer
to the order that was used before, minus the arbitary
custom sorting.

A few of the changed tests now produce smaller code,
and a few are slightly worse looking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321751 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 18:45:37 +00:00
Craig Topper
02718c7972 [X86] Use ANY_EXTEND instead of SIGN_EXTEND in lowerMasksToReg
Currently we use SIGN_EXTEND in lowerMasksToReg as part of calling convention setup, but we don't require a specific value for the upper bits.

This patch changes it to ANY_EXTEND which will be lowered as SIGN_EXTEND if it ends up sticking around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321746 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 18:11:01 +00:00
Amara Emerson
caeab26ff8 [GlobalISel][Legalizer] Fix legalization of llvm.smul.with.overflow
Previously the code for handling G_SMULO didn't properly check for the signed
multiply overflow, instead treating it the same as the unsigned G_UMULO.

Fixes PR35800.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321690 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 04:56:56 +00:00
Andrew Kaylor
6ebc5abea9 Handle the case of live 16-bit subregisters in X86FixupBWInsts
Differential Revision: https://reviews.llvm.org/D40524

Change-Id: Ie3a405b28503ceae999f5f3ba07a68fa733a2400

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321674 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 21:04:38 +00:00
Sanjay Patel
0a935b3a90 [AArch64] fix typos in comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321673 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 21:04:08 +00:00
Sanjay Patel
db850cf9f4 [ValueTracking] recognize min/max of min/max patterns
This is part of solving PR35717:
https://bugs.llvm.org/show_bug.cgi?id=35717

The larger IR optimization is proposed in D41603, but we can show 
the improvement in ValueTracking using codegen tests because 
SelectionDAG creates min/max nodes based on ValueTracking. 

Any target with min/max ops should show wins here. I chose AArch64
vector ops because they're clean and uniform.

Some Alive proofs for the tests (can't put more than 2 tests in 1 
page currently because the web app says it's too long):
https://rise4fun.com/Alive/WRN
https://rise4fun.com/Alive/iPm
https://rise4fun.com/Alive/HmY
https://rise4fun.com/Alive/CNm
https://rise4fun.com/Alive/LYf



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321672 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 20:56:45 +00:00
Sanjay Patel
6ae0f3914e [AArch64] add tests for min/max of min/max (PR35717); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321668 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 20:16:45 +00:00
Amara Emerson
7b20f91f4d [AArch64][GlobalISel] Fix assert fail with unknown intrinsic.
A call may have an intrinsic name but not have a valid intrinsic ID,
for example with llvm.invariant.group.barrier. If so, treat it as a
normal call like FastISel does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321662 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 18:56:39 +00:00
Sanjay Patel
8d24966875 [x86] allow pairs of PCMPEQ for vector-sized integer equality comparisons (PR33325)
This is an extension of D31156 with the goal that we'll allow memcmp() == 0 expansion 
for x86 to use 2 pairs of loads per block.

The memcmp expansion pass (formerly part of CGP) will generate this kind of pattern 
with oversized integer compares, so we want to transform these into x86-specific vector
nodes before legalization splits things into scalar chunks.

See PR33325 for more details:
https://bugs.llvm.org/show_bug.cgi?id=33325

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321656 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 16:38:29 +00:00
Amara Emerson
d8de4cebd9 [AArch64][GlobalISel] Enable GlobalISel at -O0 by default
Tests updated to explicitly use fast-isel at -O0 instead of implicitly.

This change also allows an explicit -fast-isel option to override an
implicitly enabled global-isel. Otherwise -fast-isel would have no effect at -O0.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321655 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 16:30:47 +00:00
Krzysztof Parzyszek
6b057a1e60 [Hexagon] Fix generation of vector sign extensions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 15:28:49 +00:00
Daniel Jasper
7f55be51ae Revert r321089: "[DAG] Elide overlapping store" (and subsequent fix in r321204)
Our internal testing has revealed has discovered bugs in PPC builds.
I have forward reproduction instructions to the original author (Nirav).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321649 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 14:38:52 +00:00
Sam Parker
2714c01fbb [DAGCombine] Fix for PR35765
Remove the acceptance of ANY_EXTEND nodes while trying to move and
nodes back to loads.

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

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321641 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 10:19:01 +00:00
Sam Parker
884b5fd923 [X86] Codegen test for pr35765
Committing reproducer test for pr35765, fix to follow.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321640 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02 10:14:00 +00:00