This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
[RVP] add p extension spec 0.94 support #258
Open
linsinan1995
wants to merge
44
commits into
riscvarchive:riscv-gcc-experiment
Choose a base branch
from
linsinan1995:riscv-gcc-experiment-p-ext
base: riscv-gcc-experiment
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
40b707b
Initial support for P extension with spec 0.93
linsinan1995 a5a1cde
[MD] add inst: add* kadd* ukadd* sub* ksub* uksub* kabs*
linsinan1995 93a9b01
[MD] add inst: ave,clorv*,clrs,clz,bitrev*,cmpeq*,cmix
linsinan1995 0e57031
[MD] add inst: *cras* and *crsa* instructions
linsinan1995 a9ef042
[MD] add inst: insb, KDMBB, KDMBT, KDMTT, KDMABB, KDMABT, KDMATT, KHM…
linsinan1995 635cb16
[MD] add inst: KMADA, KMAXDA, KMADS, KMADRS, KMAXDS, KMAR64, KMMAC, K…
linsinan1995 57ef6f0
[MD] add inst: KSLL[i]W, KSLL[i]8, KSLL[i]16, KSLL[i]32, KSLRA8[.u], …
linsinan1995 42de5c6
[MD] add inst: kstas16, kstas32, kstsa16, kstsa32
linsinan1995 5cde2ca
[MD] add inst: KWMMUL[.u], MADDR32, MSUBR32, MULR64,
linsinan1995 b9b38e9
[MD] add inst: PBSAD, PBSADA, PKBB[16|32], PKBT[16|32], PKTT[16|32], …
linsinan1995 07a1cf9
[MD] add inst: [U]RADD[8|16|32|64|W], [U]RSUB[8|16|32|64|W]
linsinan1995 eb2deaa
[MD] add inst: RDOV, RSTAS[16|32], RSTSA[16|32]
linsinan1995 e417827
[MD] add inst: SCLIP8, SCLIP16, SCLIP32, SCMPLE8, SCMPLE16, SCMPLT8, …
linsinan1995 2fa7f89
[MD] add inst: SMALBB, SMALBT, SMALTT, SMAL
linsinan1995 1e47eff
[MD] add inst: SMALDA, SMALXDA, SMALDS, SMALDRS, SMALXDS
linsinan1995 ba8adde
[MD] add inst: SMAR64, UMAR64, [U]SMAX 8|16 and [U]SMIN 8|16
linsinan1995 3888d34
[MD] add inst: SMAQA, SMAQA.SU, UMAQA, UMAQA.SU
linsinan1995 7cba08f
[MD] add inst: SMBB 16|32, SMBT 16|32, SMTT 16|32
linsinan1995 b48226a
[MD] add inst: SMDS, SMDRS, SMXDS, SMDS32, SMDRS32, SMXDS32
linsinan1995 42a62ad
[MD] add inst: SMMUL[.u], SMMWB[.u], SMMWT[.u]
linsinan1995 9c682c9
[MD] add inst: SMSLDA, SMSLXDA, SMSR64, UMSR64
linsinan1995 25af87e
[MD] add inst: SMUL 8|16, SMULX 8|16, UMUL 8|16, UMULX 8|16
linsinan1995 b73c9e6
[MD] add inst: SRA[I] 8|16|32, SRL[I] 8|16, SRA[I] 8|16|32 .u, SRL[I]…
linsinan1995 7033bce
[MD] add inst: STAS 16|32, STSA 16|32
linsinan1995 a9d6ff8
[MD] add inst: SUNPKD810, SUNPKD820, SUNPKD830, SUNPKD831, SUNPKD832,…
linsinan1995 9985a3e
[MD] add inst: swap8, rev8.h
linsinan1995 f456d05
[MD] add inst: UCLIP8|16|32, UCMPLE8|16, UCMPLT8|16
linsinan1995 645fa05
[MD] add inst: ukmar64, ukmsr64, ukstas16|32, UKSTSA16|32
linsinan1995 3f95aa5
[MD] add inst: WEXTI, WEXT, URSTSA 16|32, URSTAS 16|32
linsinan1995 e83976e
[MD] add inst: KDMBB16, KDMBT16, KDMTT16, KDMABB16, KDMABT16, KDMATT16
linsinan1995 4fb52d3
[MD] add inst: KHMBB16, KHMBT16, KHMTT16, KMABB32, KMABT32, KMATT32, …
linsinan1995 c3279f8
[MD] add inst: KMADS32, KMADRS32, KMAXDS32, KMSDA32, KMSXDA32
linsinan1995 0fd4800
[MD] add inst: fsr, fsri, fsrw, rev
linsinan1995 068483d
[MD] add move pattern for vector mode
linsinan1995 c9b28ca
[Builtin] add intrinsic builtins
linsinan1995 877993c
[intrinsic header] Add interface for intrinsics
linsinan1995 c56f60c
[builtin] Add type conversion while expanding builtins
linsinan1995 6e85e99
[Hook] Add TARGET_VECTOR_MODE_SUPPORTED_P implementation
linsinan1995 3d67b3f
[Hook] Add even-odd pair of register support in TARGET_HARD_REGNO_MOD…
linsinan1995 da54bac
[testcases] add testcases
linsinan1995 f4b6264
rvp: fix wrong format in maddr32 and msubr32
linsinan1995 cd35a41
rvp: use gcc standard name for rv32p mac operation
linsinan1995 418ddbd
update testcases
linsinan1995 7eeadf6
rvp: update to spec 0.9.11
linsinan1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -525,6 +525,7 @@ pru-*-*) | |
;; | ||
riscv*) | ||
cpu_type=riscv | ||
extra_headers="rvp_intrinsic.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest |
||
extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o" | ||
d_target_objs="riscv-d.o" | ||
;; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zprv?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapping here means the
p
flag in--with-arch=rv{xlen}gcp
or-march=rv{xlen}gcp
can be expanded torv{xlen}gc_zpn_zpsf
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Still I think that zprv should appear on xlen=64.
When I run
riscv64-unknown-elf-gcc -march=rv64imcbp -mabi=lp64 .....
on compiler with this PR, I getThis is so because
rv64imcbp
expands torv64imcb_zpn_zpsf
whilest it should expand torv64imcb_zpn_zpsf_zprv
becausezprv
is required onxlen=64
by spec (I simplify a bit: I didn't expand b to its zeds here because it is not the issue).If I do not treat warnings as errors, it obviously fails on linking with:
I faced a more general problem with this PR: when I compile my code with
riscv64-unknown-elf-gcc -march=rv64imcb -mabi=lp64 .....
(i.e. without p-ext) it fails on linking with this error:I have my own p-ext intrinsic file (which is generally
with different variations of types, number of arguments, clobbers and other stuff). I did so because I am not a pro at machine description language and also it seems to be a common way to implement intrinsics (e.g. https://github.com/rvkrypto/rvkrypto-fips/blob/main/rvkintrin.h).
So my intrinsics produce an assembler code with the specified insn if p-ext is enabled and make a call to (or inline -- depends on optimization levels) some generic-code functions otherwise.
When I found this PR, I expected it works the same way and in addition allows to optimize some generic code with emitting of p-ext insns.
As you mentioned in another topic, "generic code" should use very specific types defined in the same file where intrinsics are -- so we barely expect that such insns will appear on some code with common scalar types as b-ext insns do. It is ok for me: I understand that b-ext machine descriptions implement some simple stuff (e.g. bit set) and this PR operates with packed types so this is either very hard or impossible to map a set of scalar type insns to p-ext insn in most cases. Still I don't understand why intrinsics do not work (I mean do not provide generic code) without enabled p-ext and what should be done if I want to compile some file with the compiler which includes this intrinsic file without p-ext insns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @marcfedorow,
Thank you for pointing it out. I added a fix to support a different expansion on p flag (rv32p will be expanded into rv32_zpn_zpsf, and rv64p will be rv64_zpn_zprv_zpsf).
I think we do not have such a plan so far, since it requires a great amount of workload. I think it is a good idea though, so I will forward your message to other PLCT members in the further meetup.
Vector type
int16x4_t
doesn't need to be from p-ext header, since it is native support in GCC (https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html). To use intrinsic might be the only solution if you try to use scalar type instead of vector type (e.g. put int16x4_t data onto int64_t field), but p-ext insn is possible to be generated from scalar code through auto-vectorization. e.g.riscv64-unknown-elf-gcc -S -O3 add16.c
I hope I have answered all your questions. Thanks again.