Skip to content

Commit

Permalink
Add macros for unaligned access
Browse files Browse the repository at this point in the history
riscv-non-isa#32

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
  • Loading branch information
Vineet Gupta committed May 11, 2023
1 parent b0b2747 commit f0cb8cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions riscv-c-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ https://creativecommons.org/licenses/by/4.0/.
| __riscv_v_min_vlen | <N> (see [__riscv_v_min_vlen](#__riscv_v_min_vlen)) | The `V` extension or one of the `Zve*` extensions is available. |
| __riscv_v_elen | <N> (see [__riscv_v_elen](#__riscv_v_elen)) | The `V` extension or one of the `Zve*` extensions is available. |
| __riscv_v_elen_fp | <N> (see [__riscv_v_elen_fp](#__riscv_v_elen_fp)) | The `V` extension or one of the `Zve*` extensions is available. |
| __riscv_misaligned_fast | 1 | Misaligned access on cpu are fast. |
| __riscv_misaligned_slow | 1 | Misaligned access on cpu may not be as fast as aligned access. |
| __riscv_misaligned_bad | 1 | Misaligned access are not supported by cpu and could trap. (see [ __riscv_misaligned_{fast,slow,bad}](#__riscv_misaligned_{fast,slow,bad}) |

### __riscv_v_min_vlen

Expand Down Expand Up @@ -94,6 +97,15 @@ The value of `__riscv_v_elen_fp` is defined by the following rules:
If multiple rules apply, the maximum value is taken.
If none of the rules apply, `__riscv_v_elen_fp` is undefined.

### __riscv_misaligned_{fast,slow,bad}

These can be used in common library code to compile time segregate code which relies
on misaligned access being fast or not.
A typical complier could (but not necessarily) map fast variant to -mno-strict-align
and bad to -mstrict-align, if specified.
Perhaps obvious, but these are mutually exclusive, so only one is defined at a time
for a compilation unit.


### Architecture Extension Test Macro

Expand Down

0 comments on commit f0cb8cc

Please sign in to comment.