1 ; RUN: llc -mtriple=arm64_32-apple-ios7.0 %s -o - | FileCheck %s
3 define void @pass_pointer(i64 %in) {
4 ; CHECK-LABEL: pass_pointer:
5 ; CHECK: and x0, x0, #0xffffffff
6 ; CHECK: bl _take_pointer
8 %in32 = trunc i64 %in to i32
9 %ptr = inttoptr i32 %in32 to i8*
10 call i64 @take_pointer(i8* %ptr)
14 define i64 @take_pointer(i8* %ptr) nounwind {
15 ; CHECK-LABEL: take_pointer:
19 %val = ptrtoint i8* %ptr to i32
20 %res = zext i32 %val to i64
24 define i32 @callee_ptr_stack_slot([8 x i64], i8*, i32 %val) {
25 ; CHECK-LABEL: callee_ptr_stack_slot:
26 ; CHECK: ldr w0, [sp, #4]
31 define void @caller_ptr_stack_slot(i8* %ptr) {
32 ; CHECK-LABEL: caller_ptr_stack_slot:
33 ; CHECK-DAG: mov [[VAL:w[0-9]]], #42
34 ; CHECK: stp w0, [[VAL]], [sp]
36 call i32 @callee_ptr_stack_slot([8 x i64] undef, i8* %ptr, i32 42)
40 define i8* @return_ptr(i64 %in, i64 %r) {
41 ; CHECK-LABEL: return_ptr:
42 ; CHECK: sdiv [[VAL64:x[0-9]+]], x0, x1
43 ; CHECK: and x0, [[VAL64]], #0xffffffff
45 %sum = sdiv i64 %in, %r
46 %sum32 = trunc i64 %sum to i32
47 %res = inttoptr i32 %sum32 to i8*