diff options
| author | Laytan <laytanlaats@hotmail.com> | 2024-08-25 21:15:25 +0200 |
|---|---|---|
| committer | Laytan <laytanlaats@hotmail.com> | 2024-08-25 21:17:00 +0200 |
| commit | d299d4e1cd009a66ce72371b4e7ab6c61811f9fc (patch) | |
| tree | 789a4f909ac23ed6c3b5eda82eea9eea9997134e /src/check_builtin.cpp | |
| parent | 8c952878fbff18986f4f39415158980fb1b69e1d (diff) | |
riscv: add an error when atomics are used without the atomics extension
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index fa03da946..3742caeda 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -2048,6 +2048,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As return ok; } + if (BuiltinProc__atomic_begin < id && id < BuiltinProc__atomic_end) { + if (build_context.metrics.arch == TargetArch_riscv64) { + if (!check_target_feature_is_enabled(str_lit("a"), nullptr)) { + error(call, "missing required target feature \"a\" for atomics, enable it by setting a different -microarch or explicitly adding it through -target-features"); + } + } + } + switch (id) { default: GB_PANIC("Implement built-in procedure: %.*s", LIT(builtin_name)); |