| ... | ... | @@ -4,27 +4,28 @@ const std = @import("std"); |
| 4 | 4 | test "@prefetch()" { |
| 5 | 5 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 6 | 6 | |
| 7 | | var a: u32 = 42; |
| 7 | var a: [2]u32 = .{ 42, 42 }; |
| 8 | var a_len = a.len; |
| 8 | 9 | |
| 9 | 10 | @prefetch(&a, .{}); |
| 10 | 11 | |
| 11 | | @prefetch(&a, .{ .rw = .read, .locality = 3, .cache = .data }); |
| 12 | @prefetch(&a[0], .{ .rw = .read, .locality = 3, .cache = .data }); |
| 12 | 13 | @prefetch(&a, .{ .rw = .read, .locality = 2, .cache = .data }); |
| 13 | | @prefetch(&a, .{ .rw = .read, .locality = 1, .cache = .data }); |
| 14 | | @prefetch(&a, .{ .rw = .read, .locality = 0, .cache = .data }); |
| 14 | @prefetch(a[0..].ptr, .{ .rw = .read, .locality = 1, .cache = .data }); |
| 15 | @prefetch(a[0..a_len], .{ .rw = .read, .locality = 0, .cache = .data }); |
| 15 | 16 | |
| 16 | | @prefetch(&a, .{ .rw = .write, .locality = 3, .cache = .data }); |
| 17 | @prefetch(&a[0], .{ .rw = .write, .locality = 3, .cache = .data }); |
| 17 | 18 | @prefetch(&a, .{ .rw = .write, .locality = 2, .cache = .data }); |
| 18 | | @prefetch(&a, .{ .rw = .write, .locality = 1, .cache = .data }); |
| 19 | | @prefetch(&a, .{ .rw = .write, .locality = 0, .cache = .data }); |
| 19 | @prefetch(a[0..].ptr, .{ .rw = .write, .locality = 1, .cache = .data }); |
| 20 | @prefetch(a[0..a_len], .{ .rw = .write, .locality = 0, .cache = .data }); |
| 20 | 21 | |
| 21 | | @prefetch(&a, .{ .rw = .read, .locality = 3, .cache = .instruction }); |
| 22 | @prefetch(&a[0], .{ .rw = .read, .locality = 3, .cache = .instruction }); |
| 22 | 23 | @prefetch(&a, .{ .rw = .read, .locality = 2, .cache = .instruction }); |
| 23 | | @prefetch(&a, .{ .rw = .read, .locality = 1, .cache = .instruction }); |
| 24 | | @prefetch(&a, .{ .rw = .read, .locality = 0, .cache = .instruction }); |
| 24 | @prefetch(a[0..].ptr, .{ .rw = .read, .locality = 1, .cache = .instruction }); |
| 25 | @prefetch(a[0..a_len], .{ .rw = .read, .locality = 0, .cache = .instruction }); |
| 25 | 26 | |
| 26 | | @prefetch(&a, .{ .rw = .write, .locality = 3, .cache = .instruction }); |
| 27 | @prefetch(&a[0], .{ .rw = .write, .locality = 3, .cache = .instruction }); |
| 27 | 28 | @prefetch(&a, .{ .rw = .write, .locality = 2, .cache = .instruction }); |
| 28 | | @prefetch(&a, .{ .rw = .write, .locality = 1, .cache = .instruction }); |
| 29 | | @prefetch(&a, .{ .rw = .write, .locality = 0, .cache = .instruction }); |
| 29 | @prefetch(a[0..].ptr, .{ .rw = .write, .locality = 1, .cache = .instruction }); |
| 30 | @prefetch(a[0..a_len], .{ .rw = .write, .locality = 0, .cache = .instruction }); |
| 30 | 31 | } |