You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: riscv-c-api.md
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -400,6 +400,25 @@ enum {
400
400
| `__RISCV_NTLH_INNERMOST_SHARED` | `ntl.s1` |
401
401
| `__RISCV_NTLH_ALL` | `ntl.all` |
402
402
403
+
### Prefetch Intrinsics
404
+
405
+
The zicbop extension provide the prefetch instruction to allow users to optimize data access patterns by providing hints to the hardware regarding future data accesses. It is supported through a compiler-defined built-in function with three arguments that specify its behavior.
406
+
407
+
```
408
+
void __builtin_prefetch(const void *addr, int rw, int locality)
409
+
```
410
+
411
+
The locality for the built-in __builtin_prefetch function in RISC-V can be achieved using the Non-Temporal Locality Hints (NTLH) extension. According to Non-Temporal Locality Hints extension, it indicates that a cache line should be prefetched into a cache that is outer from the level specified by the NTL when a NTL instruction is applied to prefetch instruction.
412
+
413
+
The following table presents the mapping from the __builtin_prefetch function to the corresponding assembly instructions using the NTL extension.
0 commit comments