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 |
|
#
c03bf2c4 |
| 04-Aug-2024 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Improve hasAllNBitUsers for users of SLLI.
We can increase the number of Bits passes to the users by adding the shift amount.
|
Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
90109d44 |
| 14-May-2024 |
Alex Bradbury <asb@igalia.com> |
[RISCV] Improve constant materialisation for stores of i8 negative constants (#92131)
This follows the same pattern as 20e62658735a1b03ecadc. Although we
can't reduce the number of instructions use
[RISCV] Improve constant materialisation for stores of i8 negative constants (#92131)
This follows the same pattern as 20e62658735a1b03ecadc. Although we
can't reduce the number of instructions used, if we are able to use a
sign-extended 6-bit immediate then the 16-bit c.li instruction can be
selected (thus saving code size). Although this _could_ be gated so it
only happens if C is enabled, I've opted not to because at worst it's
neutral and it doesn't seem helpful to add unnecessary divergence
between the RVC and non-RVC paths.
show more ...
|
#
de14b749 |
| 14-May-2024 |
Alex Bradbury <asb@igalia.com> |
[RISCV][test] Precommit tests for byte store of -1
Although we can't reduce the number of instructions, if we selected `li rd, -1` instead then this could be encoded in a 16-bit instruction.
|
#
5baf58b6 |
| 09-May-2024 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Improve use of BSETI/BCLRI in constant materialization. (#91546)
We failed to use BSETI when bit 31 was set and a few bits above bit 31
were set. We also failed to use multiple BSETI when t
[RISCV] Improve use of BSETI/BCLRI in constant materialization. (#91546)
We failed to use BSETI when bit 31 was set and a few bits above bit 31
were set. We also failed to use multiple BSETI when the low 32 bits were
zero.
I've removed the special cases for constants 0x80000000-0xffffffff and
wrote a more generic algorithm for BSETI.
I've rewritten the BCLRI handling to be similar to the new BSETI
algorithm. This picks up cases where bit 31 is 0 and only a few high
bits are 0.
show more ...
|
#
36d8b37d |
| 08-May-2024 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add another missed Zbs constant materialization test. NFC
This can be LI+BCLRI+BCLRI.
|
#
c0b5a96a |
| 08-May-2024 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add tests where we could use Zbs instructions in constant materialization. NFC
|
Revision tags: 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, llvmorg-19-init |
|
#
ce570d1a |
| 30-Nov-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Remove old FIXMEs from test. NFC
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4 |
|
#
109aa586 |
| 26-Oct-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Add an experimental pseudoinstruction to represent a rematerializable constant materialization sequence. (#69983)
Rematerialization during register allocation is currently limited to a
sing
[RISCV] Add an experimental pseudoinstruction to represent a rematerializable constant materialization sequence. (#69983)
Rematerialization during register allocation is currently limited to a
single instruction with no inputs.
This patch introduces a pseudoinstruction that represents the
materialization of a constant. I've started with a sequence of 2
instructions for now, which covers at least the common LUI+ADDI(W) case.
This instruction will be expanded into real instructions immediately
after register allocation using a new pass. This gives the post-RA
scheduler a chance to separate the 2 instructions to improve ILP.
I believe this matches the approach used by AArch64.
Unfortunately, this loses some CSE opportunies when an LUI value is used
by multiple constants with different LSBs.
This feature is off by default and a new backend command line option is
added to enable it for testing.
This avoids the spill and reloads reported in #69586.
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 |
|
#
3c0990c1 |
| 02-Oct-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Generalize the (ADD (SLLI X, 32), X) special case in constant materialization. (#66931)
We don't have to limit ourselves to a shift amount of 32. We can support
other shift amounts that mak
[RISCV] Generalize the (ADD (SLLI X, 32), X) special case in constant materialization. (#66931)
We don't have to limit ourselves to a shift amount of 32. We can support
other shift amounts that make the upper 32 bits line up.
show more ...
|
#
c75e3ea4 |
| 28-Sep-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Improve constant materialization by using a sequence that end… (#66943)
…s with 2 addis in some cases.
If the lower 13 bits are something like 0x17ff, we can first materialize
it as 0x18
[RISCV] Improve constant materialization by using a sequence that end… (#66943)
…s with 2 addis in some cases.
If the lower 13 bits are something like 0x17ff, we can first materialize
it as 0x1800 followed by an addi to subtract a small offset. This might
be cheaper to materialize since the constant ending in 0x1800 can use a
simm12 immediate for its final addi.
show more ...
|
#
cbd45961 |
| 21-Sep-2023 |
Craig Topper <craig.topper@sifive.com> |
Recommmit "[RISCV] Improve contant materialization to end with 'not' if the cons… (#66950)"
With MC test updates.
Original commit message
We can invert the value and treat it as if it had leading
Recommmit "[RISCV] Improve contant materialization to end with 'not' if the cons… (#66950)"
With MC test updates.
Original commit message
We can invert the value and treat it as if it had leading zeroes.
show more ...
|
#
ea064ba6 |
| 21-Sep-2023 |
Craig Topper <craig.topper@sifive.com> |
Revert "[RISCV] Improve contant materialization to end with 'not' if the cons… (#66950)"
This reverts commit a8b8e9476451e125e81bd24fbde6605246c59a0e.
Forgot to update MC tests.
|
#
a8b8e947 |
| 20-Sep-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Improve contant materialization to end with 'not' if the cons… (#66950)
…tant has leading ones.
We can invert the value and treat it as if it had leading zeroes.
|
Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4 |
|
#
319aba64 |
| 01-Sep-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Teach MatInt to use (ADD_UW X, (SLLI X, 32)) to materialize some constants.
If the high and low 32 bits are the same, we try to use (ADD X, (SLLI X, 32)) but that only works if bit 31 is cle
[RISCV] Teach MatInt to use (ADD_UW X, (SLLI X, 32)) to materialize some constants.
If the high and low 32 bits are the same, we try to use (ADD X, (SLLI X, 32)) but that only works if bit 31 is clear since the low 32 bits will be sign extended.
If we have Zba we can use add.uw to zero the sign extended bits.
Reviewed By: reames, wangpc
Differential Revision: https://reviews.llvm.org/D159253
show more ...
|
Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
b418482f |
| 12-Jun-2023 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Don't use (ADD (SLLI C, 32), C) to materialize constants when optimizing for size.
Addresses post-commit feedback from D152236.
Reviewed By: asb, dtcxzyw
Differential Revision: https://rev
[RISCV] Don't use (ADD (SLLI C, 32), C) to materialize constants when optimizing for size.
Addresses post-commit feedback from D152236.
Reviewed By: asb, dtcxzyw
Differential Revision: https://reviews.llvm.org/D152602
show more ...
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3 |
|
#
fc02eeb2 |
| 13-Feb-2023 |
Philipp Tomsich <philipp.tomsich@vrull.eu> |
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
The vendor-defined XTHeadBb (predating the standard Zbb extension) extension adds some bit-manipulation extensions with somewha
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
The vendor-defined XTHeadBb (predating the standard Zbb extension) extension adds some bit-manipulation extensions with somewhat similar semantics as some of the Zbb instructions.
It is supported by the C9xx cores (e.g., found in the wild in the Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for XTHeadBb is available from: https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da
Depends on D143036
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D143439
show more ...
|
#
b0c31322 |
| 08-Feb-2023 |
Philipp Tomsich <philipp.tomsich@vrull.eu> |
Revert "[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension"
This reverts commit 19a59099095b3cbc9846e5330de26fca0a44ccbe.
|
Revision tags: llvmorg-16.0.0-rc2 |
|
#
19a59099 |
| 31-Jan-2023 |
Philipp Tomsich <philipp.tomsich@vrull.eu> |
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
The vendor-defined XTHeadBb (predating the standard Zbb extension) extension adds some bit-manipulation extensions with somewha
[RISCV] Add vendor-defined XTheadBb (basic bit-manipulation) extension
The vendor-defined XTHeadBb (predating the standard Zbb extension) extension adds some bit-manipulation extensions with somewhat similar semantics as some of the Zbb instructions.
It is supported by the C9xx cores (e.g., found in the wild in the Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for XTHeadBb is available from: https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da
Depends on D143036
Differential Revision: https://reviews.llvm.org/D143439
show more ...
|
Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
1456b686 |
| 19-Dec-2022 |
Nikita Popov <npopov@redhat.com> |
[RISCV] Convert some tests to opaque pointers (NFC)
|
#
564e09c7 |
| 08-Dec-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Use bseti for 2048 in RISCVMatInt when Zbs is enabled.
2048 requires an LUI and ADDI instruction due to ADDI using a signed immediate. It can also be done with C.LI+C.SLLI for better code si
[RISCV] Use bseti for 2048 in RISCVMatInt when Zbs is enabled.
2048 requires an LUI and ADDI instruction due to ADDI using a signed immediate. It can also be done with C.LI+C.SLLI for better code size.
With Zbs we can use a single BSETI to have an instruction.
Reorder the checks so that BSETI is checked first, with an extra qualification to prefer a single LUI or ADDI when possible. I'm continuing to think about other ways to structure this code, but this works for now.
Fixes PR59362.
show more ...
|
Revision tags: llvmorg-15.0.6 |
|
#
a2b5b584 |
| 25-Nov-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Use register allocation hints to improve use of compressed instructions.
Compressed instructions usually require one of the source registers to also be the source register. The register allo
[RISCV] Use register allocation hints to improve use of compressed instructions.
Compressed instructions usually require one of the source registers to also be the source register. The register allocator doesn't have that bias on its own.
This patch adds register allocation hints to introduce this bias. I've started with ADDI, ADDIW, and SLLI. These all have a 5-bit field for the register. If the source and dest register are the same they are guaranteed to compress as long as the immediate is also 6 bits.
This code was inspired by similar code from the SystemZ target.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D138242
show more ...
|
Revision tags: llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, 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 |
|
#
5c383731 |
| 29-Apr-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Improve constant materialization for cases that can use LUI+ADDI instead of LUI+ADDIW.
It's possible that we have a constant that isn't simm32 so we can't use LUI+ADDIW, but we can use LUI+A
[RISCV] Improve constant materialization for cases that can use LUI+ADDI instead of LUI+ADDIW.
It's possible that we have a constant that isn't simm32 so we can't use LUI+ADDIW, but we can use LUI+ADDI. Because ADDI uses a sign extended constant, it's possible that after subtracting it out, we end up with a simm32 that maps to LUI.
This patch detects this case after removing Lo12 and before shifting the value for SLLI.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D124222
show more ...
|
Revision tags: llvmorg-14.0.3, llvmorg-14.0.2 |
|
#
9534811a |
| 21-Apr-2022 |
Craig Topper <craig.topper@sifive.com> |
[RISCV] Teach generateInstSeqImpl to generate BSETI for single bit cases.
If the immediate has one bit set, but isn't a simm32 we can try the BSETI instruction from Zbs.
|