Commit Graph

23553 Commits

Author SHA1 Message Date
Simon Pilgrim c218ca8072 [DAGCombiner] Generalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2) combine to work on non-splat vectors
The knownbits_mask_or_shuffle_uitofp change is interesting - shuffle combines manage to kick in, removing the AND constant mask load. For targets with fast-variable-shuffle this should reduce further to VPOR+VPSHUFB+VCVTDQ2PS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321279 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 16:34:46 +00:00
Simon Pilgrim 4a3dfeff72 [X86] Add (or (and X, c1), c2) -> (and (or X, c2), c1|c2) non-splat vector test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 16:08:41 +00:00
Tony Jiang 2fe72713c3 [PowerPC] Fix parest build failure in SPEC2017.
The build failure was caused by an assertion in pre-legalization DAGCombine:

Combining: t6: ppcf128 = uint_to_fp t5
... into: t20: f32 = PPCISD::FCFIDUS t19

which is clearly wrong since ppcf128 are definitely different type with f32 and
we cannot change the node value type when do DAGCombine. The fix is don't
handle ppc_fp128 or i1 conversions in PPCTargetLowering::combineFPToIntToFP and
leave it to downstream to legalize it and expand it to small legal types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 15:42:50 +00:00
Simon Pilgrim 9d06ec6ce5 [DAGCombiner] Generalize (and (or x, C), D) -> D iff (C & D) == D combine to work on non-splat vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 15:17:29 +00:00
Simon Pilgrim 0be7923501 [X86] Add (and (or x, C), D) -> D iff (C & D) == D non-splat vector test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 14:33:40 +00:00
Simon Pilgrim 4c5b914b95 [X86] Add v48i8 AVG test case, based on discussion on D41440
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321261 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 13:18:19 +00:00
Sam Parker 153f2e3851 [DAGCombine] Improve ReduceLoadWidth for SRL
If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321259 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 12:55:04 +00:00
Craig Topper 41539f1f4f [X86] Use PSHUFB for v32i16 shuffles before falling back to VPERMW/VPERMI2W.
PSHUFB has the ability to implicitly 0 elements which VPERMI2W can't do. So give a chance to use it first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321251 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 08:22:51 +00:00
Craig Topper 0499c5a206 [X86] Use VPERMI2B for v16i8 shuffles if we have VBMI+VLX and would have otherwise used two PSHUFBs ORed together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321249 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 07:31:30 +00:00
Craig Topper 981877461a [X86] Use VPERMB/VPERMI2B for v32i8 shuffle lowering if VBMI and VLX are supported.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 05:58:31 +00:00
Craig Topper 795ab2f886 [X86] Add avx512vbmi command lines to vector-shuffle-256-v32.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 03:58:31 +00:00
Michael Zolotukhin 7f4699ff8f [SimplifyCFG] Avoid quadratic on a predecessors number behavior in instruction sinking.
If a block has N predecessors, then the current algorithm will try to
sink common code to this block N times (whenever we visit a
predecessor). Every attempt to sink the common code includes going
through all predecessors, so the complexity of the algorithm becomes
O(N^2).
With this patch we try to sink common code only when we visit the block
itself. With this, the complexity goes down to O(N).
As a side effect, the moment the code is sunk is slightly different than
before (the order of simplifications has been changed), that's why I had
to adjust two tests (note that neither of the tests is supposed to test
SimplifyCFG):
* test/CodeGen/AArch64/arm64-jumptable.ll - changes in this test mimic
the changes that previous implementation of SimplifyCFG would do.
* test/CodeGen/ARM/avoid-cpsr-rmw.ll - in this test I disabled common
code sinking by a command line flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321236 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21 01:22:13 +00:00
Joel Galenson 7931efae70 [ARM] Optimize {s,u}{add,sub}.with.overflow.
The AArch64 backend contains code to optimize {s,u}{add,sub}.with.overflow during SelectionDAG.  This commit ports that code to the ARM backend.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321224 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 22:25:39 +00:00
Krzysztof Parzyszek 595e94ec09 [Hexagon] Allow construction of HVX vector predicates
Handle BUILD_VECTOR of boolean values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321220 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 20:49:43 +00:00
Yonghong Song fe6f85f7dd bpf: add support for objdump -print-imm-hex
Add support for 'objdump -print-imm-hex' for imm64, operand imm
and branch target. If user programs encode immediate values
as hex numbers, such an option will make it easy to correlate
asm insns with source code. This option also makes it easy
to correlate imm values with insn encoding.

There is one changed behavior in this patch. In old way, we
print the 64bit imm as u64:
  O << (uint64_t)Op.getImm();
and the new way is:
  O << formatImm(Op.getImm());

The formatImm is defined in llvm/MC/MCInstPrinter.h as
  format_object<int64_t> formatImm(int64_t Value)

So the new way to print 64bit imm is i64 type.
If a 64bit value has the highest bit set, the old way
will print the value as a positive value and the
new way will print as a negative value. The new way
is consistent with x86_64.
For the code (see the test program):
 ...
 if (a == 0xABCDABCDabcdabcdULL)
 ...
x86_64 objdump, with and without -print-imm-hex, looks like:
 48 b8 cd ab cd ab cd ab cd ab   movabsq $-6067004223159161907, %rax
 48 b8 cd ab cd ab cd ab cd ab   movabsq $-0x5432543254325433, %rax

Signed-off-by: Yonghong Song <yhs@fb.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321215 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 19:39:58 +00:00
Craig Topper 9d97dd42c1 [X86] Remove zext from vXi32 to vXi64 on indices of gather/scatter instructions if we can prove the pre-extended value is positive.
Gather/scatter can implicitly sign extend from i32->i64 on indices. So if we know the sign bit of the input to a zext is 0 we can use the implicit extension.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 19:25:33 +00:00
Warren Ristow 178562e3b8 Improve the test for r320216. NFC.
Patch by Matthew Voss!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 19:11:31 +00:00
Craig Topper 2386b66ab1 [X86] Implement the fusing of MUL+SUBADD to FMSUBADD
This patch turns shuffles of fadd/fsub with fmul into fmsubadd.

Patch by Dmitry Venikov

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 18:05:15 +00:00
Krzysztof Parzyszek ea38b36e41 [Hexagon] Adjust the value type for BCvt in LowerFormalArguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 14:44:05 +00:00
Simon Pilgrim eb585b8b48 [X86][AVX2] Split more shuffle tests into 'slow' and 'fast' variable shuffles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 13:12:34 +00:00
Diana Picus 395b777795 [ARM GlobalISel] Fix assertion in RegBankSelect
We get an assertion in RegBankSelect for code along the lines of
my_32_bit_int = my_64_bit_int, which tends to translate into a 64-bit
load, followed by a G_TRUNC, followed by a 32-bit store. This appears in
a couple of places in the test-suite.

At the moment, the legalizer doesn't distinguish between integer and
floating point scalars, so a 64-bit load will be marked as legal for
targets with VFP, and so will the rest of the sequence, leading to a
slightly bizarre G_TRUNC reaching RegBankSelect.

Since the current support for 64-bit integers is rather immature, this
patch works around the issue by explicitly handling this case in
RegBankSelect and InstructionSelect. In the future, we may want to
revisit this decision and make sure 64-bit integer loads are narrowed
before reaching RegBankSelect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321165 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 11:27:10 +00:00
Florian Hahn b68371dd25 [ARM] Lower unsigned saturation to USAT
Summary:
Implement lower of unsigned saturation on an interval [0, k] where k + 1 is a power of two using USAT instruction in a similar way to how [~k, k] is lowered using SSAT on ARM models that supports it.

Patch by Marten Svanfeldt

Reviewers: t.p.northover, pbarrio, eastig, SjoerdMeijer, javed.absar, fhahn

Reviewed By: fhahn

Subscribers: fhahn, aemerson, javed.absar, llvm-commits, kristof.beyls

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 11:13:57 +00:00
Tim Northover d2c80d9fc1 AArch64: fix one more place movi.2d could be created.
Somehow got missed out of r320965.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321162 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 10:45:39 +00:00
Craig Topper 15dc4d1db9 [X86] Optimize sign extends on index operand to gather/scatter to not sign extend past i32.
The gather instruction will implicitly sign extend to the pointer width, we don't need to further extend it. This can prevent unnecessary splitting in some cases.

There's still an issue that lowering on non-VLX can introduce another sign extend that doesn't get combined with shifts from a lowered sign_extend_inreg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321152 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 07:36:59 +00:00
Martin Storsjo c8f103e52b [AArch64] Implement stack probing for windows
Differential Revision: https://reviews.llvm.org/D41131

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 06:51:45 +00:00
Hiroshi Inoue feb947453a [PowerPC] fix a bug in redundant compare elimination
This patch fixes a bug in the redundant compare elimination reported in https://reviews.llvm.org/rL320786 and re-enables the optimization.

The redundant compare elimination assumes that we can replace signed comparison with unsigned comparison for the equality check. But due to the difference in the sign extension behavior we cannot change the opcode if the comparison is against an immediate and the most significant bit of the immediate is one.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321147 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 05:18:19 +00:00
Craig Topper 81228ec561 [X86] Improve coverage of fma negations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 01:26:36 +00:00
Craig Topper 6725cd17f4 [X86] Fix probable typo in fma fneg test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20 01:26:35 +00:00
Francis Visoiu Mistrih 30e8e017c8 [CodeGen] Move printing MO_FPImmediate operands to MachineOperand::print
Work towards the unification of MIR and debug output by refactoring the
interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 21:47:00 +00:00
Mark Searles a7ce6d3cc0 [AMDGPU] Turn off MergeConsecutiveStores() before Instruction Selection for AMDGPU. Commit dbbb6c5fc3 turned on MergeConsecutiveStores() before Instruction Selection for all targets. Enough AMDGPU compiles go into an infinite loop ( MergeConsecutiveStores() merges two stores; LegalizeStoreOps() un-merges; MergeConsecutiveStores() re-merges, etc. ) to warrant turning it off until the issues can be addressed.
Differential Revision: https://reviews.llvm.org/D41377

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 19:26:23 +00:00
Simon Pilgrim 3070381267 [X86] Regenerate popcnt tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321093 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 18:05:13 +00:00
Amara Emerson ea090c0f0e [GlobalISel][Legalizer] Fix crash when trying to lower G_FNEG of fp128 types.
This doesn't add legalizer support, just prevents crashing so that we
can gracefully fall back to SDAG.

Fixes PR35690.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 17:21:35 +00:00
Nirav Dave e63c3fb2b2 [DAG] Elide overlapping store
Summary:
Extend overlapping store elision to handle overwrites of stores by
larger stores.

Nontemporal tests have been modified to add memory dependencies to
prevent store elision.

Reviewers: craig.topper, rnk, t.p.northover

Subscribers: javed.absar, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321089 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 17:10:56 +00:00
Simon Pilgrim 223840e5a3 [X86][AVX512] Attempt target shuffle combining to different types instead of early-out
We try to prevent shuffle combining to value types that would stop the folding of masked operations, but by just returning early, we were failing to try different shuffle types.

The TODOs are all still relevant here to improve codegen but we're lacking test examples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321085 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 16:54:07 +00:00
Simon Pilgrim 264f0e7107 [X86][SSE] Add cpu feature for aggressive combining to variable shuffles
As mentioned in D38318 and D40865, modern Intel processors prefer to combine multiple shuffles to a variable shuffle mask (PSHUFB/VPERMPS etc.) instead of having multiple stage 'fixed' shuffles which put more pressure on Port 5 (at the expense of extra shuffle mask loads).

This patch provides a FeatureFastVariableShuffle target flag for Haswell+ CPUs that prefers combining 2 or more fixed shuffles to a single variable shuffle (default is 3 shuffles).

The long term aim is to drive more of this from schedule data (probably via the MC) but we're not close to being ready for that yet.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321074 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 13:16:43 +00:00
David Green 57ebda3b94 [ARM] Register the Thumb2SizeReducePass. NFC
Also adds a simple test case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321072 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 12:19:08 +00:00
Simon Pilgrim 7466c9c8da [X86][SSE] Use (V)PHMINPOSUW for vXi8 SMAX/SMIN/UMAX/UMIN horizontal reductions (PR32841)
Extension to D39729 which performed this for vXi16, with the same bit flipping to handle SMAX/SMIN/UMAX cases, vXi8 UMIN horizontal reductions can be performed.

This makes use of the fact that by performing a pair-wise i8 SHUFFLE/UMIN before PHMINPOSUW, we both get the UMIN of each pair but also zero-extend the upper bits ready for v8i16.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321070 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 12:02:40 +00:00
Simon Dardis 664fc77046 [mips] Handle the emission of microMIPSr6 sll instruction when used as a nop.
This instruction is encoded as zero, so we have handle that case when checking
for unimplemented opcodes when producing the encoding for an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321066 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 11:16:22 +00:00
Craig Topper fe2aed677b [X86] Don't extend v16i8 non-uniform shifts to v16i32 if we have BWI. Use v16i16 instead.
BWI supports shifting by word amounts. Even if VLX isn't support we can still widen to v32i16 and extract the lower half. For SKX its preferrable to not use 512-bit vector if we can.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 06:59:10 +00:00
Justin Bogner 437b240ff1 update_mir_test_checks: Accept IR as input as well as MIR
We need to handle IR for tests that want to do lowering (or just
-stop-after with IR as input). I've run this on one AArch64 test to
demonstrate what it looks like.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 00:49:04 +00:00
Matthias Braun 51a1d9adb9 TargetLoweringBase: Followup to r321035
I missed some prefixes and the fact that on AArch64 we use "bzero"
instead of "__bzero" as on X86 when doing my refactoring in r321035.

Improve tests for bzero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19 00:43:00 +00:00
Krzysztof Parzyszek b01d49845c [Hexagon] Cache loads to select to avoid traversing mutating DAG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321034 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 23:13:27 +00:00
Evandro Menezes 456d2793cd [AArch64] Expand test coverage of vector element shuffling to Exynos
Make sure that all test cases are run for Exynos as well.  Otherwise, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 22:17:39 +00:00
Dimitry Andric d1fe0c4fdf Fix more inconsistent line endings. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 19:46:56 +00:00
Jessica Paquette d4a00a6773 [MachineOutliner] Recommit r320229
LR was undefined entering outlined functions that contain calls. This made the
machine verifier unhappy when expensive checks were enabled. This fixes that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 19:33:21 +00:00
Benjamin Kramer 7db7ed3ddd [PPC] Also disable the pre-emit version of reg+reg to reg+imm transformation.
This has the same issue as the early pass disabled in r321010.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321013 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 19:21:56 +00:00
Krzysztof Parzyszek 228589c54a [Hexagon] Generate HVX code for vector sign-, zero- and any-extends
Implement any-extend as zero-extend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321004 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 18:32:27 +00:00
Simon Pilgrim cfd421b9ce [X86] Regenerate test to improve codegen testing for D41350
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321003 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 18:31:02 +00:00
Francis Visoiu Mistrih 65ad22d969 [YAML] Add support for non-printable characters
LLVM IR function names which disable mangling start with '\01'
(https://www.llvm.org/docs/LangRef.html#identifiers).

When an identifier like "\01@abc@" gets dumped to MIR, it is quoted, but
only with single quotes.

http://www.yaml.org/spec/1.2/spec.html#id2770814:

"The allowed character range explicitly excludes the C0 control block
allowed), the surrogate block #xD800-#xDFFF, #xFFFE, and #xFFFF."

http://www.yaml.org/spec/1.2/spec.html#id2776092:

"All non-printable characters must be escaped.
[...]
Note that escape sequences are only interpreted in double-quoted scalars."

This patch adds support for printing escaped non-printable characters
between double quotes if needed.

Should also fix PR31743.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320996 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 17:38:03 +00:00
Simon Dardis 6b66227212 Reland "[mips] Fix the target specific instruction verifier"
Fix an off by one error in the bounds checking for 'dinsu' and update
the ranges in the test comments so that they are accurate.

This version has the correct commit message.

Reviewers: atanasyan

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18 15:56:40 +00:00