zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a7f3e12d23aa59ef3a6d78b1eb10a2a0d688906a (tree)
parent 792cf925ec170ddcb42a2d78ab8f464642e92b17
Author: LemonBoy <thatlemon@gmail.com>
Date:   Sun,  2 May 2021 18:52:08 +0200

std: Add fallback on pre-v6 ARM targets

Thanks xackus for noticing the missing else branch.

Diffstat:
Mlib/std/Thread.zig | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig @@ -76,7 +76,9 @@ pub fn spinLoopHint() callconv(.Inline) void { .arm, .armeb, .thumb, .thumbeb => { // `yield` was introduced in v6k but are also available on v6m. const can_yield = comptime std.Target.arm.featureSetHasAny(std.Target.current.cpu.features, .{ .has_v6k, .has_v6m }); - if (can_yield) asm volatile ("yield" ::: "memory"); + if (can_yield) asm volatile ("yield" ::: "memory") + // Fallback. + else asm volatile ("" ::: "memory"); }, .aarch64, .aarch64_be, .aarch64_32 => { asm volatile ("isb" ::: "memory");