Skip to content
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

zihintntl Intrinsic function proposal #47

Merged
merged 3 commits into from
Jul 25, 2023
Merged
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
45 changes: 45 additions & 0 deletions riscv-c-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,51 @@ long __riscv_clmul (long a, long b); // clmul rd, rs1, rs2
vint8m1_t __riscv_vadd_vv_i8m1(vint8m1_t vs2, vint8m1_t vs1, size_t vl); // vadd.vv vd, vs2, vs1
```

### NTLH Intrisics

The RISC-V zihintntl extension provides the RISC-V specific intrinsic functions for generating non-temporal memory accesses. These intrinsic functions provide the domain parameter to specify the behavior of memory accesses.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zihintntl -> Zihintntl


In order to access the RISC-V NTLH intrinsics, it is necessary to
include the header file `riscv_ntlh.h`.

The functions are only available if the compiler enables the zihintntl extension.

```
type __riscv_ntl_load (type *ptr, int domain);
void __riscv_ntl_store (type *ptr, type val, int domain);
```

There are overloaded functions of `__riscv_ntl_load` and `__riscv_ntl_store`. When these intrinsic functions omit the `domain` argument, the `domain` is implied as `__RISCV_NTLH_ALL`.

```
type __riscv_ntl_load (type *ptr);
void __riscv_ntl_store (type *ptr, type val);
```

The types currently supported are:

- Integer types.
- Floating-point types.
- Fixed-length vector types.

The `domain` parameter could pass the following values. Each one is mapped to the specific zihintntl instruction.

```
enum {
__RISCV_NTLH_INNERMOST_PRIVATE = 2,
__RISCV_NTLH_ALL_PRIVATE,
__RISCV_NTLH_INNERMOST_SHARED,
__RISCV_NTLH_ALL
};
```

| Domain Value | Instruction |
| ---------------------------------| ------------|
| `__RISCV_NTLH_INNERMOST_PRIVATE` | `ntl.p1` |
| `__RISCV_NTLH_ALL_PRIVATE` | `ntl.pall` |
| `__RISCV_NTLH_INNERMOST_SHARED` | `ntl.s1` |
| `__RISCV_NTLH_ALL` | `ntl.all` |

## Constraints on Operands of Inline Assembly Statements

This section lists operand constraints that can be used with inline assembly
Expand Down