46152 Commits

Author SHA1 Message Date
Craig Topper 3f6f6c2f6d [PowerPC] Add an ISD::TRUNCATE to the legalization for ppc_is_decremented_ctr_nonzero
Summary:
I believe legalization is really expecting that ReplaceNodeResults will return something with the same type as the thing that's being legalized. Ultimately, it uses the output to replace the uses in the DAG so the type should match to make that work.

There are two relevant cases here. When crbits are enabled, then i1 is a legal type and getSetCCResultType should return i1. In this case, the truncate will be between i1 and i1 and should be removed (SelectionDAG::getNode does this). Otherwise, getSetCCResultType will be i32 and the legalizer will promote the truncate to be i32 -> i32 which will be similarly removed.

With this fixed we can remove some code from PromoteIntRes_SETCC that seemed to only exist to deal with the intrinsic being replaced with a larger type without changing the other operand. With the truncate being used for connectivity this doesn't happen anymore.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: nemanjai, llvm-commits, kbarton

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321959 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 07:51:36 +00:00
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 de0191914f [X86] Correct the load folding flags for xmm fp->mmx conversion instructions.
The instructions that load 64-bits or an xmm register should be TB_NO_REVERSE to avoid the load being widened during unfold. The instructions that load 128-bits need to ensure 128-bit alignment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321956 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:30 +00:00
Craig Topper 5faf7a61e0 [X86] Add TB_NO_REVERSE to some scalar intrinsic instructions in the load folding table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321955 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:29 +00:00
Craig Topper a325c91bc7 [X86] Don't put any EVEX_B instructions in the tablegen generated load folding tables.
EVEX_B means different things for memory and register forms. The instructions should not be considered equivalent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321954 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:28 +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 f43fba24c5 [X86] Add some 8 and 16-bit instructions to the load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321952 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:25 +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 72bb1a1f8b [X86] Add CMP8ri8 to load folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321949 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-07 06:24:21 +00:00
Craig Topper 586db08a0c [X86] Remove assembler predicates from all AVX512 related feature flags.
We don't do fine grained feature control like this on features prior to AVX512.

We do still have checks in place in the assembly parser itself that prevents %zmm references or %xmm16-31 from being parsed without at least -mattr=avx512f. Same for rounding control and mask operands. That will prevent the table matcher from matching for any instructions that need those features and that's probably good enough.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321947 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 21:45:30 +00:00
Craig Topper d71f891c9b [X86] Remove memory forms of EVEX encoded vcvttss2si/vcvttsd2si from asm matcher table.
This is also needed to fix PR35837.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321946 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 21:27:25 +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
Craig Topper b2ac80f2c2 [X86] Remove an unnecessary VCVTTSD2SIrrb/VCVTSS2SIrrb instruction with no isel pattern that only existed for the assembler. Use VCVTTSD2SIrrb_Int instead.
For consistency use the _Int version of VCVTTSD2SIrr_Int and VCVTTSD2SIrm_Int for the assembler as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321944 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 21:02:22 +00:00
Craig Topper d9c9e989f5 [X86] Remove memory forms of EVEX encoded vcvtsd2si/vcvtss2si from the assembler matcher table
We should always prefer the VEX encoded version of these instructions. There is no advantage to the EVEX version.

Fixes PR35837.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321939 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 19:20:33 +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 0179ddc7fa [X86] Rename the EVEX encoded GFNI instructions to start with a 'V'. NFC
This makes the names consistent with the mnemonics like every other instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321931 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 07:18:08 +00:00
Craig Topper c161097e5f [X86] When parsing rounding mode operands, provide a proper end location so we don't crash when trying to print an error message using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321930 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-06 06:41:07 +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 cd244770af [X86] Add vcvtsd2sil/vcvtsd2siq etc. InstAliases to the EVEX-encoded instructions.
This matches their VEX equivalents.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321912 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 23:13:54 +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
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 510c34022e [X86] Add InstAliases for 'vmovd' with GR64 registers to select EVEX encoded instructions as well.
Without this we allow "vmovd %rax, %xmm0", but not "vmovd %rax, %xmm16"

This exists due to continue a silly bug where really old versions of the GNU assembler required movd instead of movq on these instructions. This compatibility hack then crept forward to avx version too, but we didn't propagate it to avx512.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321903 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 21:57:23 +00:00
Krzysztof Parzyszek 96332f0c46 Revert r321897: affected testcases were not updated
Commit message:
[Hexagon] Even simpler patterns for sign- and zero-extending HVX vectors


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321902 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 21:50:15 +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 5def6c03b6 [Hexagon] Even simpler patterns for sign- and zero-extending HVX vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321897 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:49:26 +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
Krzysztof Parzyszek a2e08b3d2a [Hexagon] Set boolean contents in HexagonISelLowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321891 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 20:41:50 +00:00
Reid Kleckner e8b13a5478 Fix -Wsign-compare warnings on Windows
These arise because enums are 'int' by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321887 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 19:53:51 +00:00
Momchil Velikov 2e4bd2aa72 [ARM] Issue an erorr when non-general-purpose registers are used in address operands
Currently the assembler would accept, e.g. `ldr r0, [s0, #12]` and similar.
This patch add checks that only general-purpose registers are used in address
operands, shifted registers, and shift amounts.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321866 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-05 13:28:10 +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
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
Oliver Stannard 1f052d6e5e [ARM] Fix endianness of Thumb .inst.w directive
Wide Thumb2 instructions should be emitted into the object file as pairs of
16-bit words of the appropriate endianness, not one 32-bit word.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321799 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 13:56:40 +00:00
Krzysztof Parzyszek 0ac175d3a3 [Hexagon] Replace INSERTRP/EXTRACTRP with INSERT/EXTRACT in HexagonISD
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321798 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-04 13:56:04 +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 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
Craig Topper da2ff7289e [X86] Remove 'else' after 'return' I forgot to cleanup before committing D41691.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321755 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 19:15:43 +00:00
Matt Arsenault 38a59d719d AMDGPU: Remove dead file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321752 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 18:45:42 +00:00
Craig Topper 2f0787a62d [X86] Remove useless custom inserter for 64-bit TAILJMP and TCRETURN opcodes
This custom inserter was added in r124272 at which time it added about bunch of Defs for Win64. In r150708, those defs were removed leaving only the "return BB". So I think this means the custom inserter is a NOP these days.

This patch removes the remaining code and stops tagging the instructions for custom insertion

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321747 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 18:20:36 +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
Hans Wennborg 1b838dc9f8 Remove left-over debug printout from r321692
Besides the unsightly print-out, it was causing some buildbots to fail,
e.g. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/9311

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321711 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 14:48:19 +00:00
Alex Bradbury 6d1f7de223 [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend
After D41349, we can now directly access MCSubtargetInfo from 
createARM*AsmBackend. This patch makes use of this, avoiding the need to 
create a fresh MCSubtargetInfo (which was previously always done with a blank 
CPU and feature string). Given the total size of the change remains pretty 
tiny and we're removing the old explicit destructor, I changed the STI field 
to a reference rather than a pointer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321707 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 13:46:21 +00:00
Sander de Smalen cf59225a2b [AArch64][SVE] Asm: Add restricted register classes for SVE predicate vectors.
Summary:
Add a register class for SVE predicate operands that can only be p0-p7 (as opposed to p0-p15)

Patch [1/3] in a series to add predicated ADD/SUB instructions for SVE.

Reviewers: rengolin, mcrosier, evandro, fhahn, echristo, olista01, SjoerdMeijer, javed.absar

Reviewed By: fhahn

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321699 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 10:15:46 +00:00
Alex Bradbury f3040d7ba0 Fix build of WebAssembly and AVR backends after r321692
As experimental backends, I didn't have them configured to build in my local 
build config.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321696 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 09:30:39 +00:00
Alex Bradbury d32868dc00 Thread MCSubtargetInfo through Target::createMCAsmBackend
Currently it's not possible to access MCSubtargetInfo from a TgtMCAsmBackend. 
D20830 threaded an MCSubtargetInfo reference through 
MCAsmBackend::relaxInstruction, but this isn't the only function that would 
benefit from access. This patch removes the Triple and CPUString arguments 
from createMCAsmBackend and replaces them with MCSubtargetInfo.

This patch just changes the interface without making any intentional 
functional changes. Once in, several cleanups are possible:
* Get rid of the awkward MCSubtargetInfo handling in ARMAsmBackend
* Support 16-bit instructions when valid in MipsAsmBackend::writeNopData
* Get rid of the CPU string parsing in X86AsmBackend and just use a SubtargetFeature for HasNopl
* Emit 16-bit nops in RISCVAsmBackend::writeNopData if the compressed instruction set extension is enabled (see D41221)

This change initially exposed PR35686, which has since been resolved in r321026.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321692 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 08:53:05 +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