Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions crates/core_arch/src/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ pub use zk::*;
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_wu(src: *const u32) -> u32 {
let value: u32;
asm!(".insn i 0x73, 0x4, {}, {}, 0x681", out(reg) value, in(reg) src, options(readonly, nostack));
asm!(
".insn i 0x73, 0x4, {}, {}, 0x681",
lateout(reg) value,
in(reg) src,
options(readonly, nostack, preserves_flags)
);
value
}

Expand All @@ -38,7 +43,12 @@ pub unsafe fn hlv_wu(src: *const u32) -> u32 {
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_d(src: *const i64) -> i64 {
let value: i64;
asm!(".insn i 0x73, 0x4, {}, {}, 0x6C0", out(reg) value, in(reg) src, options(readonly, nostack));
asm!(
".insn i 0x73, 0x4, {}, {}, 0x6C0",
lateout(reg) value,
in(reg) src,
options(readonly, nostack, preserves_flags)
);
value
}

Expand All @@ -53,5 +63,10 @@ pub unsafe fn hlv_d(src: *const i64) -> i64 {
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hsv_d(dst: *mut i64, src: i64) {
asm!(".insn r 0x73, 0x4, 0x37, x0, {}, {}", in(reg) dst, in(reg) src, options(nostack));
asm!(
".insn r 0x73, 0x4, 0x37, x0, {}, {}",
in(reg) dst,
in(reg) src,
options(nostack, preserves_flags)
);
}
Loading