Skip to content

Commit

Permalink
Merge pull request #40 from vineetgarc/topic-unaligned-access
Browse files Browse the repository at this point in the history
Add macros for unaligned access
  • Loading branch information
kito-cheng committed Jul 20, 2023
2 parents c637e63 + 69d21f8 commit a98e309
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_avoid | 1 | Misaligned access are not supported by cpu and could trap. (see [ __riscv_misaligned_{fast,slow,avoid}](#__riscv_misaligned_{fast,slow,avoid}) |

### __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,avoid}

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 avoid 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 a98e309

Please sign in to comment.