Commit Graph

673 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
3e9f1c2ce4 [Hexagon] Enforce restrictions on packetizing cache instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335061 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 17:26:20 +00:00
Krzysztof Parzyszek
69ccb71234 Remove <undef> from rematerialized full register
When coalescing a small register into a subregister of a larger register,
if the larger register is rematerialized, the function updateRegDefUses
can add an <undef> flag to the rematerialized definition (since it's
treating it as only definining the coalesced subregister). While with that
assumption doing so is not incorrect, make sure to remove the flag later
on after the call to updateRegDefUses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334845 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 16:58:22 +00:00
Krzysztof Parzyszek
f173f1f151 [DAGCombiner] Recognize more patterns for ABS
Differential Revision: https://reviews.llvm.org/D47831


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334553 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 21:51:49 +00:00
Krzysztof Parzyszek
32c8f74122 [Hexagon] Make floating point operations expensive for vectorization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334508 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 15:12:50 +00:00
Krzysztof Parzyszek
77ce0e565d [SelectionDAG] Provide default expansion for rotates
Implement default legalization of rotates: either in terms of the rotation
in the opposite direction (if legal), or in terms of shifts and ors.

Implement generating of rotate instructions for Hexagon. Hexagon only
supports rotates by an immediate value, so implement custom lowering of
ROTL/ROTR on Hexagon. If a rotate is not legal, use the default expansion.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334497 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 12:49:36 +00:00
Krzysztof Parzyszek
a6348bee3e [Hexagon] Late predicate producers cannot be used as dot-new sources
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334426 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 18:45:52 +00:00
Krzysztof Parzyszek
ddfcacb69b [Hexagon] Implement vector-pair zero as V6_vsubw_dv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334123 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 19:34:40 +00:00
Krzysztof Parzyszek
5d3e5a3332 [Hexagon] Split CTPOP of vector pairs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334109 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 18:03:29 +00:00
Krzysztof Parzyszek
9e7803cfe0 [Hexagon] Add pattern to generate 64-bit neg instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334043 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 19:52:39 +00:00
Krzysztof Parzyszek
7488dbc121 [Hexagon] Add more patterns for generating abs/absp instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334038 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 19:00:50 +00:00
Krzysztof Parzyszek
e5ce9ac1bd [Hexagon] Select HVX code for vector CTPOP, CTLZ, and CTTZ
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333760 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 14:52:58 +00:00
Krzysztof Parzyszek
925c3a82e2 [SelectionDAG] Expand UADDO/USUBO into ADD/SUBCARRY if legal for target
Additionally, implement handling of ADD/SUBCARRY on Hexagon, utilizing
the UADDO/USUBO expansion.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333751 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 14:00:32 +00:00
Krzysztof Parzyszek
93c2d96597 [Hexagon] Use vector align-left when shift amount fits in 3 bits
This saves an instruction because for align-right the shift amount
would need to be put in a register first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333543 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-30 13:45:34 +00:00
Krzysztof Parzyszek
682d7382c6 [Hexagon] Fix packing source vectors in shufflevector selection
When the shuffle mask selected a subvector of the second input vector,
and aligning of the source was performed, the shuffle mask was updated
incorrectly, resulting in an ICE further in the selection process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333279 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-25 14:53:14 +00:00
Krzysztof Parzyszek
831a9e9185 [Hexagon] Add patterns for accumulating HVX compares
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333009 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 18:27:02 +00:00
Brendon Cahoon
d5b9305f2a [Hexagon] Generate post-increment for floating point types
The code that generates post-increments for Hexagon considered
integer values only. This patch adds support to generate them for
floating point values, f32 and f64.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332748 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 18:14:44 +00:00
Sanjay Patel
309c9c43a7 [Hexagon] preserve test intent by removing undef
We need to clean up the DAG floating-point undef logic.
This process is similar to how we handled integer undef
logic in D43141.

And as we did there, I'm trying to reduce the patch by
changing tests that would probably become meaningless
once we correct FP undef folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332550 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 22:49:08 +00:00
Krzysztof Parzyszek
bbebdb9580 [Hexagon] Mark HVX vector predicate bitwise ops as legal, add patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-16 21:00:24 +00:00
Krzysztof Parzyszek
711424181c [Hexagon] Remove unused flag from subtarget and (non)corresponding test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332365 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 16:13:52 +00:00
Krzysztof Parzyszek
1a0893616d [Hexagon] Add a target feature for memop generation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332285 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 20:09:07 +00:00
Sid Manning
86cf23258e Hexagon: Put relocations after instructions not packets.
Change relocation output so that relocation information follows
individual instructions rather than clustering them at the end
of packets.

This change required shifting block of code but the actual change
is in HexagonPrettyPrinter's PrintInst.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332283 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 19:46:08 +00:00
Krzysztof Parzyszek
f206c4fa84 [Hexagon] Avoid predicate copies to integer registers from store-locked
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332260 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 16:41:40 +00:00
Krzysztof Parzyszek
3a2083a2cd [Hexagon] Add patterns for vector shift-and-accumulate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331918 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 21:10:41 +00:00
Shiva Chen
a8a13bc662 [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is

!DILabel(scope: !1, name: "foo", file: !2, line: 3)

We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is

llvm.dbg.label(metadata !1)

It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.

We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.

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

Patch by Hsiangkai Wang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331841 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 02:40:45 +00:00
Krzysztof Parzyszek
66648415b9 [Hexagon] Handle non-immediate constants in HexagonSplitDouble
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331527 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04 15:04:48 +00:00
Krzysztof Parzyszek
1a966b8669 [Hexagon] Skip reserved physical registers when updating liveness
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331518 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-04 13:59:05 +00:00
Krzysztof Parzyszek
7d1c37461e [LivePhysRegs] Remove registers clobbered by regmasks from the live set
Dead defs were being removed from the live set (in stepForward), but
registers clobbered by regmasks weren't (more specifically, they were
actually removed by removeRegsInMask, but then they were added back in).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331219 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30 19:38:47 +00:00
Krzysztof Parzyszek
ebfa356af4 [Hexagon] Improve HVX instruction selection (bitcast, vsplat)
There was some unfortunate interaction between VSPLAT and BITCAST
related to the selection of constant vectors (coming from selecting
shuffles). Introduce VSPLATW that always splats a 32-bit word, and
can have arbitrary result type (to avoid BITCASTs of VSPLAT).
Clean up the previous selection of BITCAST/VSPLAT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330471 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 19:38:37 +00:00
Krzysztof Parzyszek
8200c2d55a [Hexagon] Skip fixed-stack indexes in HexagonConstExtenders
Fixed slots have negative values, and TRI::stackSlot2Index and
TRI::index2StackSlot do not handle negative numbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330468 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 19:06:46 +00:00
Krzysztof Parzyszek
e21049990a [if-converter] Handle BBs that terminate in ret during diamond conversion
This fixes https://llvm.org/PR36825.

Original patch by Valentin Churavy (D45218).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330345 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 17:26:46 +00:00
Krzysztof Parzyszek
980f5afda1 [Hexagon] Use legal types when lowering CONCAT_VECTORS via BUILD_VECTOR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330344 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 17:11:58 +00:00
Krzysztof Parzyszek
aa16779ee3 [Hexagon] Generate code for vector bswap intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330333 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 14:46:44 +00:00
Krzysztof Parzyszek
37e180bdc4 [Hexagon] Add/fix patterns for 32/64-bit vector compares and logical ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330330 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 14:24:31 +00:00
Krzysztof Parzyszek
545ac87e76 [Hexagon] Do not merge initializers for stack and non-stack expressions
Stack addressing needs addressing modes that provide an offset field
immediately following the frame index. An initializer from a non-stack
addressing could force the stack address to use a form that does not
provide an offset field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330191 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-17 15:23:09 +00:00
Galina Kistanova
62859f3482 Disable flaky tests till they get fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329763 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 22:07:29 +00:00
Krzysztof Parzyszek
65256d7e66 [Hexagon] Handle subregisters when calculating iteration count in HW loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329434 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 17:51:57 +00:00
Krzysztof Parzyszek
22950265a5 [Hexagon] Remove unneeded attributes from lit test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329078 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 16:05:20 +00:00
Krzysztof Parzyszek
f9ed632564 [Hexagon] Fix testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328899 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 19:46:28 +00:00
Krzysztof Parzyszek
5a53d2f60d [Hexagon] Avoid creating invalid offsets in packetizer
Two memory instructions with a dependency only on the address register
between the two (the first one of them being post-incrememnt) can be
packetized together after the offset on the second was updated to the
incremement value. Make sure that the new offset is valid for the
instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328897 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 19:28:37 +00:00
Krzysztof Parzyszek
ce765af4ed [Hexagon] Fix printing :mem_noshuf on compiler-generated packets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328869 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-30 15:09:05 +00:00
Krzysztof Parzyszek
934bf243bc [Hexagon] Add support to handle bit-reverse load intrinsics
Patch by Sumanth Gundapaneni.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328774 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 13:52:46 +00:00
Krzysztof Parzyszek
1b2b18b4a8 [Hexagon] Add support for "new" circular buffer intrinsics
These instructions have been around for a long time, but we
haven't supported intrinsics for them. The "new" versions use
the CSx register for the start of the buffer instead of the K
field in the Mx register.

We need to use pseudo instructions for these instructions until
after register allocation. The problem is that these instructions
allocate a M0/CS0 or M1/CS1 pair. But, we can't generate code for
the CSx set-up until after register allocation when the Mx
register has been fixed for the instruction.

There is a related clang patch.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328724 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28 19:38:29 +00:00
Krzysztof Parzyszek
a9d6d4cb72 [Hexagon] Implement TTI::shouldMaximizeVectorBandwidth
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328648 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-27 18:10:47 +00:00
Krzysztof Parzyszek
03a0661f60 [Hexagon] Add more lit tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328561 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 17:53:48 +00:00
Krzysztof Parzyszek
b709662b9c [Pipeliner] Add missing loop carried dependences
The pipeliner is not adding a dependence edge for a loop carried
dependence, and ends up scheduling a load from iteration n prior
to an aliased store in iteration n-1.

The code that adds the loop carried dependences in the pipeliner
doesn't check if the memory objects for loads and stores are
"identified" (i.e., distinct) objects. If they are not, then the
code that adds the dependences needs to be conservative. The
objects can be used to check dependences only when they are
distinct objects.

The code that checks for loop carried dependences has been updated
to classify loads and stores that are not identified as "unknown"
values. A store with an "unknown" value can potentially create
a loop carried dependence with any pending load.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328547 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 16:50:11 +00:00
Krzysztof Parzyszek
5f51cb0ad8 [Pipeliner] Use latency to compute RecMII
The patch contains severals changes needed to pipeline an example
that was transformed so that a Phi with a subreg is converted to
copies.

The pipeliner wasn't working for a couple of reasons.
- The RecMII was 3 instead of 2 due to the extra copies.
- Copy instructions contained a latency of 1.
- The node order algorithm was not choosing the best "bottom"
node, which caused an instruction to be scheduled that had a 
predecessor and successor already scheduled.
- Updated the Hexagon Machine Scheduler to check if the node is
latency bound when adding the cost for a 0-latency dependence.

The RecMII was 3 because the computation looks at the number of
nodes in the recurrence. The extra copy is an extra node but
it shouldn't increase the latency. The new RecMII computation
looks at the latency of the instructions in the recurrence. We
changed the latency of the dependence of a copy to 0. The latency
computation for the copy also checks the use of the copy (similar
to a reg_sequence).

The node order algorithm was not choosing the last instruction
in the recurrence for a bottom up traversal. This was when the
last instruction is a copy. A check was added when choosing the
instruction to check for NodeNum if the maxASAP is the same. This
means that the scheduler will not end up with another node in
the recurrence that has both a predecessor and successor already
scheduled.

The cost computation in Hexagon Machine Scheduler adds cost when
an instruction can be packetized with a zero-latency instruction.
We should only do this if the schedule is latency bound. 

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328542 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 16:33:16 +00:00
Krzysztof Parzyszek
6023f6ca35 [Pipeliner] Fix assert caused by pipeliner serialization
The pipeliner is asserting because the serialization step that 
occurs at the end is deleting an instruction.  The assert
occurs later on because there is a use without a definition.  

The problem occurs when an instruction defines a value used 
by a REQ_SEQUENCE and that value is used by a COPY instruction.
The latencies between these instructions are zero, so they are
put in to the same packet.  The serialization code is unable to
handle this correctly, and ends up putting the REG_SEQUENCE
before its definition.

There is special code in the serialization step that attempts
to handle zero-cost instructions (phis, copy, reg_sequence)
differently than regular instructions. Unfortunately, this means
the order does not come out correct.

This patch simplifies the code by changing the seperate steps for
handling zero-cost and regular instructions. Only phis are
handled separate now, since they should occurs first. Then, this
patch adds checks to make use the MoveUse is set to the smallest
value if there are multiple uses in a cycle.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328540 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 16:23:29 +00:00
Krzysztof Parzyszek
2fc30a3dc4 [Pipeliner] Fix check for order dependences when finalizing instructions
The code in orderDepdences that looks at the order dependences between
instructions was processing all the successor and predecessor order
dependences. However, we really only want to check for an order dependence
for instructions scheduled in the same cycle.

Also, fixed how the pipeliner handles output dependences. An output
dependence is also a potential loop carried dependence. The pipeliner
didn't handle this case properly so an invalid schedule could be created
that allowed an output dependence to be scheduled in the next iteration
at the same cycle.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 16:05:55 +00:00
Krzysztof Parzyszek
d5ceb00b90 [Pipeliner] Fix in the pipeliner phi reuse code
When the definition of a phi is used by a phi in the next iteration,
the pipeliner was assuming that the definition is processed first.
Because of the assumption, an incorrect phi name was used. This patch
has a check to see if the phi definition has been processed already.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328510 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 15:58:16 +00:00
Krzysztof Parzyszek
b2c894024b [Pipeliner] Correctly update memoperands in the epilog
The pipeliner needs to be conservative when updating the memoperands
of instructions in the epilog. Previously, the pipeliner was changing
the offset of the memoperand based upon the scheduling stage. However,
that is incorrect when control flow branches around the kernel code.
The bug enabled a load and store to the same stack offset to be swapped.

This patch fixes the bug by updating the size of the memoperands to be
UINT_MAX. This conservative value means that dependences will be created
between other loads and stores.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328508 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 15:45:55 +00:00