New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal of the intrinsics for vector crypto #234
base: main
Are you sure you want to change the base?
Conversation
2a9812c
to
93dcd87
Compare
...ated/vector-crypto/intrinsic_funcs/00_zvbb_-_vector_bit-manipulation_used_in_cryptography.md
Outdated
Show resolved
Hide resolved
...ated/vector-crypto/intrinsic_funcs/00_zvbb_-_vector_bit-manipulation_used_in_cryptography.md
Outdated
Show resolved
Hide resolved
vuint64m8_t __riscv_vror_vx_u64m8_m (vbool8_t mask, vuint64m8_t vs2, uint64_t rs1, size_t vl); | ||
``` | ||
|
||
### [Vector Bit-manipulation used in Cryptography - Shift](): |
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.
We have signed and unsigned versions of vsll
, but this proposal only adds unsigned versions of vwsll
. I'm not proposing a change, just mentioning this asymmetry.
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.
Yes I am also aware of the asymmetry. The vector crypto instructions generally operates under an unsigned data type and all other intrinsics does not have variants for signed data type. So I think it is more reasonable to not a signed data type variant here.
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.
vwsll
will zero-extend vs2
to 2x SEW, so I think no signed version might be less confused.
auto-generated/vector-crypto/policy_funcs/llvm-api-tests/vclmul.c
Outdated
Show resolved
Hide resolved
auto-generated/vector-crypto/policy_funcs/llvm-api-tests/vclmul.c
Outdated
Show resolved
Hide resolved
auto-generated/vector-crypto/policy_funcs/llvm-api-tests/vclmul.c
Outdated
Show resolved
Hide resolved
auto-generated/vector-crypto/policy_funcs/llvm-api-tests/vclmul.c
Outdated
Show resolved
Hide resolved
} | ||
|
||
vuint32mf2_t test_vsm4r_vs_u32mf2(vuint32mf2_t vd, vuint32mf2_t vs2, size_t vl) { | ||
return __riscv_vsm4r_vs_u32mf2(vd, vs2, vl); |
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 think vs2
of .vs
type of this instruction should have lmul1
type.
auto-generated/vector-crypto/intrinsic_funcs/01_zvbc_-_vector_carryless_multiplication.md
Outdated
Show resolved
Hide resolved
auto-generated/vector-crypto/intrinsic_funcs/04_zvkned_-_nist_suite:_vector_aes_block_cipher.md
Outdated
Show resolved
Hide resolved
auto-generated/vector-crypto/intrinsic_funcs/05_zvkned_-_nist_suite:_vector_aes_block_cipher.md
Outdated
Show resolved
Hide resolved
93dcd87
to
766b9f7
Compare
Address comments from Craig, Nick, Brandon, and Nicholas. Thank you guys for the review. Changes:
|
Signed-off-by: eop Chen <eop.chen@sifive.com>
…ake git-commit-autogen-doc)
…git-commit-autogen-test)
Signed-off-by: eop Chen <eop.chen@sifive.com>
…ake git-commit-autogen-doc)
…git-commit-autogen-test)
Signed-off-by: eop Chen <eop.chen@sifive.com>
'vs' instructions will take the first element group from `vs2`, while `vd` can be other settings of register group. This commit adds extra variants for users to choose whatever suits their need. Signed-off-by: eop Chen <eop.chen@sifive.com>
…ake git-commit-autogen-doc)
…git-commit-autogen-test)
…s regarding zvl extensions Signed-off-by: eop Chen <eop.chen@sifive.com>
…tion Signed-off-by: eop Chen <eop.chen@sifive.com>
…git-commit-autogen-test)
- Add operand mnemonics for overloaded intrinsics of vaesef/vsaesem/vaesdf/vaesdm - Add vs2 operand for vaeskf2 - Fix vs2 data type for vwsll
…ake git-commit-autogen-doc)
…git-commit-autogen-test)
…esef/vsaesem/vaesdf/vaesdm Signed-off-by: eop Chen <eop.chen@sifive.com>
…ake git-commit-autogen-doc)
…git-commit-autogen-test)
Signed-off-by: eop Chen <eop.chen@sifive.com>
…git-commit-autogen-test)
…bit-manipulation_used_in_cryptography.md Co-authored-by: Nicolas Brunie <82109999+nibrunieAtSi5@users.noreply.github.com> Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
5b6e99f
to
29afe09
Compare
I'll take over and proceed to work on this patch~ |
29afe09
to
6da674a
Compare
6da674a
to
38e0cdc
Compare
Update (2023/11/11)
The vector crypto extension is now has a released v1.0.0 [0]. This PR creates intrinsics that exposes interfaces to the vector crypto instructions.
Regarding the data type used in the intrinsics added, this proposal does not model the concept of "element grouping (EGS/EGW)" and reuses the existing data types of the RVV intrinsics (e.g.
vuint32m1_t
,vuint64m2_t
).The LLVM implementation of the intrinsics is the following: (to be updated to latest v20230531)
[0] https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0