riscv-non-isa / riscv-c-api-doc

Documentation of the RISC-V C API
https://jira.riscv.org/browse/RVG-4
Creative Commons Attribution 4.0 International
68 stars 38 forks source link

Add atomic intrinsics #79

Open wangpc-pp opened 3 months ago

wangpc-pp commented 3 months ago

We need this when optimizing some locks' implementation, but using inline assembly will stop some optimizations. For example, if we use inline assembly, the compiler doesn't know lr.w will sign-extend the result.

ARM provides similar intrinsics like __builtin_arm_ldaex.

Currently, we only add intrinsics for Zawrs.

wangpc-pp commented 3 months ago

I don't know if we should add intrinsics for AMO instructions as we have some "standard" C builtins for AMO.

wangpc-pp commented 1 month ago

Ping. :-)