authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-15 19:40:36+07:00
committergravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-04-15 19:40:36+07:00
log5b283fba77d50b48d9b9895fac36ee3e1844bd1c
tree04099d5b8ed09e480000e48cbf7a05283c8d9cc8
parent6aa89115f974b639d6006d8106a7df7d94f636ac

compiler_rt: atomics: Add Leon CAS instruction check for SPARC atomics


1 files changed, 3 insertions(+), 4 deletions(-)

lib/std/special/compiler_rt/atomics.zig+3-4
......@@ -1,6 +1,7 @@
11const std = @import("std");
22const builtin = @import("builtin");
3const arch = builtin.cpu.arch;
3const cpu = builtin.cpu;
4const arch = cpu.arch;
45
56const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
67
......@@ -27,9 +28,7 @@ const largest_atomic_size = switch (arch) {
2728 // On SPARC systems that lacks CAS and/or swap instructions, the only
2829 // available atomic operation is a test-and-set (`ldstub`), so we force
2930 // every atomic memory access to go through the lock.
30 // XXX: Check the presence of CAS/swap instructions and set this parameter
31 // accordingly.
32 .sparc, .sparcel, .sparcv9 => 0,
31 .sparc, .sparcel => if (cpu.features.featureSetHas(.hasleoncasa)) @sizeOf(usize) else 0,
3332
3433 // XXX: On x86/x86_64 we could check the presence of cmpxchg8b/cmpxchg16b
3534 // and set this parameter accordingly.