Skip to content

Commit e7f1624

Browse files
committed
std.mem: work around LoongArch inline asm bug in doNotOptimizeAway()
llvm/llvm-project#159200
1 parent c547a05 commit e7f1624

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/std/mem.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4534,7 +4534,8 @@ pub fn doNotOptimizeAway(val: anytype) void {
45344534
} else doNotOptimizeAway(&val);
45354535
},
45364536
.float => {
4537-
if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c) {
4537+
// https://github.com/llvm/llvm-project/issues/159200
4538+
if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c and !builtin.cpu.arch.isLoongArch()) {
45384539
asm volatile (""
45394540
:
45404541
: [_] "rm" (val),

0 commit comments

Comments
 (0)