1 // assembly-output: emit-asm
2 // compile-flags: -Copt-level=1
4 // min-llvm-version: 14.0
7 // CHECK-LABEL: align_offset_byte_ptr
12 pub fn align_offset_byte_ptr(ptr: *const u8) -> usize {
16 // CHECK-LABEL: align_offset_byte_slice
21 pub fn align_offset_byte_slice(slice: &[u8]) -> usize {
22 slice.as_ptr().align_offset(32)
25 // CHECK-LABEL: align_offset_word_ptr
30 // This `ptr` is not known to be aligned, so it is required to check if it is at all possible to
31 // align. LLVM applies a simple mask.
34 pub fn align_offset_word_ptr(ptr: *const u32) -> usize {
38 // CHECK-LABEL: align_offset_word_slice
43 // `slice` is known to be aligned, so `!0` is not possible as a return
46 pub fn align_offset_word_slice(slice: &[u32]) -> usize {
47 slice.as_ptr().align_offset(32)