511 Commits

Author SHA1 Message Date
Krzysztof Parzyszek da35e5e8be [Hexagon] Prefer L2_loadrub_io over L4_loadrub_rr
If the offset is an immediate, avoid putting it in a register
to get Rs+Rt<<#0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02 21:56:59 +00:00
Krzysztof Parzyszek 31407d3674 [Hexagon] Adjust patterns to reflect instruction selection preferences
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 22:24:49 +00:00
Krzysztof Parzyszek 93d857e6a9 [Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp
Making sure that an instruction has fewer operands than required, then
attempting to access one out of range is going to fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316785 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 18:52:28 +00:00
Krzysztof Parzyszek c936ad3889 [Hexagon] Account for negative offset when limiting max deviation
In getOffsetRange, Max can be set to 0 to force the extender replacement
to be at or below the original value. This would cause the new offset to
be non-negative, which is preferred for memory instructions (to reduce
the likelihood of it getting constant-extended due to predication). The
problem happens when the range is shifted by an offset (present in the
instruction being examined) and the offset is negative. The entire range
for the allowable deviation will then be strictly negative. This creates
a problem, since 0 is assumed to be a valid deviation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25 18:46:40 +00:00
Justin Bogner edab757966 MIR: Print the register class or bank in vreg defs
This updates the MIRPrinter to include the regclass when printing
virtual register defs, which is already valid syntax for the
parser. That is, given 64 bit %0 and %1 in a "gpr" regbank,

  %1(s64) = COPY %0(s64)

would now be written as

  %1:gpr(s64) = COPY %0(s64)

While this change alone introduces a bit of redundancy with the
registers block, it allows us to update the tests to be more concise
and understandable and brings us closer to being able to remove the
registers block completely.

Note: We generally only print the class in defs, but there is one
exception. If there are uses without any defs whatsoever, we'll print
the class on all uses. I'm not completely convinced this comes up in
meaningful machine IR, but for now the MIRParser and MachineVerifier
both accept that kind of stuff, so we don't want to have a situation
where we can print something we can't parse.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 18:04:54 +00:00
Krzysztof Parzyszek db797c0e59 [Hexagon] Return the correct chain edge for i1 function calls
In HexagonISelLowering, there is code to handle the case when
a function returns an i1 type. In this case, we need to generate
extra nodes to copy the result from R0 to a predicate register.

The code was returning the wrong value for the chain edge which
caused an assert "Wrong topological sorting" when converting the
instructions to MIs.

This patch fixes the problem by returning the chain for the final
copy.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316367 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23 19:35:25 +00:00
Krzysztof Parzyszek 0344b6624e [Hexagon] Add extra pattern for S4_addaddi
One combination was missing: add(add(x,y),c).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23 19:07:50 +00:00
Krzysztof Parzyszek 26843fd82c [Packetizer] Add function to check for aliasing between instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 22:08:40 +00:00
Krzysztof Parzyszek 736ecc1636 [Hexagon] Report error instead of crashing on wrong inline-asm constraints
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316236 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 20:24:44 +00:00
Krzysztof Parzyszek ccf5909298 [Hexagon] Reorganize and update instruction patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316228 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 19:33:12 +00:00
Krzysztof Parzyszek b99a8bcc2b [Hexagon] Allow redefinition with immediates for hw loop conversion
Normally, if the registers holding the induction variable's bounds
are redefined inside of the loop's body, the loop cannot be converted
to a hardware loop. However, if the redefining instruction is actually
loading an immediate value into the register, this conversion is both
possible and legal (since the immediate itself will be used in the
loop setup in the preheader).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 16:56:33 +00:00
Krzysztof Parzyszek 99a0c4c3b5 [Hexagon] Fix store conversion from rr to io in optimize addressing modes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316170 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19 16:59:22 +00:00
Sumanth Gundapaneni 7a600d312f [Hexagon] New HVX target features.
This patch lets the llvm tools handle the new HVX target features that
are added by frontend (clang). The target-features are of the form
"hvx-length64b" for 64 Byte HVX mode, "hvx-length128b" for 128 Byte mode HVX.
"hvx-double" is an alias to "hvx-length128b" and is soon will be deprecated.
The hvx version target feature is upgated form "+hvx" to "+hvxv{version_number}.
Eg: "+hvxv62"

For the correct HVX code generation, the user must use the following
target features.
For 64B mode: "+hvxv62" "+hvx-length64b"
For 128B mode: "+hvxv62" "+hvx-length128b"

Clang picks a default length if none is specified. If for some reason,
no hvx-length is specified to llvm, the compilation will bail out.
There is a corresponding clang patch.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316101 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-18 18:07:07 +00:00
Krzysztof Parzyszek 59d5964ec6 [Hexagon] Minimize number of repeated constant extenders
Each constant extender requires an extra instruction, which adds to the
code size and also reduces the number of available slots in an instruction
packet. In most cases, the value of a repeated constant extender could be
loaded into a register, and the instructions using the extender could be
replaced with their counterparts that use that register instead.

This patch adds a pass that tries to reduce the number of constant
extenders, including extenders which differ only in an immediate offset
known at compile time, e.g. @global and @global+12.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13 19:02:59 +00:00
Krzysztof Parzyszek cd6f7b1e77 [Hexagon] Add patterns for cmpb/cmph with immediate arguments
Patch by Sumanth Gundapaneni.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13 15:43:12 +00:00
Krzysztof Parzyszek bdeacd17d7 [Hexagon] Make sure that new-value jump is packetized with producer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315510 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11 21:20:43 +00:00
Krzysztof Parzyszek 9f806a0438 [Pipeliner] Improve serialization order for post-increments
The pipeliner is generating a serial sequence that causes poor
register allocation when a post-increment instruction appears
prior to the use of the post-increment register. This occurs when
there is a circular set of dependences involved with a sequence
of instructions in the same cycle. In this case, there is no
serialization of the parallel semantics that will not cause an
additional register to be allocated.

This patch fixes the problem by changing the instructions so that
the post-increment instruction is used by the subsequent
instruction, which enables the register allocator to make a
better decision and not require another register.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11 15:51:44 +00:00
Ron Lieberman dfd2a391d0 [Hexagon] Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass
If the two instructions being compared for equivalence have corresponding operands
    that are integer constants, then check their values to determine equivalence.
    
    Patch by Suyog Sarda!
    



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314642 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02 00:34:07 +00:00
Ron Lieberman 29fbd6fadb [Hexagon] Patch to Extract i1 element from vector of i1
This patch extracts 1 element from vector consisting
of elements of size 1 bit at given index.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314641 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02 00:16:15 +00:00
Galina Kistanova 4e27573cfe Reverted r313993.
This patch produces a crash and hexagon_vector_loop_carried_reuse_constant.ll test fails on Windows (llvm-clang-x86_64-expensive-checks-win build bot).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314361 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27 23:09:14 +00:00
Pranav Bhandarkar 6c716cac04 Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass
If the two instructions being compared for equivalence have corresponding operands
that are integer constants, then check their values to determine equivalence.

Patch by Suyog Sarda!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313993 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22 16:43:31 +00:00
Pranav Bhandarkar b9223fa588 [Hexagon] - Fix testcase for the HexagonVectorLoopCarriedReuse pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 23:11:28 +00:00
Rafael Espindola 08eb053d05 Revert "Add a testfile that I missed in a previous commit that added HexagonVectorLoopCarriedReuse pass"
This reverts commit r313926.

It was failing in some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 22:57:43 +00:00
Pranav Bhandarkar 5b211046b6 Add a testfile that I missed in a previous commit that
added HexagonVectorLoopCarriedReuse pass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313926 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 21:52:24 +00:00
Krzysztof Parzyszek 0ca0ddafe5 [IfConversion] More simple, correct dead/kill liveness handling
Patch by Jesper Antonsson.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14 15:53:11 +00:00
Krzysztof Parzyszek 145740999d Preserve existing regs when adding pristines to LivePhysRegs/LiveRegUnits
Differential Revision: https://reviews.llvm.org/D37600


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-08 16:29:50 +00:00
Matthias Braun 109c6e02f7 Insert IMPLICIT_DEFS for undef uses in tail merging
Tail merging can convert an undef use into a normal one when creating a
common tail. Doing so can make the register live out from a block which
previously contained the undef use. To keep the liveness up-to-date,
insert IMPLICIT_DEFs in such blocks when necessary.

To enable this patch the computeLiveIns() function which used to
compute live-ins for a block and set them immediately is split into new
functions:
- computeLiveIns() just computes the live-ins in a LivePhysRegs set.
- addLiveIns() applies the live-ins to a block live-in list.
- computeAndAddLiveIns() is a convenience function combining the other
  two functions and behaving like computeLiveIns() before this patch.

Based on a patch by Krzysztof Parzyszek <kparzysz@codeaurora.org>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 20:45:24 +00:00
Krzysztof Parzyszek 7e5553d4f2 [IfConversion] Remove kill flags from common instructions as well
When if-converting a diamond, two separate blocks will be placed back
to back to form a straight line code. To ensure correctness of the
liveness information, any registers that are live in the second block
should not be killed in the first block, even if they were in the
original code.
Additionally, when the two blocks share common instructions at the
beginning, these instructions will not be duplicated, but only placed
once, before both of the blocks. Since the function "isIdenticalTo"
(as used here) ignores kill flags, the common initial code in one
block may have a kill flag for a register that is live in the other
block.
Because the code that removes kill flags only runs for the non-common
parts of the predicated blocks, a kill flag mismatch in the common
code could still lead to a live register being killed prematurely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 17:57:13 +00:00
Krzysztof Parzyszek 0c3d5af968 [Hexagon] Add option to generate calls to "abort" for "unreachable"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312644 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 16:22:55 +00:00
Krzysztof Parzyszek a0dd08a806 [Hexagon] Check for potential bank conflicts in post-RA scheduling
Insert artificial edges between loads that could cause a cache bank
conflict.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:36:21 +00:00
Krzysztof Parzyszek 3dfcd099f5 [Hexagon] Generate correct runtime check when recognizing memmove
The check (assuming positive stride) for validity of memmove should be
(a) the destination is at a lower address than the source, or
(b) the distance between the source and destination is greater than or
    equal the number of bytes copied.

For the second part it is sufficient to assume that the destination
is at a higher address, since the opposite case is covered by (a).
The distance calculation was previously done by subtracting the
pointers in the wrong order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24 11:59:53 +00:00
Krzysztof Parzyszek 5c985bdbe2 [Hexagon] Ignore DBG_VALUEs when counting instructions in hexagon-early-if
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310524 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 21:22:05 +00:00
Jonas Paulsson b7123745ed [LSR / TTI / SystemZ] Eliminate TargetTransformInfo::isFoldableMemAccess()
isLegalAddressingMode() has recently gained the extra optional Instruction*
parameter, and therefore it can now do the job that previously only
isFoldableMemAccess() could do.

The SystemZ implementation of isLegalAddressingMode() has gained the
functionality of checking for offsets, which used to be done with
isFoldableMemAccess().

The isFoldableMemAccess() hook has been removed everywhere.

Review: Quentin Colombet, Ulrich Weigand
https://reviews.llvm.org/D35933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 11:28:01 +00:00
Krzysztof Parzyszek c6a42e96ed [Hexagon] Convert HVX vector constants of i1 to i8
Certain operations require vector of i1 values. However, for Hexagon
architecture compatibility, they need to be represented as vector of i8.

Patch by Suyog Sarda.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309677 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 13:12:53 +00:00
Krzysztof Parzyszek 1aa3f8dfbc [Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 19:35:48 +00:00
Krzysztof Parzyszek bcf10065bb [Hexagon] Add inline-asm constraint 'a' for modifier register class
For example
  asm ("memw(%0++%1) = %2" : : "r"(addr),"a"(mod),"r"(val) : "memory")


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 17:51:27 +00:00
Krzysztof Parzyszek b8ae3835b5 [Hexagon] Fix a bug in r308502: post-inc offset is always 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308510 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 19:17:32 +00:00
Sumanth Gundapaneni 993d5f2bc8 [Hexagon] Emit lookup tables in text section based on a flag
The flag "-hexagon-emit-lut-text" (defaulted to false) is added to decide
on where to keep the switch generated lookup table.
Differential Revision: https://reviews.llvm.org/D34818


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308316 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 15:31:37 +00:00
Mandeep Singh Grang 02972a4b38 [llvm] Remove redundant check-prefix=CHECK from tests. NFC.
Reviewers: t.p.northover, oren_ben_simhon, niravd, mcrosier

Reviewed By: oren_ben_simhon, mcrosier

Subscribers: nhaehnle, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308193 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 17:32:45 +00:00
Krzysztof Parzyszek 7a0ca1142c [Hexagon] Remove custom lowering of loads of v4i16
The target-independent lowering works fine, except concatenating 32-bit
words. Add a pattern to generate A2_combinew instead of 64-bit asl/or.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308186 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 15:45:45 +00:00
Krzysztof Parzyszek 9d612bd4f5 [Hexagon] Add intrinsics for data cache operations
This is the LLVM part, adding definitions for
  void @llvm.hexagon.Y2.dccleana(i8*)
  void @llvm.hexagon.Y2.dccleaninva(i8*)
  void @llvm.hexagon.Y2.dcinva(i8*)
  void @llvm.hexagon.Y2.dczeroa(i8*)
  void @llvm.hexagon.Y4.l2fetch(i8*, i32)
  void @llvm.hexagon.Y5.l2fetch(i8*, i64)
The clang part will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 15:58:48 +00:00
Krzysztof Parzyszek c3676c8ea9 [Hexagon] Do not rely on callee-saved info in hasFP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 17:11:54 +00:00
Krzysztof Parzyszek 609a5df225 [Hexagon] Add support for nontemporal loads and stores on HVX
Patch by Michael Wu.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 16:39:33 +00:00
Krzysztof Parzyszek 33287d8a69 [Hexagon] Fix check for HMOTF_ConstExtend operand flag
This fixes https://llvm.org/PR33718.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 18:38:52 +00:00
Nirav Dave bef33d7af3 [Hexagon] Preclude non-memory test from being optimized away. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 13:08:03 +00:00
Krzysztof Parzyszek 515de5651c [Hexagon] Implement frame pointer elimination with -fomit-frame-pointer
It applies to leaf functions that are otherwise not required to have
a frame pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 21:21:40 +00:00
Sumanth Gundapaneni 7005a5a047 [Hexagon] Emit jump tables in text section based on a flag
This patch adds a new LLVM flag -hexagon-emit-jt-text which is defaulted to 
"false". The value "true" emits the switch generated jump tables in text section.
Differential Revision: https://reviews.llvm.org/D34820


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:21:48 +00:00
Sumanth Gundapaneni 409c609253 Revert "[Hexagon] Guard the generation of lookup table"
This reverts commit ae521f4192.
Wrong commit message



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:20:00 +00:00
Sumanth Gundapaneni ae521f4192 [Hexagon] Guard the generation of lookup table
The llvm flag "-hexagon-emit-lookup-tables" guards the generation
of lookup table from a switch statement.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:10:28 +00:00
Krzysztof Parzyszek aeca92c575 [Hexagon] Keep all phi nodes when building DFG in addr-mode-opt
The dead phis are needed for finding correct would-be reaching defs
in register propagation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29 15:55:59 +00:00