1 // assembly-output: emit-asm
2 // compile-flags: -Copt-level=1
4 // min-llvm-version: 15.0
5 #![crate_type = "rlib"]
7 // CHECK-LABEL: old_style
8 // CHECK: movq %{{.*}}, %rax
12 pub fn old_style(a: *mut u8) -> *mut u8 {
13 (a as usize | 1) as *mut u8
16 // CHECK-LABEL: cheri_compat
17 // CHECK: movq %{{.*}}, %rax
18 // CHECK: orq $1, %rax
21 pub fn cheri_compat(a: *mut u8) -> *mut u8 {
24 let diff = new.wrapping_sub(old);
28 // CHECK-LABEL: definitely_not_a_null_pointer
29 // CHECK: movq %{{.*}}, %rax
30 // CHECK: orq $1, %rax
33 pub fn definitely_not_a_null_pointer(a: *mut u8) -> *mut u8 {
36 a.wrapping_sub(old).wrapping_add(new)