about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/prefetch.rs
blob: 99c75c38bde533c59890c721c96323bba21eeead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![feature(core_intrinsics)]

// Test that these intrinsics work. Their behavior should be a no-op.

fn main() {
    static X: [u8; 8] = [0; 8];

    ::std::intrinsics::prefetch_read_data::<_, 1>(::std::ptr::null::<u8>());
    ::std::intrinsics::prefetch_read_data::<_, 2>(::std::ptr::dangling::<u8>());
    ::std::intrinsics::prefetch_read_data::<_, 3>(X.as_ptr());

    ::std::intrinsics::prefetch_write_data::<_, 1>(::std::ptr::null::<u8>());
    ::std::intrinsics::prefetch_write_data::<_, 2>(::std::ptr::dangling::<u8>());
    ::std::intrinsics::prefetch_write_data::<_, 3>(X.as_ptr());

    ::std::intrinsics::prefetch_read_instruction::<_, 1>(::std::ptr::null::<u8>());
    ::std::intrinsics::prefetch_read_instruction::<_, 2>(::std::ptr::dangling::<u8>());
    ::std::intrinsics::prefetch_read_instruction::<_, 3>(X.as_ptr());

    ::std::intrinsics::prefetch_write_instruction::<_, 1>(::std::ptr::null::<u8>());
    ::std::intrinsics::prefetch_write_instruction::<_, 2>(::std::ptr::dangling::<u8>());
    ::std::intrinsics::prefetch_write_instruction::<_, 3>(X.as_ptr());
}