-
Notifications
You must be signed in to change notification settings - Fork 290
aes64ks1i
and aes64ks2
have wrong target feature
#1765
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
Comments
It would be nice if we can introduce a perma-unstable target feature What do you think about this @Amanieu? Should I go ahead and send a rustc PR? |
I'm inclined to agree, but would like a second opinion from @a4lg who has been working on RISC-V target features a lot. |
I'm not sure how to support (Zkne or Zknd) but not strongly against it (though I feel an uneasy feelings to Using underscores is a great idea since RISC-V extension names does not allow this symbol for extension names.
Edit: forget it. My idea gives wrong impression that |
InvMixColumns (what Anyway, I don't think the name matters that much, as it would be perma-unstable. I will try it out, and lyk if it works |
I tried it out, sadly it doesn't work in debug mode. The following code (compiled with a patched compiler that implied #![feature(riscv_target_feature, link_llvm_intrinsics, abi_unadjusted)]
#![allow(internal_features)]
#![crate_type = "lib"]
extern "unadjusted" {
#[link_name = "llvm.riscv.aes64ks2"]
fn foo(a: u64, b: u64) -> u64;
}
#[inline]
#[target_feature(enable = "zkne_or_zknd")]
pub fn bar(a: u64, b: u64) -> u64 {
unsafe { foo(a, b) }
}
#[inline(never)]
#[target_feature(enable = "zkne")]
pub fn baz(a: u64, b: u64) -> u64 {
bar(a, b)
} It compiles fine with opt-level 1 and above, but with opt-level 0, it tries to generate asm for CLang handles this kind of intrinsics by just defining a macro, but that is not a viable option for us too. Edit: this code would have worked if |
The RiscV ZK spec states that
aes64ks1i
andaes64ks2
is available whenever either one ofzkne
andzknd
is available (see here and here), but the current implementation uses#[target_feature(enable = "zkne", enable = "zknd")]
, which means the 2 functions require both ofzkne
andzknd
.I know Rust doesn't have any way of "OR"-ing target features, but can we do in this case? (Also these intrinsics are unstable, so no problems changing their signatures or anything 😄)
This was brought to my attention in rust-lang/rust#137293
The text was updated successfully, but these errors were encountered: