1 ; Verify that i32 argument/return values are extended to i64 2 3 ; RUN: llc < %s | FileCheck %s 4 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64" 5 target triple = "powerpc64-unknown-linux-gnu" 6 7 @si = common global i32 0, align 4 8 @ui = common global i32 0, align 4 9 10 declare void @arg_si(i32 signext) 11 declare void @arg_ui(i32 zeroext) 12 13 declare signext i32 @ret_si() 14 declare zeroext i32 @ret_ui() 15 16 define void @pass_arg_si() nounwind { 17 entry: 18 %0 = load i32, i32* @si, align 4 19 tail call void @arg_si(i32 signext %0) nounwind 20 ret void 21 } 22 ; CHECK: @pass_arg_si 23 ; CHECK: lwa 3, 24 ; CHECK: bl arg_si 25 26 define void @pass_arg_ui() nounwind { 27 entry: 28 %0 = load i32, i32* @ui, align 4 29 tail call void @arg_ui(i32 zeroext %0) nounwind 30 ret void 31 } 32 ; CHECK: @pass_arg_ui 33 ; CHECK: lwz 3, 34 ; CHECK: bl arg_ui 35 36 define i64 @use_arg_si(i32 signext %x) nounwind readnone { 37 entry: 38 %conv = sext i32 %x to i64 39 ret i64 %conv 40 } 41 ; CHECK: @use_arg_si 42 ; CHECK: %entry 43 ; CHECK-NEXT: blr 44 45 define i64 @use_arg_ui(i32 zeroext %x) nounwind readnone { 46 entry: 47 %conv = zext i32 %x to i64 48 ret i64 %conv 49 } 50 ; CHECK: @use_arg_ui 51 ; CHECK: %entry 52 ; CHECK-NEXT: blr 53 54 define signext i32 @pass_ret_si() nounwind readonly { 55 entry: 56 %0 = load i32, i32* @si, align 4 57 ret i32 %0 58 } 59 ; CHECK: @pass_ret_si 60 ; CHECK: lwa 3, 61 ; CHECK: blr 62 63 define zeroext i32 @pass_ret_ui() nounwind readonly { 64 entry: 65 %0 = load i32, i32* @ui, align 4 66 ret i32 %0 67 } 68 ; CHECK: @pass_ret_ui 69 ; CHECK: lwz 3, 70 ; CHECK: blr 71 72 define i64 @use_ret_si() nounwind { 73 entry: 74 %call = tail call signext i32 @ret_si() nounwind 75 %conv = sext i32 %call to i64 76 ret i64 %conv 77 } 78 ; CHECK: @use_ret_si 79 ; CHECK: bl ret_si 80 ; This is to verify the return register (3) set up by the ret_si 81 ; call is passed on unmodified as return value of use_ret_si. 82 ; CHECK-NOT: 3 83 ; CHECK: blr 84 85 define i64 @use_ret_ui() nounwind { 86 entry: 87 %call = tail call zeroext i32 @ret_ui() nounwind 88 %conv = zext i32 %call to i64 89 ret i64 %conv 90 } 91 ; CHECK: @use_ret_ui 92 ; CHECK: bl ret_ui 93 ; This is to verify the return register (3) set up by the ret_ui 94 ; call is passed on unmodified as return value of use_ret_ui. 95 ; CHECK-NOT: 3 96 ; CHECK: blr 97 98