2 #![feature(core_intrinsics)]
4 use std::intrinsics::{ volatile_copy_memory, volatile_store, volatile_load,
5 volatile_copy_nonoverlapping_memory,
9 // This test ensures that volatile intrinsics can be specialised with
10 // zero-sized types and, in case of copy/set functions, can accept
11 // number of elements equal to zero.
14 let mut dst_pair = (1, 2);
15 let src_pair = (3, 4);
16 let mut dst_empty = ();
19 const COUNT_0: usize = 0;
20 const COUNT_100: usize = 100;
23 volatile_copy_memory(&mut dst_pair, &dst_pair, COUNT_0);
24 volatile_copy_nonoverlapping_memory(&mut dst_pair, &src_pair, 0);
25 volatile_copy_memory(&mut dst_empty, &dst_empty, 100);
26 volatile_copy_nonoverlapping_memory(&mut dst_empty, &src_empty,
28 volatile_set_memory(&mut dst_empty, 0, COUNT_100);
29 volatile_set_memory(&mut dst_pair, 0, COUNT_0);
30 volatile_store(&mut dst_empty, ());
31 volatile_store(&mut dst_empty, src_empty);
32 volatile_load(&src_empty);