| ... | ... | @@ -74,26 +74,22 @@ test "cmpxchg with ptr" { |
| 74 | 74 | try expect(x == &data2); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | | // TODO this test is disabled until this issue is resolved: |
| 78 | | // https://github.com/ziglang/zig/issues/2883 |
| 79 | | // otherwise cross compiling will result in: |
| 80 | | // lld: error: undefined symbol: __sync_val_compare_and_swap_16 |
| 81 | | //test "128-bit cmpxchg" { |
| 82 | | // var x: u128 align(16) = 1234; // TODO: https://github.com/ziglang/zig/issues/2987 |
| 83 | | // if (@cmpxchgWeak(u128, &x, 99, 5678, .SeqCst, .SeqCst)) |x1| { |
| 84 | | // try expect(x1 == 1234); |
| 85 | | // } else { |
| 86 | | // @panic("cmpxchg should have failed"); |
| 87 | | // } |
| 88 | | // |
| 89 | | // while (@cmpxchgWeak(u128, &x, 1234, 5678, .SeqCst, .SeqCst)) |x1| { |
| 90 | | // try expect(x1 == 1234); |
| 91 | | // } |
| 92 | | // try expect(x == 5678); |
| 93 | | // |
| 94 | | // try expect(@cmpxchgStrong(u128, &x, 5678, 42, .SeqCst, .SeqCst) == null); |
| 95 | | // try expect(x == 42); |
| 96 | | //} |
| 77 | test "128-bit cmpxchg" { |
| 78 | var x: u128 = 1234; |
| 79 | if (@cmpxchgWeak(u128, &x, 99, 5678, .SeqCst, .SeqCst)) |x1| { |
| 80 | try expect(x1 == 1234); |
| 81 | } else { |
| 82 | @panic("cmpxchg should have failed"); |
| 83 | } |
| 84 | |
| 85 | while (@cmpxchgWeak(u128, &x, 1234, 5678, .SeqCst, .SeqCst)) |x1| { |
| 86 | try expect(x1 == 1234); |
| 87 | } |
| 88 | try expect(x == 5678); |
| 89 | |
| 90 | try expect(@cmpxchgStrong(u128, &x, 5678, 42, .SeqCst, .SeqCst) == null); |
| 91 | try expect(x == 42); |
| 92 | } |
| 97 | 93 | |
| 98 | 94 | test "cmpxchg with ignored result" { |
| 99 | 95 | var x: i32 = 1234; |