Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4 |
|
#
9122c523 |
| 15-Nov-2024 |
Pengcheng Wang <wangpengcheng.pp@bytedance.com> |
[RISCV] Enable bidirectional scheduling and tracking register pressure (#115445)
This is based on other targets like PPC/AArch64 and some experiments.
This PR will only enable bidirectional schedu
[RISCV] Enable bidirectional scheduling and tracking register pressure (#115445)
This is based on other targets like PPC/AArch64 and some experiments.
This PR will only enable bidirectional scheduling and tracking register pressure.
Disclaimer: I haven't tested it on many cores, maybe we should make some options being features. I believe downstreams must have tried this before, so feedbacks are welcome.
show more ...
|
Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1 |
|
#
d833b9d6 |
| 29-Jan-2024 |
Alex Bradbury <asb@igalia.com> |
[RISCV] Graduate Zicond to non-experimental (#79811)
The Zicond extension was ratified in the last few months, with no
changes that affect the LLVM implementation. Although there's surely
more tun
[RISCV] Graduate Zicond to non-experimental (#79811)
The Zicond extension was ratified in the last few months, with no
changes that affect the LLVM implementation. Although there's surely
more tuning that could be done about when to select Zicond or not, there
are no known correctness issues. Therefore, we should mark support as
non-experimental.
show more ...
|
Revision tags: llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4 |
|
#
5341d546 |
| 19-Oct-2023 |
Yeting Kuo <46629943+yetingk@users.noreply.github.com> |
[RISCV] Combine (and (select cond, x, -1), c) to (select cond, x, (and x, c)) with Zicond. (#69563)
It's only beneficial when cond is setcc with integer equality condition
code. For other case, it
[RISCV] Combine (and (select cond, x, -1), c) to (select cond, x, (and x, c)) with Zicond. (#69563)
It's only beneficial when cond is setcc with integer equality condition
code. For other case, it has same instruction count as the original.
show more ...
|
Revision tags: llvmorg-17.0.3 |
|
#
86240751 |
| 06-Oct-2023 |
Philip Reames <preames@rivosinc.com> |
[RISCV] Strip W suffix from ADDIW (#68425)
The motivation of this change is simply to reduce test duplication. As
can be seen in the (massive) test delta, we have many tests whose output
differ on
[RISCV] Strip W suffix from ADDIW (#68425)
The motivation of this change is simply to reduce test duplication. As
can be seen in the (massive) test delta, we have many tests whose output
differ only due to the use of addi on rv32 vs addiw on rv64 when the
high bits are don't care.
As an aside, we don't need to worry about the non-zero immediate
restriction on the compressed variants because we're not directly
forming the compressed variants. If we happen to get a zero immediate
for the ADDI, then either a later optimization will strip the useless
instruction or the encoder is responsible for not compressing the
instruction.
show more ...
|
Revision tags: llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2 |
|
#
5a519961 |
| 01-Aug-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Call combineSelectToBinOp before generic select expansion for Zicond.
This handles logical ops of setccs and optimizes when the true or false value is -1.
Reviewed By: asb, wangpc
Differen
[RISCV] Call combineSelectToBinOp before generic select expansion for Zicond.
This handles logical ops of setccs and optimizes when the true or false value is -1.
Reviewed By: asb, wangpc
Differential Revision: https://reviews.llvm.org/D156810
show more ...
|
Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
a755e80e |
| 30-Mar-2023 |
Alex Bradbury <asb@igalia.com> |
[RISCV] Add codegen for the experimental zicond extension
This directly matches the codegen for xventanacondops with vt.maskcn => czero.nez and vt.maskc => czero.eqz. An additional difference is tha
[RISCV] Add codegen for the experimental zicond extension
This directly matches the codegen for xventanacondops with vt.maskcn => czero.nez and vt.maskc => czero.eqz. An additional difference is that zicond is available on RV32 in addition to RV64 (xventanacondops is RV64 only).
Differential Revision: https://reviews.llvm.org/D147147
show more ...
|
#
ac269d18 |
| 29-Mar-2023 |
Alex Bradbury <asb@igalia.com> |
[RISCV][test] Update CHECK lines in condops related tests in preparation for Zicond codegen
Prefixes like 'CONDOPS' referring to the xventanacondops extension are going to be confusing once zicond i
[RISCV][test] Update CHECK lines in condops related tests in preparation for Zicond codegen
Prefixes like 'CONDOPS' referring to the xventanacondops extension are going to be confusing once zicond is added to the mix.
show more ...
|
Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init |
|
#
86eff6be |
| 20-Jan-2023 |
Philip Reames <preames@rivosinc.com> |
[MachineCombiner] Use default latency model when no detailed model available
This change adjusts the cost modeling used when the target does not have a schedule model with individual instruction lat
[MachineCombiner] Use default latency model when no detailed model available
This change adjusts the cost modeling used when the target does not have a schedule model with individual instruction latencies. After this change, we use the default latency information available from TargetSchedule. The default latency information essentially ends up treating most instructions as latency 1, with a few "expensive" ones getting a higher cost.
Previously, we unconditionally applied the first legal pattern - without any consideration of profitability. As a result, this change both prevents some patterns being applied, and changes which patterns are exercised. (i.e. previously the first pattern was applied, afterwards, maybe the second one is because the first wasn't profitable.)
The motivation here is two fold.
First, this brings the default behavior in line with the behavior when -mcpu or -mtune is specified. This improves test coverage, and generally makes it less likely we will have bad surprises when providing more information to the compiler.
Second, this enables some reassociation for ILP by default. Despite being unconditionally enabled, the prior code tended to "reassociate" repeatedly through an entire chain and simply moving the first operand to the end. The result was still a serial chain, just a different one. With this change, one of the intermediate transforms is unprofitable and we end up with a partially flattened tree.
Note that the resulting code diffs show significant room for improvement in the basic algorithm. I am intentionally excluding those from this patch.
For the test diffs, I don't seen any concerning regressions. I took a fairly close look at the RISCV ones, but only skimmed the x86 (particularly vector x86) changes.
Differential Revision: https://reviews.llvm.org/D141017
show more ...
|
Revision tags: llvmorg-15.0.7 |
|
#
002005e6 |
| 22-Dec-2022 |
Hsiangkai Wang <hsiangkai@google.com> |
[RISCV] Add integer scalar instructions to isAssociativeAndCommutative
Inspired by D138107.
We can add ADD, AND, OR, XOR, MUL, MIN[U]/MAX[U] to isAssociativeAndCommutative to increase instruction-l
[RISCV] Add integer scalar instructions to isAssociativeAndCommutative
Inspired by D138107.
We can add ADD, AND, OR, XOR, MUL, MIN[U]/MAX[U] to isAssociativeAndCommutative to increase instruction-level parallelism by the existing MachineCombiner pass.
Differential Revision: https://reviews.llvm.org/D140530
show more ...
|
#
90cb5f2f |
| 20-Dec-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add +xventanacondops command line to select-binop-identity.ll. NFC
|
#
da7415ac |
| 17-Dec-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add support for predicating AND/OR/XOR/ADD/SUB with short-forward-branch-opt.
sifive-7-series can predicate ALU instructions in the shadow of a branch not just move instructions.
This patch
[RISCV] Add support for predicating AND/OR/XOR/ADD/SUB with short-forward-branch-opt.
sifive-7-series can predicate ALU instructions in the shadow of a branch not just move instructions.
This patch implements analyzeSelect/optimizeSelect to predicate these operations. This is based on ARM's implementation which can predicate using flags and condition codes.
I've restricted it to just the instructions we have test cases for, but it can be extended in the future.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D140053
show more ...
|
#
d741a31a |
| 14-Dec-2022 |
Nitin John Raj <nitin.raj@sifive.com> |
[RISCV][CodeGen][SelectionDAG] Recursively check hasAllNBitUsers for logical machine opcodes
We don’t have W versions of AND/OR/XOR/ANDN/ORN/XNOR so we should recursively check their users. We shoul
[RISCV][CodeGen][SelectionDAG] Recursively check hasAllNBitUsers for logical machine opcodes
We don’t have W versions of AND/OR/XOR/ANDN/ORN/XNOR so we should recursively check their users. We should limit the recursion to SelectionDAG::MaxRecursionDepth levels.
We need to add a Depth argument, all existing callers should pass 0 to the Depth. The new recursive calls should increment it by 1. At the top of the function we should give up and return false if Depth >= SelectionDAG::MaxRecursionDepth.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139462
show more ...
|
#
8eabbd3c |
| 14-Dec-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add missing signext attribute to test. NFC
The other operands in this function had it and every other test in the file has it. So I assume this was a mistake.
|
#
85834d86 |
| 06-Dec-2022 |
ChunyuLiao <chunyu@iscas.ac.cn> |
[RISCV]Keep (select c, 0/-1, X) during PerformDAGCombine
D135833, lowerSelect: (select C, -1/0, X) -> or/and Keep (select c, 0/-1, X), thus making better use of lowerSelect to eliminate branch instr
[RISCV]Keep (select c, 0/-1, X) during PerformDAGCombine
D135833, lowerSelect: (select C, -1/0, X) -> or/and Keep (select c, 0/-1, X), thus making better use of lowerSelect to eliminate branch instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139272
show more ...
|
#
e00e20a0 |
| 01-Dec-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add ADDW/AND/OR/XOR/SUB/SUBW to getRegAllocHints.
These instructions requires both register operands to be compressible so I've only applied the hint if we already have a GPRC physical regis
[RISCV] Add ADDW/AND/OR/XOR/SUB/SUBW to getRegAllocHints.
These instructions requires both register operands to be compressible so I've only applied the hint if we already have a GPRC physical register assigned for the other register operand.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D139079
show more ...
|
Revision tags: llvmorg-15.0.6 |
|
#
64612f5d |
| 25-Nov-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add ADD to getRegAllocationHints to improve to improve use of c.add.
add can always be compressed to c.add if one of the sources is the same as the destination.
The same is not true for c.a
[RISCV] Add ADD to getRegAllocationHints to improve to improve use of c.add.
add can always be compressed to c.add if one of the sources is the same as the destination.
The same is not true for c.addw where the registers need to be x8-x15.
show more ...
|
Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2 |
|
#
e8843241 |
| 03-Oct-2022 |
Philip Reames <preames@rivosinc.com> |
[RISCV] Generalize select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) ) transforms by removing and-clause
These transforms were recently added (by me) in D134881.
[RISCV] Generalize select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) ) transforms by removing and-clause
These transforms were recently added (by me) in D134881. Looking at the code again, I realized we don't need the (and x, 0x1) portion of the pattern, we just need to know that the result of that sub-tree is either 0 or 1. Checking for this directly allows us to match slightly more broadly. The test changes are zext i1 arguments, but this could also kick in for e.g. shifts of high bits, or any other source of known bits.
Differential Revision: https://reviews.llvm.org/D135081
show more ...
|
Revision tags: llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2 |
|
#
6f5edc34 |
| 10-Aug-2021 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add x, y))
Similar for sub except sub isn't commutative.
Modify the existing and/or/xor folds to also work on ISD::SEL
[RISCV] Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add x, y))
Similar for sub except sub isn't commutative.
Modify the existing and/or/xor folds to also work on ISD::SELECT and not just RISCVISD::SELECT_CC. This is needed to make sure we do this transform before type legalization turns i32 add/sub into add/sub+sign_extend_inreg on RV64. If we don't do this before that, the sign_extend_inreg will still be after the select.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D107603
show more ...
|
#
2dad7979 |
| 04-Aug-2021 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add test cases for conditional add/sub. NFC
InstCombine canonicalizes c ? (x+y) : x to (c ? y : 0) + x. It does the same for and/or/xor. We already reverse this transform for those, but don'
[RISCV] Add test cases for conditional add/sub. NFC
InstCombine canonicalizes c ? (x+y) : x to (c ? y : 0) + x. It does the same for and/or/xor. We already reverse this transform for those, but don't do add/sub yet.
show more ...
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
#
dcdda2bd |
| 29-Apr-2021 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Teach DAG combine to fold (and (select_cc lhs, rhs, cc, -1, c), x) -> (select_cc lhs, rhs, cc, x, (and, x, c))
Similar for or/xor with 0 in place of -1.
This is the canonical form produced
[RISCV] Teach DAG combine to fold (and (select_cc lhs, rhs, cc, -1, c), x) -> (select_cc lhs, rhs, cc, x, (and, x, c))
Similar for or/xor with 0 in place of -1.
This is the canonical form produced by InstCombine for something like `c ? x & y : x;` Since we have to use control flow to expand select we'll usually end up with a mv in basic block. By folding this we may be able to pull the and/or/xor into the block instead and avoid a mv instruction.
The code here is based on code from ARM that uses this to create predicated instructions. I'm doing it on SELECT_CC so it happens late, but we could do it on select earlier which is what ARM does. I'm not sure if we lose any combine opportunities if we do it earlier.
I left out add and sub because this can separate sext.w from the add/sub. It also made a conditional i64 addition/subtraction on RV32 worse. I guess both of those would be fixed by doing this earlier on select.
The select-binop-identity.ll test has not been commited yet, but I made the diff show the changes to it.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D101485
show more ...
|
#
60216ade |
| 29-Apr-2021 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add test cases for D101485. NFC
|