Add tracking issue for RISC-V intrinsics

This commit is contained in:
Amanieu d'Antras 2023-05-03 17:51:33 +01:00
parent 3243b5b41f
commit 5f29166d6a
5 changed files with 169 additions and 47 deletions

View file

@ -16,6 +16,7 @@ pub use zk::*;
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.WU`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[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));
@ -33,6 +34,7 @@ pub unsafe fn hlv_wu(src: *const u32) -> u32 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.D`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[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));
@ -48,6 +50,7 @@ pub unsafe fn hlv_d(src: *const i64) -> i64 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HSV.D`
/// instruction which is effectively a dereference to any memory address.
#[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));
}

View file

@ -4,7 +4,7 @@ mod p;
mod zb;
mod zk;
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub use p::*;
pub use zb::*;
pub use zk::*;
@ -16,7 +16,7 @@ use crate::arch::asm;
/// The PAUSE instruction is a HINT that indicates the current hart's rate of instruction retirement
/// should be temporarily reduced or paused. The duration of its effect must be bounded and may be zero.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn pause() {
unsafe { asm!(".insn i 0x0F, 0, x0, x0, 0x010", options(nomem, nostack)) }
}
@ -26,7 +26,7 @@ pub fn pause() {
/// The NOP instruction does not change any architecturally visible state, except for
/// advancing the `pc` and incrementing any applicable performance counters.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn nop() {
unsafe { asm!("nop", options(nomem, nostack)) }
}
@ -37,7 +37,7 @@ pub fn nop() {
/// until an interrupt might need servicing. This instruction is a hint,
/// and a legal implementation is to simply implement WFI as a NOP.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn wfi() {
asm!("wfi", options(nomem, nostack))
}
@ -50,7 +50,7 @@ pub unsafe fn wfi() {
/// FENCE.I does not ensure that other RISC-V harts' instruction fetches will observe the
/// local hart's stores in a multiprocessor system.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn fence_i() {
asm!("fence.i", options(nostack))
}
@ -64,7 +64,7 @@ pub unsafe fn fence_i() {
/// virtual address in parameter `vaddr` and that match the address space identified by integer
/// parameter `asid`, except for entries containing global mappings.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_vma(vaddr: usize, asid: usize) {
asm!("sfence.vma {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
}
@ -76,7 +76,7 @@ pub unsafe fn sfence_vma(vaddr: usize, asid: usize) {
/// The fence also invalidates all address-translation cache entries that contain leaf page
/// table entries corresponding to the virtual address in parameter `vaddr`, for all address spaces.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_vma_vaddr(vaddr: usize) {
asm!("sfence.vma {}, x0", in(reg) vaddr, options(nostack))
}
@ -90,7 +90,7 @@ pub unsafe fn sfence_vma_vaddr(vaddr: usize) {
/// address-translation cache entries matching the address space identified by integer
/// parameter `asid`, except for entries containing global mappings.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_vma_asid(asid: usize) {
asm!("sfence.vma x0, {}", in(reg) asid, options(nostack))
}
@ -101,7 +101,7 @@ pub unsafe fn sfence_vma_asid(asid: usize) {
/// tables, for all address spaces. The fence also invalidates all address-translation cache entries,
/// for all address spaces.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_vma_all() {
asm!("sfence.vma", options(nostack))
}
@ -111,7 +111,7 @@ pub unsafe fn sfence_vma_all() {
/// This instruction invalidates any address-translation cache entries that an
/// `SFENCE.VMA` instruction with the same values of `vaddr` and `asid` would invalidate.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sinval_vma(vaddr: usize, asid: usize) {
// asm!("sinval.vma {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
asm!(".insn r 0x73, 0, 0x0B, x0, {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
@ -122,7 +122,7 @@ pub unsafe fn sinval_vma(vaddr: usize, asid: usize) {
/// This instruction invalidates any address-translation cache entries that an
/// `SFENCE.VMA` instruction with the same values of `vaddr` and `asid` would invalidate.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sinval_vma_vaddr(vaddr: usize) {
asm!(".insn r 0x73, 0, 0x0B, x0, {}, x0", in(reg) vaddr, options(nostack))
}
@ -132,7 +132,7 @@ pub unsafe fn sinval_vma_vaddr(vaddr: usize) {
/// This instruction invalidates any address-translation cache entries that an
/// `SFENCE.VMA` instruction with the same values of `vaddr` and `asid` would invalidate.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sinval_vma_asid(asid: usize) {
asm!(".insn r 0x73, 0, 0x0B, x0, x0, {}", in(reg) asid, options(nostack))
}
@ -142,7 +142,7 @@ pub unsafe fn sinval_vma_asid(asid: usize) {
/// This instruction invalidates any address-translation cache entries that an
/// `SFENCE.VMA` instruction with the same values of `vaddr` and `asid` would invalidate.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sinval_vma_all() {
asm!(".insn r 0x73, 0, 0x0B, x0, x0, x0", options(nostack))
}
@ -152,7 +152,7 @@ pub unsafe fn sinval_vma_all() {
/// This instruction guarantees that any previous stores already visible to the current RISC-V hart
/// are ordered before subsequent `SINVAL.VMA` instructions executed by the same hart.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_w_inval() {
// asm!("sfence.w.inval", options(nostack))
asm!(".insn i 0x73, 0, x0, x0, 0x180", options(nostack))
@ -163,7 +163,7 @@ pub unsafe fn sfence_w_inval() {
/// This instruction guarantees that any previous SINVAL.VMA instructions executed by the current hart
/// are ordered before subsequent implicit references by that hart to the memory-management data structures.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn sfence_inval_ir() {
// asm!("sfence.inval.ir", options(nostack))
asm!(".insn i 0x73, 0, x0, x0, 0x181", options(nostack))
@ -178,7 +178,7 @@ pub unsafe fn sfence_inval_ir() {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.B`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_b(src: *const i8) -> i8 {
let value: i8;
asm!(".insn i 0x73, 0x4, {}, {}, 0x600", out(reg) value, in(reg) src, options(readonly, nostack));
@ -194,7 +194,7 @@ pub unsafe fn hlv_b(src: *const i8) -> i8 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.BU`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_bu(src: *const u8) -> u8 {
let value: u8;
asm!(".insn i 0x73, 0x4, {}, {}, 0x601", out(reg) value, in(reg) src, options(readonly, nostack));
@ -210,7 +210,7 @@ pub unsafe fn hlv_bu(src: *const u8) -> u8 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.H`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_h(src: *const i16) -> i16 {
let value: i16;
asm!(".insn i 0x73, 0x4, {}, {}, 0x640", out(reg) value, in(reg) src, options(readonly, nostack));
@ -226,7 +226,7 @@ pub unsafe fn hlv_h(src: *const i16) -> i16 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.HU`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_hu(src: *const u16) -> u16 {
let value: u16;
asm!(".insn i 0x73, 0x4, {}, {}, 0x641", out(reg) value, in(reg) src, options(readonly, nostack));
@ -242,7 +242,7 @@ pub unsafe fn hlv_hu(src: *const u16) -> u16 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLVX.HU`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlvx_hu(src: *const u16) -> u16 {
let insn: u16;
asm!(".insn i 0x73, 0x4, {}, {}, 0x643", out(reg) insn, in(reg) src, options(readonly, nostack));
@ -258,7 +258,7 @@ pub unsafe fn hlvx_hu(src: *const u16) -> u16 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLV.W`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlv_w(src: *const i32) -> i32 {
let value: i32;
asm!(".insn i 0x73, 0x4, {}, {}, 0x680", out(reg) value, in(reg) src, options(readonly, nostack));
@ -274,7 +274,7 @@ pub unsafe fn hlv_w(src: *const i32) -> i32 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HLVX.WU`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hlvx_wu(src: *const u32) -> u32 {
let insn: u32;
asm!(".insn i 0x73, 0x4, {}, {}, 0x683", out(reg) insn, in(reg) src, options(readonly, nostack));
@ -290,7 +290,7 @@ pub unsafe fn hlvx_wu(src: *const u32) -> u32 {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HSV.B`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hsv_b(dst: *mut i8, src: i8) {
asm!(".insn r 0x73, 0x4, 0x31, x0, {}, {}", in(reg) dst, in(reg) src, options(nostack));
}
@ -304,7 +304,7 @@ pub unsafe fn hsv_b(dst: *mut i8, src: i8) {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HSV.H`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hsv_h(dst: *mut i16, src: i16) {
asm!(".insn r 0x73, 0x4, 0x33, x0, {}, {}", in(reg) dst, in(reg) src, options(nostack));
}
@ -318,7 +318,7 @@ pub unsafe fn hsv_h(dst: *mut i16, src: i16) {
/// This function is unsafe for it accesses the virtual supervisor or user via a `HSV.W`
/// instruction which is effectively a dereference to any memory address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hsv_w(dst: *mut i32, src: i32) {
asm!(".insn r 0x73, 0x4, 0x35, x0, {}, {}", in(reg) dst, in(reg) src, options(nostack));
}
@ -332,7 +332,7 @@ pub unsafe fn hsv_w(dst: *mut i32, src: i32) {
///
/// This fence specifies a single guest virtual address, and a single guest address-space identifier.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_vvma(vaddr: usize, asid: usize) {
// asm!("hfence.vvma {}, {}", in(reg) vaddr, in(reg) asid)
asm!(".insn r 0x73, 0, 0x11, x0, {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
@ -347,7 +347,7 @@ pub unsafe fn hfence_vvma(vaddr: usize, asid: usize) {
///
/// This fence specifies a single guest virtual address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_vvma_vaddr(vaddr: usize) {
asm!(".insn r 0x73, 0, 0x11, x0, {}, x0", in(reg) vaddr, options(nostack))
}
@ -361,7 +361,7 @@ pub unsafe fn hfence_vvma_vaddr(vaddr: usize) {
///
/// This fence specifies a single guest address-space identifier.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_vvma_asid(asid: usize) {
asm!(".insn r 0x73, 0, 0x11, x0, x0, {}", in(reg) asid, options(nostack))
}
@ -375,7 +375,7 @@ pub unsafe fn hfence_vvma_asid(asid: usize) {
///
/// This fence applies to any guest address spaces and guest virtual addresses.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_vvma_all() {
asm!(".insn r 0x73, 0, 0x11, x0, x0, x0", options(nostack))
}
@ -388,7 +388,7 @@ pub unsafe fn hfence_vvma_all() {
/// This fence specifies a single guest physical address, **shifted right by 2 bits**, and a single virtual machine
/// by virtual machine identifier (VMID).
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_gvma(gaddr: usize, vmid: usize) {
// asm!("hfence.gvma {}, {}", in(reg) gaddr, in(reg) vmid, options(nostack))
asm!(".insn r 0x73, 0, 0x31, x0, {}, {}", in(reg) gaddr, in(reg) vmid, options(nostack))
@ -401,7 +401,7 @@ pub unsafe fn hfence_gvma(gaddr: usize, vmid: usize) {
///
/// This fence specifies a single guest physical address; **the physical address should be shifted right by 2 bits**.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_gvma_gaddr(gaddr: usize) {
asm!(".insn r 0x73, 0, 0x31, x0, {}, x0", in(reg) gaddr, options(nostack))
}
@ -413,7 +413,7 @@ pub unsafe fn hfence_gvma_gaddr(gaddr: usize) {
///
/// This fence specifies a single virtual machine by virtual machine identifier (VMID).
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_gvma_vmid(vmid: usize) {
asm!(".insn r 0x73, 0, 0x31, x0, x0, {}", in(reg) vmid, options(nostack))
}
@ -425,7 +425,7 @@ pub unsafe fn hfence_gvma_vmid(vmid: usize) {
///
/// This fence specifies all guest physical addresses and all virtual machines.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hfence_gvma_all() {
asm!(".insn r 0x73, 0, 0x31, x0, x0, x0", options(nostack))
}
@ -437,7 +437,7 @@ pub unsafe fn hfence_gvma_all() {
///
/// This fence specifies a single guest virtual address, and a single guest address-space identifier.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_vvma(vaddr: usize, asid: usize) {
// asm!("hinval.vvma {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
asm!(".insn r 0x73, 0, 0x13, x0, {}, {}", in(reg) vaddr, in(reg) asid, options(nostack))
@ -450,7 +450,7 @@ pub unsafe fn hinval_vvma(vaddr: usize, asid: usize) {
///
/// This fence specifies a single guest virtual address.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_vvma_vaddr(vaddr: usize) {
asm!(".insn r 0x73, 0, 0x13, x0, {}, x0", in(reg) vaddr, options(nostack))
}
@ -462,7 +462,7 @@ pub unsafe fn hinval_vvma_vaddr(vaddr: usize) {
///
/// This fence specifies a single guest address-space identifier.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_vvma_asid(asid: usize) {
asm!(".insn r 0x73, 0, 0x13, x0, x0, {}", in(reg) asid, options(nostack))
}
@ -474,7 +474,7 @@ pub unsafe fn hinval_vvma_asid(asid: usize) {
///
/// This fence applies to any guest address spaces and guest virtual addresses.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_vvma_all() {
asm!(".insn r 0x73, 0, 0x13, x0, x0, x0", options(nostack))
}
@ -487,7 +487,7 @@ pub unsafe fn hinval_vvma_all() {
/// This fence specifies a single guest physical address, **shifted right by 2 bits**, and a single virtual machine
/// by virtual machine identifier (VMID).
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_gvma(gaddr: usize, vmid: usize) {
// asm!("hinval.gvma {}, {}", in(reg) gaddr, in(reg) vmid, options(nostack))
asm!(".insn r 0x73, 0, 0x33, x0, {}, {}", in(reg) gaddr, in(reg) vmid, options(nostack))
@ -500,7 +500,7 @@ pub unsafe fn hinval_gvma(gaddr: usize, vmid: usize) {
///
/// This fence specifies a single guest physical address; **the physical address should be shifted right by 2 bits**.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_gvma_gaddr(gaddr: usize) {
asm!(".insn r 0x73, 0, 0x33, x0, {}, x0", in(reg) gaddr, options(nostack))
}
@ -512,7 +512,7 @@ pub unsafe fn hinval_gvma_gaddr(gaddr: usize) {
///
/// This fence specifies a single virtual machine by virtual machine identifier (VMID).
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_gvma_vmid(vmid: usize) {
asm!(".insn r 0x73, 0, 0x33, x0, x0, {}", in(reg) vmid, options(nostack))
}
@ -524,7 +524,7 @@ pub unsafe fn hinval_gvma_vmid(vmid: usize) {
///
/// This fence specifies all guest physical addresses and all virtual machines.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub unsafe fn hinval_gvma_all() {
asm!(".insn r 0x73, 0, 0x33, x0, x0, x0", options(nostack))
}
@ -548,7 +548,7 @@ pub unsafe fn hinval_gvma_all() {
/// [`frrm`]: fn.frrm.html
/// [`frflags`]: fn.frflags.html
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn frcsr() -> u32 {
let value: u32;
unsafe { asm!("frcsr {}", out(reg) value, options(nomem, nostack)) };
@ -560,7 +560,7 @@ pub fn frcsr() -> u32 {
/// This function swaps the value in `fcsr` by copying the original value to be returned,
/// and then writing a new value obtained from input variable `value` into `fcsr`.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn fscsr(value: u32) -> u32 {
let original: u32;
unsafe { asm!("fscsr {}, {}", out(reg) original, in(reg) value, options(nomem, nostack)) }
@ -583,7 +583,7 @@ pub fn fscsr(value: u32) -> u32 {
/// | 110 | | _Reserved for future use._ |
/// | 111 | DYN | In Rounding Mode register, _reserved_. |
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn frrm() -> u32 {
let value: u32;
unsafe { asm!("frrm {}", out(reg) value, options(nomem, nostack)) };
@ -596,7 +596,7 @@ pub fn frrm() -> u32 {
/// and then writing a new value obtained from the three least-significant bits of
/// input variable `value` into `frm`.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn fsrm(value: u32) -> u32 {
let original: u32;
unsafe { asm!("fsrm {}, {}", out(reg) original, in(reg) value, options(nomem, nostack)) }
@ -620,7 +620,7 @@ pub fn fsrm(value: u32) -> u32 {
/// | 1 | UF | Underflow |
/// | 0 | NX | Inexact |
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn frflags() -> u32 {
let value: u32;
unsafe { asm!("frflags {}", out(reg) value, options(nomem, nostack)) };
@ -633,7 +633,7 @@ pub fn frflags() -> u32 {
/// and then writing a new value obtained from the five least-significant bits of
/// input variable `value` into `fflags`.
#[inline]
#[unstable(feature = "stdsimd", issue = "27731")]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn fsflags(value: u32) -> u32 {
let original: u32;
unsafe { asm!("fsflags {}, {}", out(reg) original, in(reg) value, options(nomem, nostack)) }

View file

@ -5,6 +5,7 @@ use crate::arch::asm;
/// Adds packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn add16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -15,6 +16,7 @@ pub fn add16(a: usize, b: usize) -> usize {
/// Halves the sum of packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn radd16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -25,6 +27,7 @@ pub fn radd16(a: usize, b: usize) -> usize {
/// Halves the sum of packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn uradd16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -35,6 +38,7 @@ pub fn uradd16(a: usize, b: usize) -> usize {
/// Adds packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kadd16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -45,6 +49,7 @@ pub fn kadd16(a: usize, b: usize) -> usize {
/// Adds packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukadd16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -55,6 +60,7 @@ pub fn ukadd16(a: usize, b: usize) -> usize {
/// Subtracts packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sub16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -65,6 +71,7 @@ pub fn sub16(a: usize, b: usize) -> usize {
/// Halves the subtraction result of packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rsub16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -75,6 +82,7 @@ pub fn rsub16(a: usize, b: usize) -> usize {
/// Halves the subtraction result of packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ursub16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -85,6 +93,7 @@ pub fn ursub16(a: usize, b: usize) -> usize {
/// Subtracts packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ksub16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -95,6 +104,7 @@ pub fn ksub16(a: usize, b: usize) -> usize {
/// Subtracts packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn uksub16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -105,6 +115,7 @@ pub fn uksub16(a: usize, b: usize) -> usize {
/// Cross adds and subtracts packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn cras16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -115,6 +126,7 @@ pub fn cras16(a: usize, b: usize) -> usize {
/// Cross halves of adds and subtracts packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rcras16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -125,6 +137,7 @@ pub fn rcras16(a: usize, b: usize) -> usize {
/// Cross halves of adds and subtracts packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn urcras16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -135,6 +148,7 @@ pub fn urcras16(a: usize, b: usize) -> usize {
/// Cross adds and subtracts packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kcras16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -145,6 +159,7 @@ pub fn kcras16(a: usize, b: usize) -> usize {
/// Cross adds and subtracts packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukcras16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -155,6 +170,7 @@ pub fn ukcras16(a: usize, b: usize) -> usize {
/// Cross subtracts and adds packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn crsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -165,6 +181,7 @@ pub fn crsa16(a: usize, b: usize) -> usize {
/// Cross halves of subtracts and adds packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rcrsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -175,6 +192,7 @@ pub fn rcrsa16(a: usize, b: usize) -> usize {
/// Cross halves of subtracts and adds packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn urcrsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -185,6 +203,7 @@ pub fn urcrsa16(a: usize, b: usize) -> usize {
/// Cross subtracts and adds packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kcrsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -195,6 +214,7 @@ pub fn kcrsa16(a: usize, b: usize) -> usize {
/// Cross subtracts and adds packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukcrsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -205,6 +225,7 @@ pub fn ukcrsa16(a: usize, b: usize) -> usize {
/// Straight adds and subtracts packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn stas16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -215,6 +236,7 @@ pub fn stas16(a: usize, b: usize) -> usize {
/// Straight halves of adds and subtracts packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rstas16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -225,6 +247,7 @@ pub fn rstas16(a: usize, b: usize) -> usize {
/// Straight halves of adds and subtracts packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn urstas16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -235,6 +258,7 @@ pub fn urstas16(a: usize, b: usize) -> usize {
/// Straight adds and subtracts packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kstas16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -245,6 +269,7 @@ pub fn kstas16(a: usize, b: usize) -> usize {
/// Straight adds and subtracts packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukstas16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -255,6 +280,7 @@ pub fn ukstas16(a: usize, b: usize) -> usize {
/// Straight subtracts and adds packed 16-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn stsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -265,6 +291,7 @@ pub fn stsa16(a: usize, b: usize) -> usize {
/// Straight halves of subtracts and adds packed 16-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rstsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -275,6 +302,7 @@ pub fn rstsa16(a: usize, b: usize) -> usize {
/// Straight halves of subtracts and adds packed 16-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn urstsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -285,6 +313,7 @@ pub fn urstsa16(a: usize, b: usize) -> usize {
/// Straight subtracts and adds packed 16-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kstsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -295,6 +324,7 @@ pub fn kstsa16(a: usize, b: usize) -> usize {
/// Straight subtracts and adds packed 16-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukstsa16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -305,6 +335,7 @@ pub fn ukstsa16(a: usize, b: usize) -> usize {
/// Adds packed 8-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn add8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -315,6 +346,7 @@ pub fn add8(a: usize, b: usize) -> usize {
/// Halves the sum of packed 8-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn radd8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -325,6 +357,7 @@ pub fn radd8(a: usize, b: usize) -> usize {
/// Halves the sum of packed 8-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn uradd8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -335,6 +368,7 @@ pub fn uradd8(a: usize, b: usize) -> usize {
/// Adds packed 8-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kadd8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -345,6 +379,7 @@ pub fn kadd8(a: usize, b: usize) -> usize {
/// Adds packed 8-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukadd8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -355,6 +390,7 @@ pub fn ukadd8(a: usize, b: usize) -> usize {
/// Subtracts packed 8-bit signed numbers, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sub8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -365,6 +401,7 @@ pub fn sub8(a: usize, b: usize) -> usize {
/// Halves the subtraction result of packed 8-bit signed numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn rsub8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -375,6 +412,7 @@ pub fn rsub8(a: usize, b: usize) -> usize {
/// Halves the subtraction result of packed 8-bit unsigned numbers, dropping least bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ursub8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -385,6 +423,7 @@ pub fn ursub8(a: usize, b: usize) -> usize {
/// Subtracts packed 8-bit signed numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ksub8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -395,6 +434,7 @@ pub fn ksub8(a: usize, b: usize) -> usize {
/// Subtracts packed 8-bit unsigned numbers, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn uksub8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -405,6 +445,7 @@ pub fn uksub8(a: usize, b: usize) -> usize {
/// Arithmetic right shift packed 16-bit elements without rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sra16(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -415,6 +456,7 @@ pub fn sra16(a: usize, b: u32) -> usize {
/// Arithmetic right shift packed 16-bit elements with rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sra16u(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -425,6 +467,7 @@ pub fn sra16u(a: usize, b: u32) -> usize {
/// Logical right shift packed 16-bit elements without rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn srl16(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -435,6 +478,7 @@ pub fn srl16(a: usize, b: u32) -> usize {
/// Logical right shift packed 16-bit elements with rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn srl16u(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -445,6 +489,7 @@ pub fn srl16u(a: usize, b: u32) -> usize {
/// Logical left shift packed 16-bit elements, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sll16(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -455,6 +500,7 @@ pub fn sll16(a: usize, b: u32) -> usize {
/// Logical left shift packed 16-bit elements, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ksll16(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -465,6 +511,7 @@ pub fn ksll16(a: usize, b: u32) -> usize {
/// Logical saturating left then arithmetic right shift packed 16-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kslra16(a: usize, b: i32) -> usize {
let value: usize;
unsafe {
@ -475,6 +522,7 @@ pub fn kslra16(a: usize, b: i32) -> usize {
/// Logical saturating left then arithmetic right shift packed 16-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kslra16u(a: usize, b: i32) -> usize {
let value: usize;
unsafe {
@ -485,6 +533,7 @@ pub fn kslra16u(a: usize, b: i32) -> usize {
/// Arithmetic right shift packed 8-bit elements without rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sra8(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -495,6 +544,7 @@ pub fn sra8(a: usize, b: u32) -> usize {
/// Arithmetic right shift packed 8-bit elements with rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sra8u(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -505,6 +555,7 @@ pub fn sra8u(a: usize, b: u32) -> usize {
/// Logical right shift packed 8-bit elements without rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn srl8(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -515,6 +566,7 @@ pub fn srl8(a: usize, b: u32) -> usize {
/// Logical right shift packed 8-bit elements with rounding up
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn srl8u(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -525,6 +577,7 @@ pub fn srl8u(a: usize, b: u32) -> usize {
/// Logical left shift packed 8-bit elements, discarding overflow bits
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sll8(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -535,6 +588,7 @@ pub fn sll8(a: usize, b: u32) -> usize {
/// Logical left shift packed 8-bit elements, saturating at the numeric bounds
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ksll8(a: usize, b: u32) -> usize {
let value: usize;
unsafe {
@ -545,6 +599,7 @@ pub fn ksll8(a: usize, b: u32) -> usize {
/// Logical saturating left then arithmetic right shift packed 8-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kslra8(a: usize, b: i32) -> usize {
let value: usize;
unsafe {
@ -555,6 +610,7 @@ pub fn kslra8(a: usize, b: i32) -> usize {
/// Logical saturating left then arithmetic right shift packed 8-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kslra8u(a: usize, b: i32) -> usize {
let value: usize;
unsafe {
@ -565,6 +621,7 @@ pub fn kslra8u(a: usize, b: i32) -> usize {
/// Compare equality for packed 16-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn cmpeq16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -575,6 +632,7 @@ pub fn cmpeq16(a: usize, b: usize) -> usize {
/// Compare whether 16-bit packed signed integers are less than the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn scmplt16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -585,6 +643,7 @@ pub fn scmplt16(a: usize, b: usize) -> usize {
/// Compare whether 16-bit packed signed integers are less than or equal to the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn scmple16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -595,6 +654,7 @@ pub fn scmple16(a: usize, b: usize) -> usize {
/// Compare whether 16-bit packed unsigned integers are less than the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ucmplt16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -605,6 +665,7 @@ pub fn ucmplt16(a: usize, b: usize) -> usize {
/// Compare whether 16-bit packed unsigned integers are less than or equal to the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ucmple16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -615,6 +676,7 @@ pub fn ucmple16(a: usize, b: usize) -> usize {
/// Compare equality for packed 8-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn cmpeq8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -625,6 +687,7 @@ pub fn cmpeq8(a: usize, b: usize) -> usize {
/// Compare whether 8-bit packed signed integers are less than the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn scmplt8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -635,6 +698,7 @@ pub fn scmplt8(a: usize, b: usize) -> usize {
/// Compare whether 8-bit packed signed integers are less than or equal to the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn scmple8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -645,6 +709,7 @@ pub fn scmple8(a: usize, b: usize) -> usize {
/// Compare whether 8-bit packed unsigned integers are less than the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ucmplt8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -655,6 +720,7 @@ pub fn ucmplt8(a: usize, b: usize) -> usize {
/// Compare whether 8-bit packed unsigned integers are less than or equal to the others
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ucmple8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -665,6 +731,7 @@ pub fn ucmple8(a: usize, b: usize) -> usize {
/// Get minimum values from 16-bit packed signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smin16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -675,6 +742,7 @@ pub fn smin16(a: usize, b: usize) -> usize {
/// Get minimum values from 16-bit packed unsigned integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn umin16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -685,6 +753,7 @@ pub fn umin16(a: usize, b: usize) -> usize {
/// Get maximum values from 16-bit packed signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smax16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -695,6 +764,7 @@ pub fn smax16(a: usize, b: usize) -> usize {
/// Get maximum values from 16-bit packed unsigned integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn umax16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -707,6 +777,7 @@ pub fn umax16(a: usize, b: usize) -> usize {
/// Compute the absolute value of packed 16-bit signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kabs16(a: usize) -> usize {
let value: usize;
unsafe {
@ -717,6 +788,7 @@ pub fn kabs16(a: usize) -> usize {
/// Count the number of redundant sign bits of the packed 16-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clrs16(a: usize) -> usize {
let value: usize;
unsafe {
@ -727,6 +799,7 @@ pub fn clrs16(a: usize) -> usize {
/// Count the number of leading zero bits of the packed 16-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clz16(a: usize) -> usize {
let value: usize;
unsafe {
@ -737,6 +810,7 @@ pub fn clz16(a: usize) -> usize {
/// Swap the 16-bit halfwords within each 32-bit word of a register
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn swap16(a: usize) -> usize {
let value: usize;
// this instruction is an alias for `pkbt rd, rs1, rs1`.
@ -748,6 +822,7 @@ pub fn swap16(a: usize) -> usize {
/// Get minimum values from 8-bit packed signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smin8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -758,6 +833,7 @@ pub fn smin8(a: usize, b: usize) -> usize {
/// Get minimum values from 8-bit packed unsigned integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn umin8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -768,6 +844,7 @@ pub fn umin8(a: usize, b: usize) -> usize {
/// Get maximum values from 8-bit packed signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smax8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -778,6 +855,7 @@ pub fn smax8(a: usize, b: usize) -> usize {
/// Get maximum values from 8-bit packed unsigned integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn umax8(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -790,6 +868,7 @@ pub fn umax8(a: usize, b: usize) -> usize {
/// Compute the absolute value of packed 8-bit signed integers
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kabs8(a: usize) -> usize {
let value: usize;
unsafe {
@ -800,6 +879,7 @@ pub fn kabs8(a: usize) -> usize {
/// Count the number of redundant sign bits of the packed 8-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clrs8(a: usize) -> usize {
let value: usize;
unsafe {
@ -810,6 +890,7 @@ pub fn clrs8(a: usize) -> usize {
/// Count the number of leading zero bits of the packed 8-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clz8(a: usize) -> usize {
let value: usize;
unsafe {
@ -820,6 +901,7 @@ pub fn clz8(a: usize) -> usize {
/// Swap the 8-bit bytes within each 16-bit halfword of a register.
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn swap8(a: usize) -> usize {
let value: usize;
unsafe {
@ -830,6 +912,7 @@ pub fn swap8(a: usize) -> usize {
/// Unpack first and zeroth into two 16-bit signed halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sunpkd810(a: usize) -> usize {
let value: usize;
unsafe {
@ -840,6 +923,7 @@ pub fn sunpkd810(a: usize) -> usize {
/// Unpack second and zeroth into two 16-bit signed halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sunpkd820(a: usize) -> usize {
let value: usize;
unsafe {
@ -850,6 +934,7 @@ pub fn sunpkd820(a: usize) -> usize {
/// Unpack third and zeroth into two 16-bit signed halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sunpkd830(a: usize) -> usize {
let value: usize;
unsafe {
@ -860,6 +945,7 @@ pub fn sunpkd830(a: usize) -> usize {
/// Unpack third and first into two 16-bit signed halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sunpkd831(a: usize) -> usize {
let value: usize;
unsafe {
@ -870,6 +956,7 @@ pub fn sunpkd831(a: usize) -> usize {
/// Unpack third and second into two 16-bit signed halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn sunpkd832(a: usize) -> usize {
let value: usize;
unsafe {
@ -880,6 +967,7 @@ pub fn sunpkd832(a: usize) -> usize {
/// Unpack first and zeroth into two 16-bit unsigned halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn zunpkd810(a: usize) -> usize {
let value: usize;
unsafe {
@ -890,6 +978,7 @@ pub fn zunpkd810(a: usize) -> usize {
/// Unpack second and zeroth into two 16-bit unsigned halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn zunpkd820(a: usize) -> usize {
let value: usize;
unsafe {
@ -900,6 +989,7 @@ pub fn zunpkd820(a: usize) -> usize {
/// Unpack third and zeroth into two 16-bit unsigned halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn zunpkd830(a: usize) -> usize {
let value: usize;
unsafe {
@ -910,6 +1000,7 @@ pub fn zunpkd830(a: usize) -> usize {
/// Unpack third and first into two 16-bit unsigned halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn zunpkd831(a: usize) -> usize {
let value: usize;
unsafe {
@ -920,6 +1011,7 @@ pub fn zunpkd831(a: usize) -> usize {
/// Unpack third and second into two 16-bit unsigned halfwords in each 32-bit chunk
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn zunpkd832(a: usize) -> usize {
let value: usize;
unsafe {
@ -932,6 +1024,7 @@ pub fn zunpkd832(a: usize) -> usize {
/// Pack two 16-bit data from bottom and top half from 32-bit chunks
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn pkbt16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -942,6 +1035,7 @@ pub fn pkbt16(a: usize, b: usize) -> usize {
/// Pack two 16-bit data from top and bottom half from 32-bit chunks
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn pktb16(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -952,6 +1046,7 @@ pub fn pktb16(a: usize, b: usize) -> usize {
/// Count the number of redundant sign bits of the packed 32-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clrs32(a: usize) -> usize {
let value: usize;
unsafe {
@ -962,6 +1057,7 @@ pub fn clrs32(a: usize) -> usize {
/// Count the number of leading zero bits of the packed 32-bit elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn clz32(a: usize) -> usize {
let value: usize;
unsafe {
@ -972,6 +1068,7 @@ pub fn clz32(a: usize) -> usize {
/// Calculate the sum of absolute difference of unsigned 8-bit data elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn pbsad(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -982,6 +1079,7 @@ pub fn pbsad(a: usize, b: usize) -> usize {
/// Calculate and accumulate the sum of absolute difference of unsigned 8-bit data elements
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn pbsada(t: usize, a: usize, b: usize) -> usize {
let mut value: usize;
unsafe {
@ -992,6 +1090,7 @@ pub fn pbsada(t: usize, a: usize, b: usize) -> usize {
/// Multiply signed 8-bit elements and add 16-bit elements on results for packed 32-bit chunks
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smaqa(t: usize, a: usize, b: usize) -> usize {
let mut value: usize;
unsafe {
@ -1002,6 +1101,7 @@ pub fn smaqa(t: usize, a: usize, b: usize) -> usize {
/// Multiply unsigned 8-bit elements and add 16-bit elements on results for packed 32-bit chunks
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn umaqa(t: usize, a: usize, b: usize) -> usize {
let mut value: usize;
unsafe {
@ -1012,6 +1112,7 @@ pub fn umaqa(t: usize, a: usize, b: usize) -> usize {
/// Multiply signed to unsigned 8-bit and add 16-bit elements on results for packed 32-bit chunks
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn smaqasu(t: usize, a: usize, b: usize) -> usize {
let mut value: usize;
unsafe {
@ -1022,6 +1123,7 @@ pub fn smaqasu(t: usize, a: usize, b: usize) -> usize {
/// Adds signed lower 16-bit content of two registers with Q15 saturation
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn kaddh(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -1032,6 +1134,7 @@ pub fn kaddh(a: usize, b: usize) -> usize {
/// Subtracts signed lower 16-bit content of two registers with Q15 saturation
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ksubh(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -1042,6 +1145,7 @@ pub fn ksubh(a: usize, b: usize) -> usize {
/// Adds signed lower 16-bit content of two registers with U16 saturation
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn ukaddh(a: usize, b: usize) -> usize {
let value: usize;
unsafe {
@ -1052,6 +1156,7 @@ pub fn ukaddh(a: usize, b: usize) -> usize {
/// Subtracts signed lower 16-bit content of two registers with U16 saturation
#[inline]
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
pub fn uksubh(a: usize, b: usize) -> usize {
let value: usize;
unsafe {

View file

@ -46,6 +46,7 @@ extern "unadjusted" {
/// # Safety
///
/// This function is safe to use if the `zbb` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbb")]
#[cfg_attr(test, assert_instr(orc.b))]
#[inline]
@ -74,6 +75,7 @@ pub unsafe fn orc_b(rs: usize) -> usize {
/// # Safety
///
/// This function is safe to use if the `zbc` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbc")]
#[cfg_attr(test, assert_instr(clmul))]
#[inline]
@ -102,6 +104,7 @@ pub unsafe fn clmul(rs1: usize, rs2: usize) -> usize {
/// # Safety
///
/// This function is safe to use if the `zbc` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbc")]
#[cfg_attr(test, assert_instr(clmulh))]
#[inline]
@ -130,6 +133,7 @@ pub unsafe fn clmulh(rs1: usize, rs2: usize) -> usize {
/// # Safety
///
/// This function is safe to use if the `zbc` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbc")]
#[cfg_attr(test, assert_instr(clmulr))]
#[inline]

View file

@ -61,6 +61,7 @@ extern "unadjusted" {
/// # Safety
///
/// This function is safe to use if the `zbkx` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbkx")]
#[cfg_attr(test, assert_instr(xperm8))]
#[inline]
@ -92,6 +93,7 @@ pub unsafe fn xperm8(rs1: usize, rs2: usize) -> usize {
/// # Safety
///
/// This function is safe to use if the `zbkx` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zbkx")]
#[cfg_attr(test, assert_instr(xperm4))]
#[inline]
@ -126,6 +128,7 @@ pub unsafe fn xperm4(rs1: usize, rs2: usize) -> usize {
/// # Safety
///
/// This function is safe to use if the `zknh` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zknh")]
#[cfg_attr(test, assert_instr(sha256sig0))]
#[inline]
@ -152,6 +155,7 @@ pub unsafe fn sha256sig0(rs1: u32) -> u32 {
/// # Safety
///
/// This function is safe to use if the `zknh` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zknh")]
#[cfg_attr(test, assert_instr(sha256sig1))]
#[inline]
@ -178,6 +182,7 @@ pub unsafe fn sha256sig1(rs1: u32) -> u32 {
/// # Safety
///
/// This function is safe to use if the `zknh` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zknh")]
#[cfg_attr(test, assert_instr(sha256sum0))]
#[inline]
@ -204,6 +209,7 @@ pub unsafe fn sha256sum0(rs1: u32) -> u32 {
/// # Safety
///
/// This function is safe to use if the `zknh` target feature is present.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zknh")]
#[cfg_attr(test, assert_instr(sha256sum1))]
#[inline]
@ -280,6 +286,7 @@ pub unsafe fn sha256sum1(rs1: u32) -> u32 {
/// return c3; // c3 represents c[0..=3]
/// # }
/// ```
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zksed")]
#[rustc_legacy_const_generics(2)]
#[cfg_attr(test, assert_instr(sm4ed, BS = 0))]
@ -359,6 +366,7 @@ pub unsafe fn sm4ed<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
/// return c3; // c3 represents c[0..=3]
/// # }
/// ```
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zksed")]
#[rustc_legacy_const_generics(2)]
#[cfg_attr(test, assert_instr(sm4ks, BS = 0))]
@ -400,6 +408,7 @@ pub unsafe fn sm4ks<const BS: u8>(rs1: u32, rs2: u32) -> u32 {
/// In the SM3 algorithm, the `P0` transformation is used as `E ← P0(TT2)` when the
/// compression function `CF` uses the intermediate value `TT2` to calculate
/// the variable `E` in one iteration for subsequent processes.
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zksh")]
#[cfg_attr(test, assert_instr(sm3p0))]
#[inline]
@ -444,6 +453,7 @@ pub unsafe fn sm3p0(rs1: u32) -> u32 {
/// Wj ← P1(Wj16 ⊕ Wj9 ⊕ (Wj3 ≪ 15)) ⊕ (Wj13 ≪ 7) ⊕ Wj6
/// ENDFOR
/// ```
#[unstable(feature = "riscv_ext_intrinsics", issue = "114544")]
#[target_feature(enable = "zksh")]
#[cfg_attr(test, assert_instr(sm3p1))]
#[inline]