1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -target-abi n64 -mcpu=mips64r2 | FileCheck %s -check-prefixes=ALL,MIPSEB 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64el -target-abi n64 -mcpu=mips64r2 | FileCheck %s -check-prefixes=ALL,MIPSEL 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -target-abi n32 -mcpu=mips64r2 | FileCheck %s -check-prefixes=ALL,MIPSEB 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64el -target-abi n32 -mcpu=mips64r2 | FileCheck %s -check-prefixes=ALL,MIPSEL 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; #include <stdio.h> 7*9880d681SAndroid Build Coastguard Worker; 8*9880d681SAndroid Build Coastguard Worker; struct S1 { 9*9880d681SAndroid Build Coastguard Worker; char x1; 10*9880d681SAndroid Build Coastguard Worker; short x2; 11*9880d681SAndroid Build Coastguard Worker; char x3; 12*9880d681SAndroid Build Coastguard Worker; }; 13*9880d681SAndroid Build Coastguard Worker; 14*9880d681SAndroid Build Coastguard Worker; struct S2 { 15*9880d681SAndroid Build Coastguard Worker; char x1; 16*9880d681SAndroid Build Coastguard Worker; char x2; 17*9880d681SAndroid Build Coastguard Worker; char x3; 18*9880d681SAndroid Build Coastguard Worker; char x4; 19*9880d681SAndroid Build Coastguard Worker; char x5; 20*9880d681SAndroid Build Coastguard Worker; }; 21*9880d681SAndroid Build Coastguard Worker; 22*9880d681SAndroid Build Coastguard Worker; void fS1(struct S1 s); 23*9880d681SAndroid Build Coastguard Worker; void fS2(struct S2 s); 24*9880d681SAndroid Build Coastguard Worker; 25*9880d681SAndroid Build Coastguard Worker; void f1() { 26*9880d681SAndroid Build Coastguard Worker; struct S1 s1_1; 27*9880d681SAndroid Build Coastguard Worker; fS1(s1_1); 28*9880d681SAndroid Build Coastguard Worker; } 29*9880d681SAndroid Build Coastguard Worker; 30*9880d681SAndroid Build Coastguard Worker; void f2() { 31*9880d681SAndroid Build Coastguard Worker; struct S2 s2_1; 32*9880d681SAndroid Build Coastguard Worker; fS2(s2_1); 33*9880d681SAndroid Build Coastguard Worker; } 34*9880d681SAndroid Build Coastguard Worker; 35*9880d681SAndroid Build Coastguard Worker; int main() { 36*9880d681SAndroid Build Coastguard Worker; f1(); 37*9880d681SAndroid Build Coastguard Worker; f2(); 38*9880d681SAndroid Build Coastguard Worker; } 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker%struct.S1 = type { i8, i16, i8 } 41*9880d681SAndroid Build Coastguard Worker%struct.S2 = type { i8, i8, i8, i8, i8 } 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Workerdeclare void @fS1(i48 inreg) #1 44*9880d681SAndroid Build Coastguard Workerdeclare void @fS2(i40 inreg) #1 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Workerdefine void @f1() #0 { 49*9880d681SAndroid Build Coastguard Workerentry: 50*9880d681SAndroid Build Coastguard Worker %s1_1 = alloca %struct.S1, align 2 51*9880d681SAndroid Build Coastguard Worker %s1_1.coerce = alloca { i48 } 52*9880d681SAndroid Build Coastguard Worker %0 = bitcast { i48 }* %s1_1.coerce to i8* 53*9880d681SAndroid Build Coastguard Worker %1 = bitcast %struct.S1* %s1_1 to i8* 54*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 6, i32 0, i1 false) 55*9880d681SAndroid Build Coastguard Worker %2 = getelementptr { i48 }, { i48 }* %s1_1.coerce, i32 0, i32 0 56*9880d681SAndroid Build Coastguard Worker %3 = load i48, i48* %2, align 1 57*9880d681SAndroid Build Coastguard Worker call void @fS1(i48 inreg %3) 58*9880d681SAndroid Build Coastguard Worker ret void 59*9880d681SAndroid Build Coastguard Worker ; ALL-LABEL: f1: 60*9880d681SAndroid Build Coastguard Worker 61*9880d681SAndroid Build Coastguard Worker ; MIPSEB: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 62*9880d681SAndroid Build Coastguard Worker ; MIPSEL-NOT: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 16 63*9880d681SAndroid Build Coastguard Worker} 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Workerdefine void @f2() #0 { 66*9880d681SAndroid Build Coastguard Workerentry: 67*9880d681SAndroid Build Coastguard Worker %s2_1 = alloca %struct.S2, align 1 68*9880d681SAndroid Build Coastguard Worker %s2_1.coerce = alloca { i40 } 69*9880d681SAndroid Build Coastguard Worker %0 = bitcast { i40 }* %s2_1.coerce to i8* 70*9880d681SAndroid Build Coastguard Worker %1 = bitcast %struct.S2* %s2_1 to i8* 71*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 5, i32 0, i1 false) 72*9880d681SAndroid Build Coastguard Worker %2 = getelementptr { i40 }, { i40 }* %s2_1.coerce, i32 0, i32 0 73*9880d681SAndroid Build Coastguard Worker %3 = load i40, i40* %2, align 1 74*9880d681SAndroid Build Coastguard Worker call void @fS2(i40 inreg %3) 75*9880d681SAndroid Build Coastguard Worker ret void 76*9880d681SAndroid Build Coastguard Worker ; ALL-LABEL: f2: 77*9880d681SAndroid Build Coastguard Worker 78*9880d681SAndroid Build Coastguard Worker ; MIPSEB: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24 79*9880d681SAndroid Build Coastguard Worker ; MIPSEL-NOT: dsll $[[R1:[0-9]+]], $[[R2:[0-9]+]], 24 80*9880d681SAndroid Build Coastguard Worker} 81