Commit Graph

24253 Commits

Author SHA1 Message Date
Sanjay Patel 05fb85ea81 [x86] add baseline vector compare tests for D42948; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325138 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 16:15:15 +00:00
Alexander Ivchenko ba2e473a53 [SelectionDAG][X86] Fix incorrect offset generated for VMASKMOV
When creating high MachineMemOperand for MSTORE/MLOAD we supply
it with the original PointerInfo, while the pointer itself had been incremented.
The patch adds the proper offset to the PointerInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325135 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 15:55:24 +00:00
Sjoerd Meijer 1dd33b8929 [ARM] f16 stack spill/reloads
This adds support for handling f16 stack spills/reloads.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325130 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 15:09:09 +00:00
Lama Saba 693160b019 [X86] Reduce Store Forward Block issues in HW - Recommit after fixing Bug 36346
If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: Ic41aa9ade6512e0478db66e07e2fde41b4fb35f9

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325128 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 14:58:53 +00:00
Simon Pilgrim a5e5821989 [X86][SSE] Relax type legality for combineTruncateWithSat PACKSS/PACKUS truncation
While the AVX512 VTRUNCS/VTRUNCUS instructions require legal types, truncateVectorWithPACK handles cases with multiples of legal types through splitting/concatenation. So we just need to ensure that the src/dst scalar types are correct and leave truncateVectorWithPACK to handle the rest of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325127 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 14:14:29 +00:00
Reid Kleckner 197917a303 [X86] Use EDI for retpoline when no scratch regs are left
Summary:
Instead of solving the hard problem of how to pass the callee to the indirect
jump thunk without a register, just use a CSR. At a call boundary, there's
nothing stopping us from using a CSR to hold the callee as long as we save and
restore it in the prologue.

Also, add tests for this mregparm=3 case. I wrote execution tests for
__llvm_retpoline_push, but they never got committed as lit tests, either
because I never rewrote them or because they got lost in merge conflicts.

Reviewers: chandlerc, dwmw2

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325049 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 20:47:49 +00:00
Stanislav Mekhanoshin e4b5c6ac63 [AMDGPU] Cleanup in memory legalizer tests. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 20:03:32 +00:00
Francis Visoiu Mistrih 3fa22fa403 [CodeGen] Print bundled instructions using the MIR syntax in -debug output
Old syntax:

BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2
* %r0 = SOME_OP %r2
* %r1 = ANOTHER_OP internal %r0

New syntax:

BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2 {
  %r0 = SOME_OP %r2
  %r1 = ANOTHER_OP internal %r0
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325032 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 18:08:26 +00:00
Yaxun Liu 2930e5c52d [AMDGPU] Change constant addr space to 4
Differential Revision: https://reviews.llvm.org/D43170


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325030 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 18:00:25 +00:00
Craig Topper 7947e7211b [DAGCombiner] Add one use check to fold (not (and x, y)) -> (or (not x), (not y))
Summary:
If the and has an additional use we shouldn't invert it. That creates an additional instruction.

While there add a one use check to the transform above that looked similar.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 16:25:27 +00:00
Craig Topper a7204c7b8c [X86] Add combine to shrink 64-bit ands when one input is an any_extend and the other input guarantees upper 32 bits are 0.
Summary: This gets the shift case from PR35792.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325018 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 16:25:25 +00:00
Sjoerd Meijer 4b977b2e67 [ARM] Allow half types in ConstantPool
Change ARMConstantIslandPass to:
- accept f16 literals as litpool entries,
- if the litpool needs to be inserted in the middle of a big block, then we
  need to 4-byte align the next instruction in ARM mode.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325012 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 15:34:09 +00:00
Sanjay Patel 81540ce108 [DAG] fix type of undef returned by getNode()
The bug has been lying dormant, but apparently was never exposed, until
after rL324941 because we didn't return the correct result 
for shifts with undef operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325010 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 14:55:07 +00:00
Alexander Ivchenko c8ff25f66e [X86] Rename function main->foo in CodeGen/X86/pr35316.ll. NFC
Using "void main" might be confusing for some cases.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324997 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 10:58:19 +00:00
Sjoerd Meijer bac740f8ef [Thumb] Handle addressing mode AddrMode5FP16
This addressing mode wasn't checked, so we were running in an assert.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324996 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 10:29:03 +00:00
Craig Topper c6a263bfa2 [X86] Add a test case showing blcic matching being broken by an and mask applied to the input. NFC
Playing around with other BMI/TBM instructions after PR35792 and saw this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324987 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 07:28:28 +00:00
Craig Topper e925ce0116 [X86] Add a blsr test case with a shift from PR35792. NFC
The blsr pattern here is missed because the add is shrunk, but the and is not. This leaves an any_extend between them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324986 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 05:33:39 +00:00
Craig Topper ebf3d94ea5 [X86] Teach EVEX->VEX pass to turn VRNDSCALE into VROUND when bits 7:4 of the immediate are 0 and the regular EVEX->VEX checks pass.
Bits 7:4 control the scale part of the operation. If the scale is 0 the behavior is equivalent to VROUND.

Fixes PR36246

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324985 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 04:19:26 +00:00
Craig Topper 7bdbf6e4d2 [X86] Autogenerate complete checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324984 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 04:19:23 +00:00
Craig Topper e533c7947d [X86] Remove duplicate CHECK-LABEL line the update script didn't delete when I converted the test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324979 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 01:36:27 +00:00
Volkan Keles 9fec6c0fd1 GlobalISel: IRTranslate llvm.fmuladd.* intrinsic
Reviewers: qcolombet, ab, dsanders, aditya_nandakumar, bogner

Reviewed By: qcolombet

Subscribers: rovka, kristof.beyls, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-13 00:47:46 +00:00
Craig Topper d3663e64d3 [X86] Auto generate complete checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324964 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 23:43:10 +00:00
Adam Nemet 0d1fcacb12 Revert "[LSR] Avoid UB overflow when examining reuse opportunities"
This reverts commit r324943.

Breaking bots, reverting for Gerolf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324958 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:42:13 +00:00
Craig Topper 05ca387efe [X86] Reverse the operand order of the autoupgrade of the kunpack builtins.
The second operand needs to be in the lower bits of the concatenation. This matches llvm 5.0, gcc, and icc behavior.

Fixes PR36360.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324953 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:38:34 +00:00
Sanjay Patel e4043bc221 [x86] add select test to show there's no single right answer (PR28968); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324947 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:19:24 +00:00
Gerolf Hoflehner 4321cf65af [LSR] Avoid UB overflow when examining reuse opportunities
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324943 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 21:49:32 +00:00
Sanjay Patel 9d75b0c483 [DAG] make binops with undef operands consistent with IR
This started by noticing that scalar and vector types were producing different results with div ops in PR36305:
https://bugs.llvm.org/show_bug.cgi?id=36305

...but the problem is bigger. I couldn't keep it straight without a table, so I'm attaching that as a PDF to 
the review. The x86 tests in undef-ops.ll correspond to that table.

Green means that instsimplify and the DAG agree on the result for all types.
Red means the DAG was returning undef when IR was not.
Yellow means the DAG was returning a non-undef result when IR returned undef.

This patch assumes that we're currently doing the right thing in IR.

Note: I couldn't find any problems with lowering vector constants as the code comments were warning, 
but those comments were written long ago in rL36413 .

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324941 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 21:37:27 +00:00
Martin Storsjo 0d2725c460 [GlobalMerge] Allow merging of dllexported variables
If merging them, the dllexport attribute needs to be brought along
to the new GlobalAlias.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324937 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 21:14:21 +00:00
Abderrazek Zaafrani 539d529511 [AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - llvm portion
https://reviews.llvm.org/D42993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324912 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 17:35:42 +00:00
Oliver Stannard 4c334a7e90 [AArch64] Improve v8.1-A code-gen for atomic load-and
Armv8.1-A added an atomic load-clear instruction (which performs bitwise
and with the complement of it's operand), but not a load-and
instruction. Our current code-generation for atomic load-and always
inserts an MVN instruction to invert its argument, even if it could be
folded into a constant or another instruction.

This adds lowering early in selection DAG to convert a load-and
operation into an xor with -1 and a load-clear, allowing the normal DAG
optimisations to work on it.

To do this, I've had to add a new ISD opcode, ATOMIC_LOAD_CLR. I don't
see any easy way to do this with an AArch64-specific ISD node, because
the code-generation for atomic operations assumes the SDNodes are of
type AtomicSDNode.

I've left the old tablegen patterns in because they are still needed for
global isel.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324908 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 17:03:11 +00:00
Simon Pilgrim f9670219db [X86][MMX] Add missing scheduling class tag for EMMS/FEMMS
We only tagged it with the itinerary class, so completeness checks were erroneously passed (PR35639).

AMD targets can perform these a lot quicker than WriteMicrocoded so will need an override in the models.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324897 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 15:52:59 +00:00
Oliver Stannard c01a55434a [AArch64] Improve v8.1-A code-gen for atomic load-subtract
Armv8.1-A added an atomic load-add instruction, but not a load-subtract
instruction. Our current code-generation for atomic load-subtract always
inserts a NEG instruction to negate it's argument, even if it could be
folded into a constant or another instruction.

This adds lowering early in selection DAG to convert a load-subtract
operation into a subtract and a load-add, allowing the normal DAG
optimisations to work on it.

I've left the old tablegen patterns in because they are still needed for
global isel.

Some of the tests in this patch are copied from D35375 by Chad Rosier (which
was abandoned).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324892 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 14:22:03 +00:00
Hans Wennborg ed3f0858d7 Revert r324835 "[X86] Reduce Store Forward Block issues in HW"
It asserts building Chromium; see PR36346.

(This also reverts the follow-up r324836.)

> If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
> A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
> The estimated penalty for a store forward block is ~13 cycles.
>
> This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
> of a load and a store.
>
> The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
> breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324887 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 12:43:39 +00:00
Simon Atanasyan 7067561767 [mips] Fix 'l' constraint handling for types smaller than 32 bits
In case of correct using of the 'l' constraint llvm now generates valid
code; otherwise it shows an error message. Initially these triggers an
assertion.

This commit is the same as r324869 with fixed the test's file name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324885 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 12:21:55 +00:00
Simon Atanasyan 9c8b55d17f [mips] Revert rL324869
This commit adds inlineasm-cnstrnt-bad-l.ll which is clashing
with inlineasm-cnstrnt-bad-L.ll on case insensitive file systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324882 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 11:15:37 +00:00
David Green 78a2fedd78 [CodeGen] Add a -trap-unreachable option for debugging
Add a common -trap-unreachable option, similar to the target
specific hexagon equivalent, which has been replaced. This
turns unreachable instructions into traps, which is useful for
debugging.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324880 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 11:06:27 +00:00
Simon Atanasyan 289fcee633 [mips] Fix 'l' constraint handling for types smaller than 32 bits
In case of correct using of the 'l' constraint llvm now generates valid
code; otherwise it shows an error message. Initially these triggers an
assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324869 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 07:51:21 +00:00
Craig Topper e82c014032 [X86] Change some compare patterns to use loadi8/loadi16/loadi32/loadi64 helper fragments.
This enables CMP8mi to fold zextloadi8i1 which in all tests allows us to avoid creating a TEST8rr that peephole can't fold.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324863 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 02:48:42 +00:00
Craig Topper 634f93ef18 [X86] Autogenerate complete checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324862 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 02:03:36 +00:00
Craig Topper 6ab8e7c6e7 [X86] Allow zextload/extload i1->i8 to be folded into instructions during isel
Previously we just emitted this as a MOV8rm which would likely get folded during the peephole pass anyway. This just makes it explicit earlier.

The gpr-to-mask.ll test changed because the kaddb instruction has no memory form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324860 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 01:33:36 +00:00
Craig Topper 84e573c17a [X86] Update some required-vector-width.ll test cases to not pass 512-bit vectors in arguments or return.
ABI for these would require 512 bits support so we don't want to test that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324845 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 18:52:16 +00:00
Simon Pilgrim b174e11560 [X86][SSE] Use SplitBinaryOpsAndApply to recognise PSUBUS patterns before they're split on AVX1
This needs to be generalised further to support AVX512BW cases but I want to add non-uniform constants first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324844 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 17:29:42 +00:00
Craig Topper ff687abc6e [X86] Use min/max for vector ult/ugt compares if avoids a sign flip.
Summary:
Currently we only use min/max to help with ule/uge compares because it removes an invert of the result that would otherwise be needed. But we can also use it for ult/ugt compares if it will prevent the need for a sign bit flip needed to use pcmpgt at the cost of requiring an invert after the compare.

I also refactored the code so that the max/min code is self contained and does its own return instead of setting up a flag to manipulate the rest of the function's behavior.

Most of the test cases look ok with this. I did notice that we added instructions when one of the operands being sign flipped is a constant vector that we were able to constant fold the flip into.

I also noticed that sometimes the SSE min/max clobbers a register that is needed after the compare. This resulted in an extra move being inserted before the min/max to preserve the register. We could try to detect this and switch from min to max and change the compare operands to use the operand that gets reused in the compare.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324842 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 17:11:40 +00:00
Sanjay Patel 3f985a3da1 [TargetLowering] try to create -1 constant operand for math ops via demanded bits
This reverses instcombine's demanded bits' transform which always tries to clear bits in constants.

As noted in PR35792 and shown in the test diffs:
https://bugs.llvm.org/show_bug.cgi?id=35792
...we can do better in codegen by trying to form -1. The x86 sub test shows a missed opportunity. 

I did investigate changing instcombine's behavior, but it would be more work to change 
canonicalization in IR. Clearing bits / shrinking constants can allow killing instructions, 
so we'd have to figure out how to not regress those cases.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324839 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 14:38:23 +00:00
Simon Pilgrim 6c93e2af21 [X86] Add PR33747 test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324838 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 13:12:50 +00:00
Simon Pilgrim 43e7c1ccf9 [X86][SSE] Enable SMIN/SMAX/UMIN/UMAX custom lowering for all legal types
This allows us to recognise more saturation patterns and also simplify some MINMAX codegen that was failing to combine CMPGE comparisons to a legal CMPGT.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 10:52:37 +00:00
Lama Saba 8d295d41b3 fix test/CodeGen/X86/fixup-sfb.ll test failure after commit https://reviews.llvm.org/rL324835
Change-Id: I2526c2f342654e85ce054237de03ae9db9ab4994

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324836 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 10:33:06 +00:00
Lama Saba fa2037abb8 [X86] Reduce Store Forward Block issues in HW
If a load follows a store and reloads data that the store has written to memory, Intel microarchitectures can in many cases forward the data directly from the store to the load, This "store forwarding" saves cycles by enabling the load to directly obtain the data instead of accessing the data from cache or memory.
A "store forward block" occurs in cases that a store cannot be forwarded to the load. The most typical case of store forward block on Intel Core microarchiticutre that a small store cannot be forwarded to a large load.
The estimated penalty for a store forward block is ~13 cycles.

This pass tries to recognize and handle cases where "store forward block" is created by the compiler when lowering memcpy calls to a sequence
of a load and a store.

The pass currently only handles cases where memcpy is lowered to XMM/YMM registers, it tries to break the memcpy into smaller copies.
breaking the memcpy should be possible since there is no atomicity guarantee for loads and stores to XMM/YMM.

Change-Id: I620b6dc91583ad9a1444591e3ddc00dd25d81748

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324835 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 09:34:12 +00:00
Craig Topper 35542ad55d [X86] Don't make 512-bit vectors legal when preferred vector width is 256 bits and 512 bits aren't required
This patch adds a new function attribute "required-vector-width" that can be set by the frontend to indicate the maximum vector width present in the original source code. The idea is that this would be set based on ABI requirements, intrinsics or explicit vector types being used, maybe simd pragmas, etc. The backend will then use this information to determine if its save to make 512-bit vectors illegal when the preference is for 256-bit vectors.

For code that has no vectors in it originally and only get vectors through the loop and slp vectorizers this allows us to generate code largely similar to our AVX2 only output while still enabling AVX512 features like mask registers and gather/scatter. The loop vectorizer doesn't always obey TTI and will create oversized vectors with the expectation the backend will legalize it. In order to avoid changing the vectorizer and potentially harm our AVX2 codegen this patch tries to make the legalizer behavior similar.

This is restricted to CPUs that support AVX512F and AVX512VL so that we have good fallback options to use 128 and 256-bit vectors and still get masking.

I've qualified every place I could find in X86ISelLowering.cpp and added tests cases for many of them with 2 different values for the attribute to see the codegen differences.

We still need to do frontend work for the attribute and teach the inliner how to merge it, etc. But this gets the codegen layer ready for it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-11 08:06:27 +00:00
Simon Pilgrim cd0b631360 [X86][SSE] Add SMIN/SMAX combine test
As discussed on D43014, we need the ability to flip SMIN/SMAX to (legal) UMIN/UMAX

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-10 23:38:50 +00:00