13086 Commits

Author SHA1 Message Date
Quentin Colombet
72d2da5ca3 [X86] Add a new LOW32_ADDR_ACCESS_RBP register class.
ABIs like NaCl uses 32-bit addresses but have 64-bit frame.
The new register class reflects those constraints when choosing a
register class for a address access.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268796 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 21:10:53 +00:00
Quentin Colombet
93cbe6ed35 [X86] Rename the X32_ADDR_ACCESS register class into LOW32_ADDR_ACCESS.
This register class may be used by any ABIs that uses x86_64 ISA while
using 32-bit addresses, not just in X32 cases. Make sure the name
reflects that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 21:10:43 +00:00
Nico Weber
a019a2c0f5 Revert r268760, it caused PR27670.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 21:07:02 +00:00
Ahmed Bougacha
9c0ef542c4 [X86] Accept imp-defs of GR64 super-registers in FixupBW MOVrr.
Testcase will follow shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 20:03:03 +00:00
Quentin Colombet
d26da6c773 [X86] Get rid of X32_NOREX_ADDR_ACCESS register class.
According to H.J. Lu <hjl.tools@gmail.com>, this register class is never
used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 18:22:48 +00:00
Ahmed Bougacha
292650f3ea [X86] Teach X86FixupBWInsts to promote MOV8rr/MOV16rr to MOV32rr.
Codesize is less (16) or equal (8), and we avoid partial dependencies.

Differential Revision: http://reviews.llvm.org/D19999

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 17:42:57 +00:00
Ahmed Bougacha
a2a67a1732 [X86] Remove \brief in FixupBW. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268754 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 17:28:47 +00:00
Ahmed Bougacha
0ebb0b2998 [X86] Simplify FixupBW sub_8bit_hi-related logic. NFC.
Instead of passing around sizes and asking for subregs, we can check
the subreg indices we care about: sub_8bit_hi and sub_8bit.

Differential Revision: http://reviews.llvm.org/D20006

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268753 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 17:28:42 +00:00
Justin Bogner
9ed38db20e SDAG: Rename Select->SelectImpl and repurpose Select as returning void
This is a step towards removing the rampant undefined behaviour in
SelectionDAG, which is a part of llvm.org/PR26808.

We rename SelectionDAGISel::Select to SelectImpl and update targets to
match, and then change Select to return void and consolidate the
sketchy behaviour we're trying to get away from there.

Next, we'll update backends to implement `void Select(...)` instead of
SelectImpl and eventually drop the base Select implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268693 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 23:19:08 +00:00
Hans Wennborg
99386b8559 X86CallFrameOptimization: make adjustCallSequence's return type void
It always returned the same value (true). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 16:39:31 +00:00
Marcin Koscielnicki
d11ea2f4ad [X86] Extend some Linux special cases to cover kFreeBSD.
Both Linux and kFreeBSD use glibc, so follow similiar code paths.
Add isTargetGlibc to check for this, and use it instead of isTargetLinux
in a few places.

Fixes PR22248 for kFreeBSD.

Differential Revision: http://reviews.llvm.org/D19104

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 11:35:51 +00:00
David Majnemer
5e74c97ad7 [X86] Use the right type when folding xor (truncate (shift)) -> setcc
The result type of setcc is dependent on whether or not AVX512 is
present.
We had an X86-specific DAG-combine which assumed that the result type
should be i8 when it could be i1.
This meant that we would generate illegal setccs which LowerSETCC did
not like.

Instead, use an appropriate type and zero extend to i8.

Also, there were some scenarios where the fold should have fired but
didn't because we were overly cautious about the types.  This meant that
we generated:

        shrl    $31, %edi
        andl    $1, %edi
        kmovw   %edi, %k0
        kxnorw  %k0, %k0, %k1
        kshiftrw        $15, %k1, %k1
        kxorw   %k1, %k0, %k0
        kmovw   %k0, %eax

instead of:

        testl   %edi, %edi
        setns   %al

This fixes PR27638.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 06:00:56 +00:00
Quentin Colombet
6e702f0a15 [X86] Add a few register classes for x32 address accesses.
The new register classes allow to tell the machine verifier that it is
fine to use RIP for address accesses in x32 mode. Prior to that patch,
we would complain that we are using a GR64 in place of GR32, whereas it
is actually fine to use GR64 for x32 as long as the 32 high bits are 0s.
RIP has this property and is used for RIP-relative addressing.

This partially fixes http://llvm.org/PR27481.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268567 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 22:45:31 +00:00
David Majnemer
6c67e89b60 [X86] Lower zext i1 arguments
i1 is now a legal type for X86 with AVX512.
There were some paths in X86FastISel which were not quite ready to see
an i1 value: they were not quite sure how to deal with sign/zero extends
for call arguments.
DTRT by extending to i8 for zeroext and bailing out of FastISel for
signext.

This fixes PR27591.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-04 00:22:23 +00:00
Simon Pilgrim
895f6a3918 [X86] Tidied up SDValue's SDNode referencing. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 21:44:45 +00:00
Tim Northover
4dc70fc4d6 X86-Darwin: start emitting data-region directives for jump-tables.
The surrounding tools can cope these days, and they were invented for a reason.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 21:03:41 +00:00
David L Kreitzer
ded3b7b8d2 Add an address space for the X86 SS segment.
Patch by Michael LeMay (michael.lemay@intel.com)

Differential Revision: http://reviews.llvm.org/D17093


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 20:16:08 +00:00
Simon Pilgrim
21ed3fcba2 [X86][SSE] Added target shuffle combine to MOVQ
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 15:05:13 +00:00
Igor Breger
b663ea6cec [AVX512] Add support for commutative MAX/MIN . In general VMAX{PS,PD} and VMIN{PS,PD} instruction are not commutative . In combine pass only if UnsafeFPMath are used VMAX/VMAX are converted to commutative nodes VMAXC/VMAXC.
Differential Revision: http://reviews.llvm.org/D19860

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 11:51:45 +00:00
Igor Breger
6386c04b9e [AVX512] Fix lowerV4X128VectorShuffle to select correctly input operands .
Differential Revision: http://reviews.llvm.org/D19803

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 08:08:44 +00:00
Matthias Braun
02073cb41c livePhysRegs: Pass MBB by reference in addLive{Ins|Outs}(); NFC
The block must no be nullptr for the addLiveIns()/addLiveOuts()
function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268340 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 00:24:32 +00:00
Matthias Braun
b4756d6b2d LivePhysRegs: Automatically determine presence of pristine regs.
Remove the AddPristinesAndCSRs parameters from
addLiveIns()/addLiveOuts().

We need to respect pristine registers after prologue epilogue insertion,
Seeing that we got this wrong in at least two commits already, we should
rather pay the small price to query MachineFrameInfo for it.

There are three cases that did not set AddPristineAndCSRs to true even
after register allocation:
- ExecutionDepsFix: live-out registers are used as a hint that the
  register is used soon. This is not true for pristine registers so
  use the new addLiveOutsNoPristines() to maintain this behaviour.
- SystemZShortenInst: Not setting AddPristineAndCSRs to true looks like
  a bug, should do the right thing automatically now.
- StackMapLivenessAnalysis: Not adding pristine registers looks like a
  bug to me. Added a FIXME comment but maintain the current behaviour
  as a change may need to get coordinated with GC runtimes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 00:08:46 +00:00
Quentin Colombet
a15f9f52c3 [X86] Model FAULTING_LOAD_OP as a terminator and branch.
This operation may branch to the handler block and we do not want it
to happen anywhere within the basic block.
Moreover, by marking it "terminator and branch" the machine verifier
does not wrongly assume (because of AnalyzeBranch not knowing better)
the branch is analyzable. Indeed, the target was seeing only the
unconditional branch and not the faulting load op and thought it was
a simple unconditional block.
The machine verifier was complaining because of that and moreover,
other optimizations could have done wrong transformation!

In the process, simplify the representation of the handler block in
the faulting load op. Now, we directly reference the handler block
instead of using a label. This has the benefits of:
1. MC knows how to issue a label for a BB, so leave that to it.
2. Accessing the target BB from its label is painful, whereas it is
   direct from a MBB operand.

Note: The 2 bytes offset in implicit-null-check.ll comes from the
fact the unconditional jumps are not removed anymore, as the whole
terminator sequence is not analyzable anymore.

Will fix it in a subsequence commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 22:58:54 +00:00
Simon Pilgrim
f531bd9a27 [X86][SSE] Added placeholder for 128/256-bit wide shuffle combines
Begun adding placeholder for future support for vperm2f128/vshuff64x2 style 128/256-bit wide shuffles

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 21:12:48 +00:00
Simon Pilgrim
d0941fb7bb [X86][SSE] Dropped X86ISD::FGETSIGNx86 and use MOVMSK instead for FGETSIGN lowering
movmsk.ll tests are unchanged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268237 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 14:58:22 +00:00
David L Kreitzer
9135c2ad84 Enable the X86 call frame optimization for the 64-bit targets that allow it.
Fixes PR27241.

Differential Revision: http://reviews.llvm.org/D19688


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 13:45:25 +00:00
Craig Topper
a926dab069 [X86] Fix a bug in LOCK arithmetic operation pattern matching where the wrong immediate predicate check was being used for 64-bit instructions with 8-bit immediates.
This didn't cause a bug because the order of the patterns ensured that the 64-bit instructions with 32-bit immediates were selected first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268212 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-02 05:44:21 +00:00
Craig Topper
fc16410133 [AVX512] VPACKUSWB/VPACKSSWB should not be encoded with EVEX.W=1. While there fix the execution domain for VPACKSSDW/VPACKUSDW.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 17:38:32 +00:00
Igor Breger
dcb96be9b4 Change AVX512 braodcastsd/ss patterns interaction with spilling . New implementation take a scalar register and generate a vector without COPY_TO_REGCLASS (turn it into a VR128 register ) .The issue is that during register allocation we may spill a scalar value using 128-bit loads and stores, wasting cache bandwidth.
Differential Revision: http://reviews.llvm.org/D19579

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 08:40:00 +00:00
Craig Topper
807ccbc3c1 [AVX512] Prefer AVX512 VPACK instructions over AVX/AVX2 instructions when VLX and BWI are supported.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 06:52:19 +00:00
Craig Topper
df2ac9afe2 [AVX512] Add HasVLX to the 128/256-bit versions of VPACKSSDW/USDW/SSWB/USWB and VPMADDUBSW/VPMADDWD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 06:24:57 +00:00
Craig Topper
105f6befe9 [AVX512] Make sure 128/256-bit DQI versions of VAND/VANDN/VOR/VXOR are also marked as requiring VLX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 05:57:06 +00:00
Craig Topper
4a06cf179f [X86] Add an AddedComplexity to another pattern to put it near similar in the output file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 05:22:15 +00:00
Craig Topper
5926b3a290 [X86] Remove a seemlingly unused pattern. The same pattern appears elsewhere with an AddedComplexity that made this unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268183 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 05:22:13 +00:00
Craig Topper
beb596390c [X86] Add AddedComplexity to keep some similar patterns near each other in the output file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 04:59:49 +00:00
Craig Topper
37745446ec [X86] Remove some redundant selection patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 04:59:46 +00:00
Craig Topper
c473ca5cff [AVX512] Replace vector_extract with extractelt in some patterns. They mean the same thing but vector_extract is deprecated. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 04:59:44 +00:00
Craig Topper
11e9c38a31 [AVX512] Add hasSideEffects/mayLoad/mayStore flags to some instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-01 01:03:56 +00:00
Craig Topper
9f60ac413e [X86] Reduce memory usage of MemOp2RegOp and RegOp2MemOp folding maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268164 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-30 17:59:49 +00:00
Sriraman Tallam
7eaa51e95d Differential Revision: http://reviews.llvm.org/D19733
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268106 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 21:19:16 +00:00
Filipe Cabecinhas
2fd54348ae Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.
Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

Differential Revision: http://reviews.llvm.org/D19723

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 15:22:48 +00:00
Craig Topper
47c8c93e3d [X86] Remove unnecessary header file containing a small class. It was only included in one place. Just define the class directly in the cpp file. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 04:22:28 +00:00
Craig Topper
d2dec3c92c [X86] Include X86MCTargetDesc.h directly in X86Disassembler.cpp instead of duplicating parts of it. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267984 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 04:22:26 +00:00
Craig Topper
5f1ec2bfa8 [X86] Use nested switches to vary the operand to helper functions that were previously called in multiple cases. This seems to help the inliner reduce code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267964 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 00:51:30 +00:00
Craig Topper
dc03033554 [X86] Remove unused operand from a function and all its callers. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 05:58:46 +00:00
Craig Topper
4366cdb0c2 [CodeGen] Default CTTZ_ZERO_UNDEF/CTLZ_ZERO_UNDEF to Expand in TargetLoweringBase. This is what the majority of the targets want and removes a bunch of code. Set it to Legal explicitly in the few cases where that's the desired behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267853 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 03:34:31 +00:00
Mitch Bodart
3fdd252bbd [X86] Enable the post-RA-scheduler for clang's default 32-bit cpu.
For compilations with no explicit cpu specified, this exhibits
nice gains on Silvermont, with neutral performance on big cores.

Differential Revision: http://reviews.llvm.org/D19138


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267809 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 22:52:35 +00:00
Quentin Colombet
6c76c8948d [X86][FastISel] Make sure we use the right register class when we select stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 22:33:42 +00:00
Quentin Colombet
42b983d1a7 [X86] Fix the lowering of TLS calls.
The callseq_end node must be glued with the TLS calls, otherwise,
the generic code will miss the uses of the returned value and will
mark it dead.
Moreover, TLSCall 64-bit pseudo must not set an implicit-use on RDI,
the pseudo uses the symbol address at this point not RDI and the
lowering will do the right thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267797 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 21:37:37 +00:00
Kevin B. Smith
d71b57d3ce [X86]: Quit promoting 16 bit loads to 32 bit.
Differential Revision: http://reviews.llvm.org/D19592


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267773 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 19:58:03 +00:00