1 ; RUN: llc -march=mipsel < %s | FileCheck %s 2 3 %0 = type { i8, i16, i32, i64, double, i32, [4 x i8] } 4 %struct.S1 = type { i8, i16, i32, i64, double, i32 } 5 %struct.S2 = type { [4 x i32] } 6 %struct.S3 = type { i8 } 7 8 @f1.s1 = internal unnamed_addr constant %0 { i8 1, i16 2, i32 3, i64 4, double 5.000000e+00, i32 6, [4 x i8] undef }, align 8 9 @f1.s2 = internal unnamed_addr constant %struct.S2 { [4 x i32] [i32 7, i32 8, i32 9, i32 10] }, align 4 10 11 define void @f1() nounwind { 12 entry: 13 ; CHECK: lw $[[R1:[0-9]+]], %got(f1.s1)($gp) 14 ; CHECK: addiu $[[R0:[0-9]+]], $[[R1]], %lo(f1.s1) 15 ; CHECK: lw $[[R6:[0-9]+]], 28($[[R0]]) 16 ; CHECK: lw $[[R5:[0-9]+]], 24($[[R0]]) 17 ; CHECK: lw $[[R4:[0-9]+]], 20($[[R0]]) 18 ; CHECK: lw $[[R3:[0-9]+]], 16($[[R0]]) 19 ; CHECK: lw $[[R7:[0-9]+]], 12($[[R0]]) 20 ; CHECK: lw $[[R2:[0-9]+]], 8($[[R0]]) 21 ; CHECK: sw $[[R6]], 36($sp) 22 ; CHECK: sw $[[R5]], 32($sp) 23 ; CHECK: sw $[[R4]], 28($sp) 24 ; CHECK: sw $[[R3]], 24($sp) 25 ; CHECK: sw $[[R7]], 20($sp) 26 ; CHECK: sw $[[R2]], 16($sp) 27 ; CHECK: lw $7, 4($[[R0]]) 28 ; CHECK: lw $6, %lo(f1.s1)($[[R1]]) 29 %agg.tmp10 = alloca %struct.S3, align 4 30 call void @callee1(float 2.000000e+01, %struct.S1* byval bitcast (%0* @f1.s1 to %struct.S1*)) nounwind 31 call void @callee2(%struct.S2* byval @f1.s2) nounwind 32 %tmp11 = getelementptr inbounds %struct.S3* %agg.tmp10, i32 0, i32 0 33 store i8 11, i8* %tmp11, align 4 34 call void @callee3(float 2.100000e+01, %struct.S3* byval %agg.tmp10, %struct.S1* byval bitcast (%0* @f1.s1 to %struct.S1*)) nounwind 35 ret void 36 } 37 38 declare void @callee1(float, %struct.S1* byval) 39 40 declare void @callee2(%struct.S2* byval) 41 42 declare void @callee3(float, %struct.S3* byval, %struct.S1* byval) 43 44 define void @f2(float %f, %struct.S1* nocapture byval %s1) nounwind { 45 entry: 46 ; CHECK: addiu $sp, $sp, -56 47 ; CHECK: sw $7, 68($sp) 48 ; CHECK: sw $6, 64($sp) 49 ; CHECK: lw $4, 88($sp) 50 ; CHECK: ldc1 $f[[F0:[0-9]+]], 80($sp) 51 ; CHECK: lw $[[R3:[0-9]+]], 72($sp) 52 ; CHECK: lw $[[R4:[0-9]+]], 76($sp) 53 ; CHECK: lw $[[R2:[0-9]+]], 68($sp) 54 ; CHECK: lh $[[R1:[0-9]+]], 66($sp) 55 ; CHECK: lb $[[R0:[0-9]+]], 64($sp) 56 ; CHECK: sw $[[R0]], 32($sp) 57 ; CHECK: sw $[[R1]], 28($sp) 58 ; CHECK: sw $[[R2]], 24($sp) 59 ; CHECK: sw $[[R4]], 20($sp) 60 ; CHECK: sw $[[R3]], 16($sp) 61 ; CHECK: mfc1 $6, $f[[F0]] 62 63 %i2 = getelementptr inbounds %struct.S1* %s1, i32 0, i32 5 64 %tmp = load i32* %i2, align 4, !tbaa !0 65 %d = getelementptr inbounds %struct.S1* %s1, i32 0, i32 4 66 %tmp1 = load double* %d, align 8, !tbaa !3 67 %ll = getelementptr inbounds %struct.S1* %s1, i32 0, i32 3 68 %tmp2 = load i64* %ll, align 8, !tbaa !4 69 %i = getelementptr inbounds %struct.S1* %s1, i32 0, i32 2 70 %tmp3 = load i32* %i, align 4, !tbaa !0 71 %s = getelementptr inbounds %struct.S1* %s1, i32 0, i32 1 72 %tmp4 = load i16* %s, align 2, !tbaa !5 73 %c = getelementptr inbounds %struct.S1* %s1, i32 0, i32 0 74 %tmp5 = load i8* %c, align 1, !tbaa !1 75 tail call void @callee4(i32 %tmp, double %tmp1, i64 %tmp2, i32 %tmp3, i16 signext %tmp4, i8 signext %tmp5, float %f) nounwind 76 ret void 77 } 78 79 declare void @callee4(i32, double, i64, i32, i16 signext, i8 signext, float) 80 81 define void @f3(%struct.S2* nocapture byval %s2) nounwind { 82 entry: 83 ; CHECK: addiu $sp, $sp, -56 84 ; CHECK: sw $7, 68($sp) 85 ; CHECK: sw $6, 64($sp) 86 ; CHECK: sw $5, 60($sp) 87 ; CHECK: sw $4, 56($sp) 88 ; CHECK: lw $4, 56($sp) 89 ; CHECK: lw $[[R0:[0-9]+]], 68($sp) 90 ; CHECK: sw $[[R0]], 24($sp) 91 92 %arrayidx = getelementptr inbounds %struct.S2* %s2, i32 0, i32 0, i32 0 93 %tmp = load i32* %arrayidx, align 4, !tbaa !0 94 %arrayidx2 = getelementptr inbounds %struct.S2* %s2, i32 0, i32 0, i32 3 95 %tmp3 = load i32* %arrayidx2, align 4, !tbaa !0 96 tail call void @callee4(i32 %tmp, double 2.000000e+00, i64 3, i32 %tmp3, i16 signext 4, i8 signext 5, float 6.000000e+00) nounwind 97 ret void 98 } 99 100 define void @f4(float %f, %struct.S3* nocapture byval %s3, %struct.S1* nocapture byval %s1) nounwind { 101 entry: 102 ; CHECK: addiu $sp, $sp, -56 103 ; CHECK: sw $7, 68($sp) 104 ; CHECK: sw $6, 64($sp) 105 ; CHECK: sw $5, 60($sp) 106 ; CHECK: lw $4, 68($sp) 107 ; CHECK: lw $[[R1:[0-9]+]], 88($sp) 108 ; CHECK: lb $[[R0:[0-9]+]], 60($sp) 109 ; CHECK: sw $[[R0]], 32($sp) 110 ; CHECK: sw $[[R1]], 24($sp) 111 112 %i = getelementptr inbounds %struct.S1* %s1, i32 0, i32 2 113 %tmp = load i32* %i, align 4, !tbaa !0 114 %i2 = getelementptr inbounds %struct.S1* %s1, i32 0, i32 5 115 %tmp1 = load i32* %i2, align 4, !tbaa !0 116 %c = getelementptr inbounds %struct.S3* %s3, i32 0, i32 0 117 %tmp2 = load i8* %c, align 1, !tbaa !1 118 tail call void @callee4(i32 %tmp, double 2.000000e+00, i64 3, i32 %tmp1, i16 signext 4, i8 signext %tmp2, float 6.000000e+00) nounwind 119 ret void 120 } 121 122 !0 = metadata !{metadata !"int", metadata !1} 123 !1 = metadata !{metadata !"omnipotent char", metadata !2} 124 !2 = metadata !{metadata !"Simple C/C++ TBAA", null} 125 !3 = metadata !{metadata !"double", metadata !1} 126 !4 = metadata !{metadata !"long long", metadata !1} 127 !5 = metadata !{metadata !"short", metadata !1} 128