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