1130 Commits

Author SHA1 Message Date
Craig Topper
dc5d320d84 [AVX-512] Remove unmasked BLENDM instructions from the wrong load folding table. The unmasked versions read memory from operand 2, but were in the operand 3 table.
These aren't the most interesting set of blendm instructions as the unmasked version isn't useful. We were also missing the B and W forms. I'll add the masked versions of all sizes in a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 07:28:56 +00:00
Craig Topper
fbb52b555d [X86] Move some entries in the load folding tables to move appropriate grouping. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 07:28:53 +00:00
Craig Topper
3612268cf2 [AVX-512] Add patterns to use a zero masked VPTERNLOG instruction for vselects of all ones and all zeros.
Previously we emitted a VPTERNLOG and a separate masked move.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291415 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 02:44:34 +00:00
Craig Topper
7be24b7e92 [X86] Disable load unfolding for 128-bit MOVDDUP instructions since the load size is smaller than the register size so unfolding would increase the load size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291338 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 06:56:54 +00:00
Craig Topper
6600218060 [AVX-512] Add all forms of VPALIGNR, VALIGND, and VALIGNQ to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 06:51:09 +00:00
Michael LeMay
eaf3712d06 [TargetInstrInfo] replace redundant expression in getMemOpBaseRegImmOfs
Summary:
The expression for computing the return value of getMemOpBaseRegImmOfs has only
one possible value. The other value would result in a return earlier in the
function. This patch replaces the expression with its only possible value.

Reviewers: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290133 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-19 21:02:41 +00:00
Craig Topper
f28829d488 [AVX-512] Use EVEX encoded XOR instruction for zeroing scalar registers when DQI and VLX instructions are available.
This can give the register allocator more registers to use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-18 06:23:14 +00:00
Simon Pilgrim
6677747efb [X86][SSE] Fix domains for scalar store instructions
As discussed on D27692

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289834 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 17:09:24 +00:00
Simon Pilgrim
fb4f51ede1 [X86][AVX512] Moved instruction domain lookups to the right table. NFCI.
Avoid duplicating instructions in the int32/int64 domains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289830 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 16:38:51 +00:00
Simon Pilgrim
a533d6cc52 [X86][SSE] Fix domains for VZEXT_LOAD type instructions
Add the missing domain equivalences for movss, movsd, movd and movq zero extending loading instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289825 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 16:05:29 +00:00
Philip Reames
8037f01631 [peephole] Enhance folding logic to work for STATEPOINTs
The general idea here is to get enough of the existing restrictions out of the way that the already existing folding logic in foldMemoryOperand can kick in for STATEPOINTs and fold references to immutable stack slots. The key changes are:

    Support for folding multiple operands at once which reference the same load
    Support for folding multiple loads into a single instruction
    Walk all the operands of the instruction for varidic instructions (this is a bug fix!)

Once this lands, I'll post another patch which refactors the TII interface here. There's nothing actually x86 specific about the x86 code used here.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-13 01:38:41 +00:00
Craig Topper
4f6cd5addf [X86] Remove some intrinsic instructions from hasPartialRegUpdate
Summary:
These intrinsic instructions are all selected from intrinsics that have well defined behavior for where the upper bits come from. It's not the same place as the lower bits.

As you can see we were suppressing load folding for these instructions in some cases. In none of the cases was the separate load helping avoid a partial dependency on the destination register. So we should just go ahead and allow the load to be folded.

Only foldMemoryOperand was suppressing folding for these. They all have patterns for folding sse_load_f32/f64 that aren't gated with OptForSize, but sse_load_f32/f64 doesn't allow 128-bit vector loads. It only allows scalar_to_vector and vzmovl of scalar loads to match. There's no reason we can't allow a 128-bit vector load to be narrowed so I would like to fix sse_load_f32/f64 to allow that. And if I do that it changes some of these same test cases to fold the load too.

Reviewers: spatel, zvi, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 05:07:17 +00:00
Craig Topper
4c603b39c6 [X86] Add masked versions of VPERMT2* and VPERMI2* to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 05:20:11 +00:00
Craig Topper
54d8245b23 [AVX-512] Add vpermilps/pd to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289173 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 02:18:11 +00:00
Michael Kuperstein
3ffda498ec [X86] Do not assume "ri" instructions always have an immediate operand
The second operand of an "ri" instruction may be an immediate, but it may
also be a globalvariable, so we should make any assumptions.

This fixes PR31271.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-07 19:29:18 +00:00
Craig Topper
25dd36e1c9 [X86] Remove scalar logical op alias instructions. Just use COPY_FROM/TO_REGCLASS and the normal packed instructions instead
Summary:
This patch removes the scalar logical operation alias instructions. We can just use reg class copies and use the normal packed instructions instead. This removes the need for putting these instructions in the execution domain fixing tables as was done recently.

I removed the loadf64_128 and loadf32_128 patterns as DAG combine creates a narrower load for (extractelt (loadv4f32)) before we ever get to isel.

I plan to add similar patterns for AVX512DQ in a future commit to allow use of the larger register class when available.

Reviewers: spatel, delena, zvi, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06 04:58:39 +00:00
Michael Kuperstein
8bb9ea4ceb [X86] Fix non-intrinsic roundss/roundsd to not read the destination register
This changes the scalar non-intrinsic non-avx roundss/sd instruction
definitions not to read their destination register - allowing partial dependency
breaking.

This fixes PR31143.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 20:57:37 +00:00
Craig Topper
ad37a58d2d [AVX-512] Add many of the VPERM instructions to the load folding table. Move VPERMPDZri to the correct table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288591 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 19:37:39 +00:00
Craig Topper
ae10a1c682 [AVX-512] Add EVEX VPMADDUBSW and VPMADDWD to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 17:19:15 +00:00
Craig Topper
1244527f8c [AVX-512] Add EVEX vpshuflw/vpshufhw/vpshufd instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 07:57:11 +00:00
Craig Topper
9c40e33b57 [AVX-512] Add EVEX PSHUFB instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 07:06:30 +00:00
Craig Topper
579edc5817 [AVX-512] Add masked VINSERTF/VINSERTI instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 06:24:38 +00:00
Matthias Braun
05bdd2ebfe MachineScheduler: Export function to construct "default" scheduler.
This makes the createGenericSchedLive() function that constructs the
default scheduler available for the public API. This should help when
you want to get a scheduler and the default list of DAG mutations.

This also shrinks the list of default DAG mutations:
{Load|Store}ClusterDAGMutation and MacroFusionDAGMutation are no longer
added by default. Targets can easily add them if they need them. It also
makes it easier for targets to add alternative/custom macrofusion or
clustering mutations while staying with the default
createGenericSchedLive(). It also saves the callback back and forth in
TargetInstrInfo::enableClusterLoads()/enableClusterStores().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 20:11:54 +00:00
Craig Topper
38ad5292aa [X86][FMA4] Add load folding support for FMA4 scalar intrinsic instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288009 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 21:37:00 +00:00
Craig Topper
5e97e81073 [X86] Add SHL by 1 to the load folding tables.
I don't think isel selects these today, favoring adding the register to itself instead. But the load folding tables shouldn't be so concerned with what isel will use and just represent the relationships.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 21:36:54 +00:00
Craig Topper
1161bcc2a7 [AVX-512] Add integer and fp unpck instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 19:51:41 +00:00
Craig Topper
7912f85dc1 [X86] Add TB_NO_REVERSE to entries in the load folding table where the instruction's load size is smaller than the register size.
If we were to unfold these, the load size would be increased to the register size. This is not safe to do since the enlarged load can do things like cross a page boundary into a page that doesn't exist.

I probably missed some instructions, but this should be a large portion of them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288001 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 18:51:13 +00:00
Craig Topper
9a7445365c [AVX-512] Add masked EVEX vpmovzx/sx instructions to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287995 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 08:55:31 +00:00
Craig Topper
addcca1f0a [X86] Remove alignment restrictions from load folding table for some instructions that don't have a restriction.
Most of these are the SSE4.1 PMOVZX/PMOVSX instructions which all read less than 128-bits. The only other was PMOVUPD which by definition is an unaligned load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287991 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-27 01:52:51 +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
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
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
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
Michael Kuperstein
4f54847874 [X86] Allow folding of stack reloads when loading a subreg of the spilled reg
We did not support subregs in InlineSpiller:foldMemoryOperand() because targets
may not deal with them correctly.

This adds a target hook to let the spiller know that a target can handle
subregs, and actually enables it for x86 for the case of stack slot reloads.
This fixes PR30832.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 18:33:49 +00:00
Craig Topper
74964ec3da [X86] Remove alternate CodeGenOnly version of (v)movq that declared the load size as i128mem. Change all uses to the use the i64mem version.
I'm sure this caused the load size to misprint in Intel syntax output. We were also inconsistent about which patterns used which instruction between VEX and EVEX.

There are two different reg/reg versions of movq, one from a GPR and one from the lower 64-bits of an XMM register. This changes the loading folding table to use the single i64mem memory form for folding both cases. But we need to use TB_NO_REVERSE to prevent a duplicate entry in the unfolding table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 05:31:43 +00:00
Craig Topper
aa9982b218 [AVX-512] Add support for commuting VPERMT2(B/W/D/Q/PS/PD) to/from VPERMI2(B/W/D/Q/PS/PD).
Summary:
The index and one of the table operands can be swapped by changing the opcode to the other version. Neither of these operands are the one that can load from memory so this can't be used to increase memory folding opportunities.

We need to handle the unmasked forms and the kz forms. Since the load operand isn't being commuted we can commute the load and broadcast instructions too.

Reviewers: igorb, delena, Ayal, Farhana, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-22 04:57:34 +00:00
Michael Zuckerman
625dd9c314 Fixing a small typo (A->U).
This seem to fixes PR30992.

-         HasAVX512 ? X86::VMOVAPSZ128rm_NOVLX 
+         HasAVX512 ? X86::VMOVUPSZ128rm_NOVLX 




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 11:52:11 +00:00
Craig Topper
fd72811874 [AVX-512] Add EVEX form of VMOVZPQILo2PQIZrm to load folding tables to match SSE and AVX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 07:51:31 +00:00
Sanjay Patel
2c72e2a32c [x86] add fake scalar FP logic instructions to ReplaceableInstrs to save some bytes
We can replace "scalar" FP-bitwise-logic with other forms of bitwise-logic instructions. 
Scalar SSE/AVX FP-logic instructions only exist in your imagination and/or the bowels of 
compilers, but logically equivalent int, float, and double variants of bitwise-logic 
instructions are reality in x86, and the float variant may be a shorter instruction 
depending on which flavor (SSE or AVX) of vector ISA you have...so just prefer float all 
the time.

This is a preliminary step towards solving PR6137:
https://llvm.org/bugs/show_bug.cgi?id=6137

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287122 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-16 17:42:40 +00:00
Craig Topper
460a780d4f [X86] Cleanup 'x' and 'y' mnemonic suffixes for vcvtpd2dq/vcvttpd2dq/vcvtpd2ps and similar instructions.
-Don't print the 'x' suffix for the 128-bit reg/mem VEX encoded instructions in Intel syntax. This is consistent with the EVEX versions.
-Don't print the 'y' suffix for the 256-bit reg/reg VEX encoded instructions in Intel or AT&T syntax. This is consistent with the EVEX versions.
-Allow the 'x' and 'y' suffixes to be used for the reg/mem forms when we're assembling using Intel syntax.
-Allow the 'x' and 'y' suffixes on the reg/reg EVEX encoded instructions in Intel or AT&T syntax. This is consistent with what VEX was already allowing.

This should fix at least some of PR28850.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 01:53:29 +00:00
Peter Collingbourne
027f4d03c6 Re-apply r286384, "X86: Introduce the "relocImm" ComplexPattern, which represents a relocatable immediate.", with a fix for 32-bit x86.
Teach X86InstrInfo::analyzeCompare() not to crash on CMP and SUB instructions
that take a global address operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-09 23:53:43 +00:00
Zvi Rackover
9933d268bb [X86] Broadcast from memory intructions aren't unfoldable
Broadcast from memory instructions should be treated as moves. They can't be unfolded.

Fixes pr30693.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04 15:15:19 +00:00
Craig Topper
648888d1c2 [X86] Use intrinsics table for PMADDUBSW and PMADDWD so that we can use the legacy intrinsics to select EVEX encoded instructions when available.
This removes a couple tablegen classes that become unused after this change. Another class gained an additional parameter to allow PMADDUBSW to specify a different result type from its input type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-30 06:56:16 +00:00
Craig Topper
c4589d7751 [X86] Use intrinsics table for VPMULHRSW intrincis so that the legacy intrinsics can select EVEX encoded instructions when available.
This requires a minor rename of the instructions due to the use of different tablegen classes and how the names are concatenated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 18:41:45 +00:00
Peter Collingbourne
6f158fa384 Target: Remove unused entities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283690 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 04:38:57 +00:00
Craig Topper
f1bd24e068 [AVX-512] Add subvector insert and extract to load/store folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 03:54:13 +00:00
Craig Topper
3e9af522ba [AVX-512] Add the vector down convert instructions to the store folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 03:54:05 +00:00