|
| 1 | +// compile-flags: -C no-prepopulate-passes |
| 2 | + |
| 3 | +#![crate_type = "lib"] |
| 4 | +#![feature(core_intrinsics)] |
| 5 | + |
| 6 | +use std::intrinsics; |
| 7 | + |
| 8 | +// CHECK-LABEL: @volatile_copy_memory |
| 9 | +#[no_mangle] |
| 10 | +pub unsafe fn volatile_copy_memory(a: *mut u8, b: *const u8) { |
| 11 | + // CHECK: llvm.memmove.p0i8.p0i8.{{\w*(.*true)}} |
| 12 | + intrinsics::volatile_copy_memory(a, b, 1) |
| 13 | +} |
| 14 | + |
| 15 | +// CHECK-LABEL: @volatile_copy_nonoverlapping_memory |
| 16 | +#[no_mangle] |
| 17 | +pub unsafe fn volatile_copy_nonoverlapping_memory(a: *mut u8, b: *const u8) { |
| 18 | + // CHECK: llvm.memcpy.p0i8.p0i8.{{\w*(.*true)}} |
| 19 | + intrinsics::volatile_copy_nonoverlapping_memory(a, b, 1) |
| 20 | +} |
| 21 | + |
| 22 | +// CHECK-LABEL: @volatile_set_memory |
| 23 | +#[no_mangle] |
| 24 | +pub unsafe fn volatile_set_memory(a: *mut u8, b: u8) { |
| 25 | + // CHECK: llvm.memset.p0i8.{{\w*(.*true)}} |
| 26 | + intrinsics::volatile_set_memory(a, b, 1) |
| 27 | +} |
| 28 | + |
| 29 | +// CHECK-LABEL: @volatile_load |
| 30 | +#[no_mangle] |
| 31 | +pub unsafe fn volatile_load(a: *const u8) -> u8 { |
| 32 | + // CHECK: load volatile |
| 33 | + intrinsics::volatile_load(a) |
| 34 | +} |
| 35 | + |
| 36 | +// CHECK-LABEL: @volatile_store |
| 37 | +#[no_mangle] |
| 38 | +pub unsafe fn volatile_store(a: *mut u8, b: u8) { |
| 39 | + // CHECK: store volatile |
| 40 | + intrinsics::volatile_store(a, b) |
| 41 | +} |
| 42 | + |
| 43 | +// CHECK-LABEL: @unaligned_volatile_load |
| 44 | +#[no_mangle] |
| 45 | +pub unsafe fn unaligned_volatile_load(a: *const u8) -> u8 { |
| 46 | + // CHECK: load volatile |
| 47 | + intrinsics::unaligned_volatile_load(a) |
| 48 | +} |
| 49 | + |
| 50 | +// CHECK-LABEL: @unaligned_volatile_store |
| 51 | +#[no_mangle] |
| 52 | +pub unsafe fn unaligned_volatile_store(a: *mut u8, b: u8) { |
| 53 | + // CHECK: store volatile |
| 54 | + intrinsics::unaligned_volatile_store(a, b) |
| 55 | +} |
0 commit comments