mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
28 lines
1.2 KiB
Zig
28 lines
1.2 KiB
Zig
const std = @import("std");
|
|
|
|
test "@prefetch()" {
|
|
var a: u32 = 42;
|
|
|
|
@prefetch(&a, .{});
|
|
|
|
@prefetch(&a, .{ .rw = .read, .locality = 3, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 2, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 1, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 0, .cache = .data });
|
|
|
|
@prefetch(&a, .{ .rw = .write, .locality = 3, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 2, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 1, .cache = .data });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 0, .cache = .data });
|
|
|
|
@prefetch(&a, .{ .rw = .read, .locality = 3, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 2, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 1, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .read, .locality = 0, .cache = .instruction });
|
|
|
|
@prefetch(&a, .{ .rw = .write, .locality = 3, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 2, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 1, .cache = .instruction });
|
|
@prefetch(&a, .{ .rw = .write, .locality = 0, .cache = .instruction });
|
|
}
|