about summary refs log tree commit diff
path: root/tests/codegen-llvm/intrinsics/volatile_order.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen-llvm/intrinsics/volatile_order.rs')
-rw-r--r--tests/codegen-llvm/intrinsics/volatile_order.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/codegen-llvm/intrinsics/volatile_order.rs b/tests/codegen-llvm/intrinsics/volatile_order.rs
new file mode 100644
index 00000000000..99469831a6c
--- /dev/null
+++ b/tests/codegen-llvm/intrinsics/volatile_order.rs
@@ -0,0 +1,18 @@
+#![crate_type = "lib"]
+#![feature(core_intrinsics)]
+
+use std::intrinsics::*;
+
+pub unsafe fn test_volatile_order() {
+    let mut a: Box<u8> = Box::new(0);
+    // CHECK: load volatile
+    let x = volatile_load(&*a);
+    // CHECK: load volatile
+    let x = volatile_load(&*a);
+    // CHECK: store volatile
+    volatile_store(&mut *a, 12);
+    // CHECK: store volatile
+    unaligned_volatile_store(&mut *a, 12);
+    // CHECK: llvm.memset.p0
+    volatile_set_memory(&mut *a, 12, 1)
+}