Skip to content

Commit 68c08c9

Browse files
JivanHlyutln8-8
authored
Define intrinsic API for the Zimop extension
This patch defines the intrinsic function API for the Zimop extension. Co-authored-by: lyut <lyudovikos.nersisyan@ispras.ru> Co-authored-by: ln8-8 <73429801+ln8-8@users.noreply.github.com> Signed-off-by: ln8-8 <73429801+ln8-8@users.noreply.github.com>
1 parent 732b72d commit 68c08c9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

riscv-c-api.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ For example:
145145
| __riscv_zbc | Arch Version | `Zbc` extension is available. |
146146
| __riscv_zbs | Arch Version | `Zbs` extension is available. |
147147
| __riscv_zfh | Arch Version | `Zfh` extension is available. |
148+
| __riscv_zimop | Arch Version | `Zimop` extension is available. |
148149

149150
### ABI Related Preprocessor Definitions
150151

@@ -520,6 +521,26 @@ Sign extension of 32-bit values on RV64 is not reflected in the interface.
520521
| `uint32_t __riscv_sm4ed(uint32_t rs1, uint32_t rs2, const int bs);` | `sm4ed` | Zksed | `bs`=[0..3] |
521522
| `uint32_t __riscv_sm4ks(uint32_t rs1, uint32_t rs2, const int bs);` | `sm4ks` | Zksed | `bs`=[0..3] |
522523
524+
### May-Be-Operations Extension Intrinsics
525+
526+
The functions are only available if the compiler's `-march` string
527+
enables the required ISA extension. (Calling functions for not enabled
528+
ISA extensions will lead to compile-time and/or link-time errors.)
529+
530+
Intrinsics operating on XLEN sized value are not available as there is no type
531+
defined. If `xlen_t` is added in the future, this can be revisited.
532+
533+
Unsigned types are used as that is the most logical representation for a
534+
collection of bits.
535+
536+
Sign extension of 32-bit values on RV64 is not reflected in the interface.
537+
538+
| Prototype | Instruction | Extension | Notes |
539+
|-------------------------------------------------------------------------|---------------|--------------|---------------------------------------------------------------|
540+
| `uint32_t __riscv_mopr_32(uint32_t rs1, const int n);` | `mop.r.[n]` | Zimop | Emulated with `mopr.r.[n]`+`sext.w` on RV64 <br/> `n`=[0..31] |
541+
| `uint64_t __riscv_mopr_64(uint64_t rs1, const int n);` | `mop.r.[n]` | Zimop (RV64) | `n`=[0..31] |
542+
| `uint32_t __riscv_moprr_32(uint32_t rs1, uint32_t rs2, const int n);` | `mop.rr.[n]` | Zimop | Emulated with `mopr.rr.[n]`+`sext.w` on RV64 <br/> `n`=[0..7] |
543+
| `uint64_t __riscv_moprr_64(uint64_t rs1, uint64_t rs2, const int n);` | `mop.rr.[n]` | Zimop (RV64) | `n`=[0..7] |
523544
524545
## Constraints on Operands of Inline Assembly Statements
525546

0 commit comments

Comments
 (0)