diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-08-25 22:49:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-25 22:49:42 +0100 |
| commit | 8de1e88c4f34f79ff8e2eac915507a30c185236e (patch) | |
| tree | 9df1c8443f6b42107b381f84403a7dbdf1571717 /src/check_builtin.cpp | |
| parent | 9aeb0d0fb6eb15d0c2e36ae4475920aaeb198fda (diff) | |
| parent | d299d4e1cd009a66ce72371b4e7ab6c61811f9fc (diff) | |
Merge pull request #4144 from laytan/riscv-error-on-atomics-without-extension
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)); |