51 Commits

Author SHA1 Message Date
Jim Tsung-Chun Lin
036cd27da2 [RISCV] Fix typo in RISCVISAInfoTest.cpp. NFC.
ExtsRV32G -> ExtsRV64G.
2024-11-21 09:54:50 +08:00
Jim Lin
956361ca08
[RISCV] Zabha/Zacas implies Zaamo (#115694)
The Zabha/Zacas extension depends upon the Zaamo extension. 
Ref: https://github.com/riscv/riscv-isa-manual/blob/main/src/zacas.adoc
https://github.com/riscv/riscv-isa-manual/blob/main/src/zabha.adoc.
2024-11-12 15:49:34 +08:00
T-Tie
c17a914675
[RISCV] Add Smdbltrp and Ssdbltrp extension (#111837)
Smdbltrp and Ssdbltrp supports are added in this PR.
Specification link(Smdbltrp) :
[https://github.com/riscv/riscv-isa-manual/blob/main/src/smdbltrp.adoc](url)
Specification link(Ssdbltrp) :
[https://github.com/riscv/riscv-isa-manual/blob/main/src/ssdbltrp.adoc](url)
2024-11-08 15:01:51 +08:00
Jubilee
f53889ffca
[RISCV] Allow crypto features to imply dependents (#112659)
This relationship is a logical dependency.

Note Zvbc and Zvknhb. They are explicitly called out in the spec as
requiring 64 bits:
-
56ed7952d1/doc/vector/riscv-crypto-spec-vector.adoc
2024-10-29 10:07:20 -07:00
Alex Bradbury
7544d3af0e
[RISCV] Mark RVB23U64 and RVB23S64 as non-experimental (#113918)
The specification was recently ratified

<https://github.com/riscv/riscv-profiles/blob/main/src/rvb23-profile.adoc>.
2024-10-29 07:57:34 +00:00
Alex Bradbury
ba7555e640
[RISCV] Mark the RVA23S64 and RVA23U64 profiles as non-experimental (#113826)
All of the extensions used by these profile are themselves
non-experimental, and RVA23 was just ratified

<https://riscv.org/announcements/2024/10/risc-v-announces-ratification-of-the-rva23-profile-standard/>.

<https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc>

We lack a way of expressing `Ss1p13` (supervisor architecture 1.13), but
this is a problem we have for RVA22 (Ss1p12) and RVA20 (Ss1p11) so I
don't feel it's a blocker.
2024-10-28 12:56:47 +00:00
dong-miao
75c75fc16e
[RISCV]Add svvptc extension (#113882) 2024-10-28 22:54:51 +11:00
Alex Bradbury
35f6cc6af0
[RISCV] Add the Sha extension (#113820)
This was introduced in the now-ratified RVA23 profile (and also added to
the RVA22 text) as a simple way of referring to H plus the set of
supervisor extensions required by RVA23.
https://github.com/riscv/riscv-profiles/blob/main/src/rva23-profile.adoc

This patch simply defines the extension. The next patch will adjust the
RVA23 profile to use it, and at that point I think we will be ready to
mark RVA23 as non-experimental.

Note that I haven't made it so if you enable all extensions that
constitute Sha, Sha is implied. Per #76893 (adding 'B'), the concern is
making this implication might break older external assemblers. Perhaps
this is less of a concern given the relative frequency of
`-march=${foo}_zba_zbb_zbs` vs the collection of H extensions. If we did
want to add that implication, we'd probably want to add it in a separate
patch so it can be easily reverted if found to cause problems.
2024-10-28 07:42:33 +00:00
Alex Bradbury
2c0b34852a
[RISCV] Mark pointer masking extensions as non-experimental (#113618)
These extensions were ratified very recently.

<https://lf-riscv.atlassian.net/wiki/spaces/HOME/pages/16154732/Ratified+Extensions>

I've ensured we have definitions for all extensions in the document
<https://drive.google.com/file/d/159QffOTbi3EEbdkKndYRZ2c46D25ZLmO/view?usp=drive_link>.
There are no additional CSRs.
2024-10-25 12:24:50 +01:00
dong-miao
ed6ddffb58
[RISCV] Add Smrnmi extension (#111668)
This commit has completed the Extension for Resumable Non Maskable
Interrupts, adding four CRSs and one Trap-Return instruction.
Specification link:["Smrnmi"
Extension](https://github.com/riscv/riscv-isa-manual/blob/main/src/rnmi.adoc)

---------

Co-authored-by: Sam Elliott <sam@lenary.co.uk>
2024-10-25 18:41:21 +11:00
Alex Bradbury
614aeda93b
[RISCV] Mark Zacas as non-experimental (#109651)
The extension has been ratified for some time, but we kept it
experimental (see #99898) due to
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/444>. The
ABI issue has been resolved by #101023 so I believe there's no known
barrier to moving Zacas to non-experimental.
2024-09-25 06:14:43 +01:00
Craig Topper
0ca77f6656
[RISCV] Add CSRs and an instruction for Smctr and Ssctr extensions. (#105148)
https://github.com/riscv/riscv-control-transfer-records/releases/tag/v1.0_rc3
2024-08-21 19:23:07 -07:00
Shao-Ce SUN
bacedb5684
[RISCV] Remove experimental for Ssqosid ext (#105476)
Ratified: https://github.com/riscv/riscv-ssqosid/releases/tag/v1.0
2024-08-21 16:42:16 +08:00
Craig Topper
371f936c45 [RISCV] Make extension names lower case in RISCVISAInfo::checkDependency() error messages. 2024-08-19 00:22:28 -07:00
Craig Topper
d489b7ccb7 [RISCV] Merge some ISA error reporting together and make some errors more precise.
Loop over the extension names that have the same error message.

Print the name of Zvk* extensions instead of 'zvk*'.
2024-08-19 00:22:28 -07:00
Craig Topper
f802c39cea [RISCV] Add more tests for RISCVISAInfo::checkDependency(). NFC 2024-08-18 23:59:25 -07:00
Pengcheng Wang
a80a90e34b
[RISCV][MC] Support experimental extensions Zvbc32e and Zvkgs (#103709)
These two extensions add addtional instructions for carryless
multiplication with 32-bits elements and Vector-Scalar GCM
instructions.

Please see https://github.com/riscv/riscv-isa-manual/pull/1306.
2024-08-19 11:50:32 +08:00
Alex Bradbury
70e7d26e56
[RISCV] Mark zacas as experimental again due to unresolved ABI issue (#99898)
As discussed at the last sync-up call, mark Zacas as experimental until
this ABI issue is resolved
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/444>.

Don't return Zacas in getHostCPUFeatures (leaving a TODO there) as even if requesting detection of "native" features, the user likely doesn't want to automatically opt in to experimental codegen.
2024-07-23 08:06:15 +01:00
Yeting Kuo
58c7df90f8
[RISCV] Bump the version of Zicfilp/Zicfiss to 1.0 (#98891)
Both of them are ratified now.
https://wiki.riscv.org/display/HOME/Ratified+Extensions

This patch does not set them to non-experimental, since Zicfilp lacks
lld support and Zicfiss also lacks compiler-rt/libunwind support.
2024-07-16 14:38:08 +08:00
Shao-Ce SUN
cd6750fa5f
[RISCV][NFC] Add a newline when using --print-enabled-extensions (#98425)
The `--print-enabled-extensions` has been introduced in the
https://github.com/llvm/llvm-project/pull/98207 , but it seems to be
missing a newline in the end.
2024-07-11 12:43:14 +08:00
R
3c5f929ad0
[RISCV] Add QingKe "XW" compressed opcode extension (#97925)
This extension consists of 8 additional 16-bit compressed forms for
existing standard load/store opcodes.

These opcodes are found in some RISC-V microcontrollers from WCH /
Nanjing Qinheng Microelectronics.

As discussed in the Discourse forums, this uses incompatible extension
and opcode names vs the vendor binary toolchain. The chosen names
instead follow the conventions for other vendor extensions listed on the
"riscv-non-isa" project.
2024-07-11 11:10:02 +08:00
Michael Maitland
eee5d2d37c
[RISCV] Add ability to list extensions enabled for a target (#98207)
bb83a3d introduced `--print-enabled-extensions` command line option for
AArch64. This patch introduces RISC-V support for this option. This patch
adds documentation for this option.

`riscvExtensionsHelp` is renamed to `printSupportedExtensions` to by
synonymous with AArch64 and so it is clear what that function does.
2024-07-10 15:39:08 -04:00
Philip Reames
90d79e258e Reapply "[RISCV] Remove experimental from Ztso. (#96465)"
This was reverted in f985a8826bfa4ca3d23e654185de35e30ea6dc79.  Since that,
the default WMO lowering has moved to A67 compatible, the ABI attribute
emission has landed (off by default), and the LLD change to merge said
attributes have landed.  Our ztso lowering is believed to also be A67
compatible, and no known issues remain.

Original commit message:

Ztso 1.0 was ratified in January 2023.
Documentation:
https://github.com/riscv/riscv-isa-manual/blob/main/src/ztso-st-ext.adoc
2024-07-09 10:45:56 -07:00
Jianjian Guan
3259768557
[RISCV] Remove experimental for bf16 extensions (#97996)
They are already ratified now.
2024-07-09 14:34:03 +08:00
Craig Topper
87de49753d
[RISCV] Remove IgnoreUnknown from RISCVISAInfo::parseArchString. (#97372)
This isn't used in tree, and thus I don't know what the expectations for
its behavior really are. The original usage of this feature has been replaced
by parseNormalizedArchString.
2024-07-02 09:39:59 -07:00
Michael Maitland
dade11f55e
[RISCV] Bump Pointer Masking extension version (#96715)
These extensions had their version number bumped and still experimental
(under public review). I didn't see anything in the [commit
history](https://github.com/riscv/riscv-j-extension/commits/master/)
since #79929 that would warrant a change to the implementation of
pointer masking in the compiler.
2024-06-27 11:42:05 -04:00
Philip Reames
f985a8826b Revert "[RISCV] Remove experimental from Ztso. (#96465)"
This reverts commit 9cd6ef4b8a5c843ef491437c765d4cb2ff2f8fe3.  See
discussion on review thread.
2024-06-24 08:32:28 -07:00
Yingwei Zheng
9cd6ef4b8a
[RISCV] Remove experimental from Ztso. (#96465)
Ztso 1.0 was ratified in January 2023.
Documentation:
https://github.com/riscv/riscv-isa-manual/blob/main/src/ztso-st-ext.adoc
2024-06-24 20:10:42 +08:00
Jianjian Guan
7625465651
[RISCV] Make M imply Zmmul (#95070)
According to the spec, M implies Zmmul.
2024-06-21 11:11:10 +08:00
Monad
2fe72385a4
[RISCV] Add Smcsrind and Sscsrind extension (#93952)
Specification link:
https://github.com/riscv/riscv-isa-manual/blob/main/src/indirect-csr.adoc


Some CSRs (`*ireg` and `*iselect`) in Smcsrind/Sscsrind extensions are
originally defined as part of the Smaia/Ssaia extensions and are already
supported in LLVM. The missing CSRs (`*ireg2` to `*ireg6` for `m`, `s`,
and `vs`) are added in this PR.
2024-06-12 14:33:12 +08:00
Monad
307d91ee62
[RISCV] Add smcdeleg and ssccfg extensions (#95163)
Specification:
https://github.com/riscv/riscv-isa-manual/blob/main/src/smcdeleg.adoc

`Ssccfg` introduces one new CSR `scountinhibit`.
2024-06-12 12:43:39 +08:00
Pengcheng Wang
1bebb99324
[RISCV] Add B extension (#76893)
It seems that we have `B` extension again:
https://github.com/riscv/riscv-b

According to the spec, `B` extension represents the collection of
the `Zba`, `Zbb`, `Zbs` extensions.

Though it hasn't been ratified, I set its version to `1.0`.
2024-06-11 14:06:23 +08:00
AlexGhiti
6b7444964a
[RISCV] Remove experimental from Zabha (#93831)
The Zabha extension was ratified in April 2024.

Co-authored-by: Alexandre Ghiti <alexghiti@rivosinc.com>
2024-06-03 17:27:02 +08:00
Brandon Wu
8be079cddd
[RISCV] Bump Zaamo and Zalrsc to version 1.0 (#91556)
The ratified information can be found here:
https://wiki.riscv.org/display/HOME/Ratified+Extensions
2024-05-21 12:04:46 +08:00
Alex Bradbury
891d687137
[RISCV] Gate unratified profiles behind -menable-experimental-extensions (#92167)
As discussed in the last sync-up call, because these profiles are not
yet finalised they shouldn't be exposed to users unless they opt-in to
them (much like experimental extensions). We may later want to add a
more specific flag, but reusing `-menable-experimental-extensions`
solves the immediate problem.

This is implemented using the new support for marking profiles s
experimental added in #91993 to move the unratified profiles to
RISCVExperimentalProfile and making the necessary changes to logic in
RISCVISAInfo to handle this.
2024-05-15 21:09:43 +01:00
Alex Bradbury
24c39261e6 [RISCV][test] Add tests for parsing profiles using RISCVISAInfo::parseArchString 2024-05-15 21:04:20 +01:00
Craig Topper
d8f8ac8f5f
[RISCV] Don't pre-split before the loop in parseNormalizedArchString. (#91684)
We can extract each extension as we process them without much
complexity.

I changed the error message for cases where there are double underscores
or a trailing underscore. I think this is an improvement over the
previous error.
2024-05-10 08:59:56 -07:00
Craig Topper
0d93b01c3b
[RISCV] Don't crash if parseNormalizedArchString encounters a multi-letter extension with an unknown prefix. (#91398)
The sorting code previously asserted if a prefix was multiple letters,
but didn't start with s, x, or z.

Replace the assert with an explicit check and sort the multi-letter
extension after the known multi-letter prefixes.
2024-05-07 21:18:28 -07:00
Craig Topper
2c20995781
[RISCV] Detect duplicate extensions in parseNormalizedArchString. (#91416)
This detects the same extension name being added twice. Mostly I'm
worried about the case that the same string appears with two different
versions. We will only preserve one of the versions.

We could allow the same version to be repeated, but that doesn't seem
useful at the moment.

I've updated addExtension to use map::emplace instead of
map::operator[]. This means we only keep the first version if there are
duplicates. Previously we kept the last version, but that shouldn't matter
now that we don't allow duplicates. parseArchString already doesn't allow
duplicates.
2024-05-07 20:56:55 -07:00
Craig Topper
117bda523e [RISCV] Add unittests for MinVLen/MaxELen/MaxElenFp for ParseArchString. NFC
We had tests for ParseNormalizedArchString, but not ParseArchString.
The ParseNormalizedArchString test was not checking MaxElenFp.
2024-05-07 12:57:54 -07:00
Craig Topper
6cba93f25d [RISCV] Add partial validation of S and X extension names to RISCVISAInfo::parseNormalizedArchString.
Extensions starting with 's' or 'x' should always be followed by an
alphabetical character.  I don't know of any crashes from this currently,
but it seemed better to be defensive.
2024-05-07 12:16:55 -07:00
Craig Topper
0faf494200
[RISCV] Make parseArchString only accept [a-z0-9_]. (#90879)
Similar change was recently made to parseNormalizedArchString.
2024-05-03 09:29:27 -07:00
Craig Topper
7a6847e001
[RISCV] Add partial validation of Z extension name to RISCVISAInfo::parseNormalizedArchString (#90895)
If 'z' is given as the complete extension name or with a digit after it,
it will crash in the extension map compare function. Check for these
cases and give an error.
2024-05-03 09:29:11 -07:00
Craig Topper
5445a35d6e
[RISCV] Detect empty extension name after parsing MajorVersion in parseNormalizedArchString. (#90790)
If the string is just a version, we will end up adding an empty string
as an extension which crashes in the compare function for the std::map.
2024-05-02 10:08:35 -07:00
Craig Topper
941eab102f
[RISCV] Make parseNormalizedArchString only accept [a-z0-9_]. (#90815)
Previously we only rejected upper case characters. We should instead
reject anything except lower case, numbers, and underscore. Other
characters will likely confuse the extension sorting.
2024-05-02 09:39:52 -07:00
Craig Topper
44645996b0
[RISCV] Add smstateen extension (#90818) 2024-05-02 09:12:44 -07:00
Craig Topper
ab8ac36f10
[RISCV] Add list of supported profiles to -print-supported-extensions (#90757)
I tried also printing the -march they correspond to, but it seemed
overly verbose and caused line wraps. It might be better if we remove
the versions numbers from the string or did a more intelligent line
wrap.
2024-05-02 08:18:02 -07:00
Craig Topper
09f4b06dde
[RISCV] Refactor profile selection in RISCVISAInfo::parseArchString. (#90700)
Instead of hardcoding the 4 current profile prefixes, treat profile
selection as a fallback if we don't find "rv32" or "rv64".

Update the error message accordingly.
2024-05-01 10:39:24 -07:00
David Spickett
6f02120ac4
[llvm][RISCV] Improve error message for invalid extension letters (#90468)
Previously you got:
clang: error: invalid arch name 'rv64v', first letter should be 'e', 'i'
or 'g'

Which to me, unfamiliar with riscv, reads as if I should have used
"[eig]rv64v". Which is not what clang means.

Include the first bit in the error message to make this clearer:
clang: error: invalid arch name 'rv64v', first letter after 'rv64'
should be 'e', 'i' or 'g'
2024-04-29 16:51:09 +01:00
Craig Topper
de375fbc71 [RISCV] Move OrderedExtensionMap typedef to RISCVISAUtils.h. NFC 2024-04-26 17:57:51 -07:00