Commit Graph

26309 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
0d5de60cbe [RegisterCoalescer] Ensure that both registers have subranges if one does
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 17:04:58 +00:00
Sanjay Patel
6faab4de87 [x86] add fabs test for vector intrinsic to potential libcall bug; NFC
This is a negative test for x86 because it has custom lowering for fabs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339791 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 16:56:09 +00:00
Sanjay Patel
b581cf5c17 [x86] add tests for poor vector intrinsic lowering via legalization (PR38527); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339790 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 16:35:50 +00:00
Krzysztof Parzyszek
28f0c7ef0a [RegisterCoalescer] Reset VNInfo def when copying segments over
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339788 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 16:21:53 +00:00
Derek Schuff
ffcf104706 [WebAssembly] SIMD replace_lane
Implement and test replace_lane instructions.

Patch by Thomas Lively

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339786 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 16:18:51 +00:00
Krzysztof Parzyszek
d7a0236f29 [RegAlloc] Check that subreg liveness tracking applies to given virtual reg
Subregister liveness applies selectively to register classes with certain
properties. Make sure that when it's enabled, it applies to a given virtual
register (in virtual register rewriter).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339784 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 16:07:47 +00:00
Krzysztof Parzyszek
165c0cc485 [SystemZ] Add testcase for r339778
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339780 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 15:43:13 +00:00
Nemanja Ivanovic
4df6ca02ff [PowerPC] Enhance the selection(ISD::VSELECT) of vector type
To make ISD::VSELECT available(legal) so long as there are altivec instruction,
otherwise it's default behavior is expanding.
Use xxsel to match vselect if vsx is open, or use vsel.

In order to do not write many patterns in td file, promote (for vector it's
bitcast) all other type into v4i32 and only pattern match vselect of v4i32 into
vsel or xxsel.

Patch by wuzish
Differential revision: https://reviews.llvm.org/D49531


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339779 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 15:30:36 +00:00
Sam Parker
3dd5242055 [ARM] TypeSize lower bound for ARMCodeGenPrepare
We only try to promote types with are smaller than 16-bits, but we
also need to check that the type is not less than 8-bits.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339770 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 13:29:50 +00:00
Nemanja Ivanovic
7c82b970fb [PowerPC] Don't run BV DAG Combine before legalization if it assumes legal types
When trying to combine a DAG that builds a vector out of sign-extensions of
vector extracts, the code assumes legal input types. Due to that, we have to
disable this combine prior to legalization.
In some cases, the DAG will look slightly different after legalization so
account for that in the matching code.

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=38087

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339769 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 12:58:13 +00:00
Simon Pilgrim
da4cfd320c [X86][SSE] Add sdiv by nonuniform constant vector tests
Tests cover each TargetLowering::BuildSDIV path separately plus combos



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339761 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 10:59:29 +00:00
Aleksandr Urakov
406608e1b0 [X86] Add sibling-call test cases
This commit adds new sibling-call test cases, so it will be possible to see
how these test cases will be changed after applying D45653.
See D45653 for details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 10:54:06 +00:00
Simon Pilgrim
7e6dd0cff7 [TargetLowering] Add support for non-uniform vectors to BuildExactSDIV
This patch refactors the existing BuildExactSDIV implementation to support non-uniform constant vector denominators.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339756 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 09:35:12 +00:00
Sam Parker
81654d2362 [ARM] Allow signed icmps in ARMCodeGenPrepare
Treat signed icmps as 'sinks', allowing them to be in the use-def
tree, enabling more promotions to be performed. As a sink, any
promoted incoming values need to be truncated before being used by
the signed icmp.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339755 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 08:23:03 +00:00
Sam Parker
90048a8206 [ARM] Allow pointer values in ARMCodeGenPrepare
Add pointers to the list of allowed types, but don't try to promote
them. Also fixed a bug with the promotion of undef values, so a new
value is now created instead of mutating in place. We also now only
promote if there's an instruction in the use-def chains other than
the icmp, sinks and sources.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339754 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 07:52:35 +00:00
Derek Schuff
34c8f3ddba [WebAssembly] SIMD Splats
Implement and test SIMD splat ops.

Patch by Thomas Lively

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339744 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 00:30:27 +00:00
Heejin Ahn
c35538fcab [WebAssembly] Delete a specific push number from test expectations
Summary:
This shouldn't have been a specific number but rather a regex. This was
a part of rL339474 which got reverted.

Reviewers: aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339736 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 22:14:51 +00:00
Cameron McInally
ca4f10703e [FPEnv] Scalarize StrictFP vector operations
Add a helper function to scalarize constrained FP operations as needed.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339735 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 22:13:11 +00:00
Heejin Ahn
35b8f4b065 [WebAssembly] SIMD encoding tests
Modifies existing SIMD tests to also check that SIMD instructions are
lowered to the expected bytes. This CL depends on D50597.

Reviewers: aheejin

Subscribers: sunfish, jgravelle-google, sbc100, llvm-commits

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

Patch by Thomas Lively (tlively)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339712 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 19:10:50 +00:00
Heejin Ahn
95688ee84c [WebAssembly] SIMD extract_lane
Implement instruction selection for all versions of the extract_lane
instruction. Use explicit sext/zext to differentiate between
extract_lane_s and extract_lane_u for applicable types, otherwise
default to extract_lane_u.

Reviewers: aheejin

Subscribers: sunfish, jgravelle-google, sbc100, llvm-commits

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

Patch by Thomas Lively (tlively)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339707 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 18:53:27 +00:00
Simon Pilgrim
a06c0f8edb [X86][SSE] Avoid duplicate shuffle input sources in combineX86ShufflesRecursively
rL339686 added the case where a faux shuffle might have repeated shuffle inputs coming from either side of the OR().

This patch improves the insertion of the inputs into the source ops lists to account for this, as well as making it trivial to add support for shuffles with more than 2 inputs in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339696 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 17:22:37 +00:00
Simon Pilgrim
9c0c0a23ef [X86][SSE] Add shuffle combine support for OR(PSHUFB,PSHUFB) style patterns.
If each element is zero from one (or both) inputs then we can combine these into a single shuffle mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339686 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 16:00:05 +00:00
Simon Pilgrim
76cf1f6a8b [X86][SSE] Add shuffle combine tests for OR(PSHUFB,PSHUFB) style patterns.
We generate these shuffle patterns but we fail to combine them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 15:21:26 +00:00
Amara Emerson
0904155b95 [GlobalISel][IRTranslator] Fix a bug in handling repeating struct types during argument lowering.
Differential Revision: https://reviews.llvm.org/D49442

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339674 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 12:04:25 +00:00
Tomasz Krupa
8ec69ac247 [X86] Lowering addus/subus intrinsics to native IR
Summary: This revision improves previous version (rL330322) which has been reverted due to crashes.

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Reviewers: craig.topper, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mike.dvoretsky, DavidKreitzer, sroland, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 08:00:56 +00:00
Wouter van Oortmerssen
a297d96416 Revert "[WebAssembly] Added default stack-only instruction mode for MC."
This reverts commit 917a99b71ce21c975be7bfbf66f4040f965d9f3c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 23:12:49 +00:00
Scott Linder
7b19ab70e3 [CodeGen] Fix assert in SelectionDAG::computeKnownBits
Fix SelectionDAG::computeKnownBits asserting when handling EXTRACT_SUBVECTOR
when zero extending the demanded elements mask if it is already as long as the
source vector.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339600 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 18:44:21 +00:00
Daniel Cederman
01087accf2 Revert "[Sparc] Add support for the cycle counter available in GR740"
It breaks when using EXPENSIVE_CHECKS with the error message
"Bad machine code: Using an undefined physical register".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339570 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 14:18:09 +00:00
Simon Pilgrim
a73fb6d0ab [X86] Add tests showing missing div/rem 0, X -> 0 combines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339562 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 13:29:54 +00:00
Simon Pilgrim
4177d36e03 [CGP] Fix GEP issue with out of range APInt constant values not fitting in int64_t
Test case reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7173

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339556 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 12:10:09 +00:00
Daniel Cederman
ef546c9d7f [Sparc] Add support for the cycle counter available in GR740
Summary: The GR740 provides an up cycle counter in the
registers ASR22 and ASR23. As these registers can not be
read together atomically we only use the value of ASR23
for llvm.readcyclecounter(). The ASR23 register holds the
32 LSBs of the up-counter.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339551 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 10:49:48 +00:00
Luke Geeson
4514ca2f1d [ARM] Added FP16 VREV Vector Instrinsic CodeGen support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339546 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 08:37:41 +00:00
Craig Topper
3638207d8f [SelectionDAG] In PromoteFloatOp_BITCAST, insert a bitcast after the fp_to_fp16 in case the result type isn't a scalar integer.
This is another variation of PR38533. In this case, the result type of the bitcast is legal and 16-bits wide, but not a scalar integer. So we need to emit the convert to i16 and then bitcast it to the true result type. This new bitcast will be further type legalized if necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339536 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 06:53:49 +00:00
Craig Topper
36c59846ae [SelectionDAG] In PromoteIntRes_BITCAST, when the input is TypePromoteFloat, make sure the output type is scalar. For vectors, use a store and load of temporary.
Previously if the result type was a vector, we emitted a FP_TO_FP16 with a vector result type which isn't valid.

This is basically the opposite case of the root cause of PR38533.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339535 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 06:53:47 +00:00
Lei Liu
fa3003a783 Restore correct x86_64 EH encodings in kernel code model
Fixes PR37524.

The exception handling encodings for x86_64 in kernel code model
has been changed with r309884.  Restore it to correct ones.  These
encodings include PersonalityEncoding, LSDAEncoding and
TTypeEncoding.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339534 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 06:06:53 +00:00
Craig Topper
7bbb4c9b16 [SelectionDAG] In PromoteFloatRes_BITCAST, insert a bitcast before the fp16_to_fp in case the input type isn't an i16.
The bitcast can be further legalized as needed.

Fixes PR38533.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339533 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-13 05:26:49 +00:00
Matt Arsenault
1f25a887f6 AMDGPU: Cleanup min/max legacy tests
Also add some more tests in preparation for
a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339526 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 19:29:53 +00:00
Matt Arsenault
f0912abc34 DAG: Check no-signed-zeros instead of unsafe-fp-math
Addresses fixme, although this should still be checking individual
operand flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 19:09:12 +00:00
Matt Arsenault
10398322af AMDGPU: Check NSZ MI flag when folding omod
I'm not sure the exact nsz flag combination that
is OK. I think as long as it's on either, this is OK.
For now just check it on the omod multiply.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339513 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 08:44:25 +00:00
Matt Arsenault
3b2fa4ee59 AMDGPU: Use splat vectors for undefs when folding canonicalize
If one of the elements is undef, use the canonicalized constant
from the other element instead of 0.

Splat vectors are more useful for other optimizations, such
as matching vector clamps. This was breaking on clamps
of half3 from the undef 4th component.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339512 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 08:42:54 +00:00
Matt Arsenault
8750be505d AMDGPU: Fix packing undef parts of build_vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339511 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-12 08:42:46 +00:00
Craig Topper
6534d1052f [X86] Change the MOV32ri64 pseudo instruction to def a GR64 directly instead of wrapping it in a SUBREG_TO_REG.
Now we switch to the subregister in expandPostRAPseudos where we already switched the opcode.

This simplifies a few isel patterns that used the pseudo directly. And magically seems to have improved our ability to CSE it in the undef-label.ll test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339496 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-11 05:33:00 +00:00
Tom Stellard
202efa7409 AMDGPU/GlobalISel: Define instruction mapping for G_INSERT
Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339491 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-11 00:51:54 +00:00
Wouter van Oortmerssen
eb8079e823 [WebAssembly] Added default stack-only instruction mode for MC.
Summary:
Moved Explicit Locals pass to last.
Made that pass obligatory.
Made it convert from register to stack based instructions, and removed the registers.
Fixes to related code that was expecting register based instructions.
Added the correct testing flag to all tests, depending on what the
format they were expecting so far.
Translated one test to stack format as example: reg-stackify-stack.ll

tested:
llvm-lit -v `find test -name WebAssembly`
unittests/MC/*

Reviewers: dschuff, sunfish

Subscribers: jfb, llvm-commits, aheejin, eraman, jgravelle-google, sbc100

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339474 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 21:32:47 +00:00
Eli Friedman
0365cb9494 [ARM] Adjust AND immediates to make them cheaper to select.
LLVM normally prefers to minimize the number of bits set in an AND
immediate, but that doesn't always match the available ARM instructions.
In Thumb1 mode, prefer uxtb or uxth where possible; otherwise, prefer
a two-instruction sequence movs+ands or movs+bics.

Some potential improvements outlined in
ARMTargetLowering::targetShrinkDemandedConstant, but seems to work
pretty well already.

The ARMISelDAGToDAG fix ensures we don't generate an invalid UBFX
instruction due to a larger-than-expected mask. (It's orthogonal, in
some sense, but as far as I can tell it's either impossible or nearly
impossible to reproduce the bug without this change.)

According to my testing, this seems to consistently improve codesize by
a small amount by forming bic more often for ISD::AND with an immediate.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339472 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 21:21:53 +00:00
Matt Arsenault
7f32e5e190 AMDGPU: More canonicalized operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339464 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 19:20:17 +00:00
Matt Arsenault
a13d395b9e AMDGPU: Combine and of seto/setuo and fp_class
Clear the nan (or non-nan) test bits from the mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339462 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 18:58:56 +00:00
Matt Arsenault
4d8cda85ad AMDGPU: Match isfinite pattern to class instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339460 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 18:58:41 +00:00
Sam Parker
c709c56b9a [ARM] Disallow zexts in ARMCodeGenPrepare
Enabling ARMCodeGenPrepare by default caused a whole load of
failures. This is due to zexts and truncs not being handled properly.
ZExts are messy so it's just easier to disable for now and truncs
are allowed only as 'sinks'. I still need to figure out why allowing
them as 'sources' causes so many failures. The other main changes are
that we are explicit in the types that we converting to, it's now
always 'TypeSize'. Type support is also now performed while checking
for valid opcodes as it unnecessarily complicated having the checks
are different stages.
    
I've moved the tests around too, so we have the zext and truncs in
their own file as well as the overflowing opcode tests.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 13:57:13 +00:00
Hans Wennborg
201534e1aa Rename the cfguard module flag to cfguardtable
The previous name sounds like it inserts cfguard implementation, but it
really just emits the table of address-taken functions. Change the name
to better reflect that.

Clang will be updated in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-10 09:48:53 +00:00