| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 4 | const expectEqual = std.testing.expectEqual; | | |
| 5 | | 4 | |
| 6 | const supports_128_bit_atomics = switch (builtin.cpu.arch) { | 5 | const supports_128_bit_atomics = switch (builtin.cpu.arch) { |
| 7 | // TODO: Ideally this could be sync'd with the logic in Sema. | 6 | // TODO: Ideally this could be sync'd with the logic in Sema. |
| ... | @@ -364,25 +363,32 @@ test "atomics with different types" { | ... | @@ -364,25 +363,32 @@ test "atomics with different types" { |
| 364 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 363 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 365 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 364 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 366 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 365 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| | 366 | if (builtin.target.cpu.arch.endian() == .big) return error.SkipZigTest; // #24282 |
| 367 | | 367 | |
| 368 | try testAtomicsWithType(bool, true, false); | 368 | try testAtomicsWithType(bool, true, false); |
| 369 | | 369 | |
| 370 | try testAtomicsWithType(u1, 0, 1); | 370 | try testAtomicsWithType(u1, 0, 1); |
| 371 | try testAtomicsWithType(i4, 0, 1); | 371 | try testAtomicsWithType(i4, 2, 1); |
| 372 | try testAtomicsWithType(u5, 0, 1); | 372 | try testAtomicsWithType(u5, 2, 1); |
| 373 | try testAtomicsWithType(i15, 0, 1); | 373 | try testAtomicsWithType(i15, 2, 1); |
| 374 | try testAtomicsWithType(u24, 0, 1); | 374 | try testAtomicsWithType(u24, 2, 1); |
| 375 | | 375 | |
| 376 | try testAtomicsWithType(u0, 0, 0); | 376 | try testAtomicsWithType(u0, 0, 0); |
| 377 | try testAtomicsWithType(i0, 0, 0); | 377 | try testAtomicsWithType(i0, 0, 0); |
| 378 | | 378 | |
| 379 | try testAtomicsWithType(enum(u32) { x = 1234, y = 5678 }, .x, .y); | 379 | try testAtomicsWithType(enum(u32) { x = 1234, y = 5678 }, .x, .y); |
| | 380 | try testAtomicsWithType(enum(u19) { x = 1234, y = 5678 }, .x, .y); |
| 380 | | 381 | |
| 381 | try testAtomicsWithPackedStruct( | 382 | try testAtomicsWithPackedStruct( |
| 382 | packed struct { x: u7, y: u24, z: bool }, | 383 | packed struct { x: u7, y: u24, z: bool }, |
| 383 | .{ .x = 1, .y = 2, .z = true }, | 384 | .{ .x = 1, .y = 2, .z = true }, |
| 384 | .{ .x = 3, .y = 4, .z = false }, | 385 | .{ .x = 3, .y = 4, .z = false }, |
| 385 | ); | 386 | ); |
| | 387 | try testAtomicsWithPackedStruct( |
| | 388 | packed struct { x: u19, y: bool }, |
| | 389 | .{ .x = 1, .y = true }, |
| | 390 | .{ .x = 3, .y = false }, |
| | 391 | ); |
| 386 | } | 392 | } |
| 387 | | 393 | |
| 388 | fn testAtomicsWithType(comptime T: type, a: T, b: T) !void { | 394 | fn testAtomicsWithType(comptime T: type, a: T, b: T) !void { |