1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mipsel -mcpu=mips32 -O0 -relocation-model=pic \ 2*9880d681SAndroid Build Coastguard Worker; RUN: -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s \ 3*9880d681SAndroid Build Coastguard Worker; RUN: -check-prefix=ALL -check-prefix=32R1 4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -O0 -relocation-model=pic \ 5*9880d681SAndroid Build Coastguard Worker; RUN: -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s \ 6*9880d681SAndroid Build Coastguard Worker; RUN: -check-prefix=ALL -check-prefix=32R2 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker@str = private unnamed_addr constant [12 x i8] c"hello there\00", align 1 9*9880d681SAndroid Build Coastguard Worker@src = global i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0), align 4 10*9880d681SAndroid Build Coastguard Worker@i = global i32 12, align 4 11*9880d681SAndroid Build Coastguard Worker@dest = common global [50 x i8] zeroinitializer, align 1 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) 14*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) 15*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdefine void @cpy(i8* %src, i32 %i) { 18*9880d681SAndroid Build Coastguard Worker ; ALL-LABEL: cpy: 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}}) 21*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: sw $4, 24($sp) 22*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: move $4, $[[T0]] 23*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: sw $5, 20($sp) 24*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T1:[0-9]+]], 24($sp) 25*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: move $5, $[[T1]] 26*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $6, 20($sp) 27*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memcpy)(${{[0-9]+}}) 28*9880d681SAndroid Build Coastguard Worker ; ALL: jalr $[[T2]] 29*9880d681SAndroid Build Coastguard Worker ; ALL-NEXT: nop 30*9880d681SAndroid Build Coastguard Worker ; ALL-NOT: {{.*}}$2{{.*}} 31*9880d681SAndroid Build Coastguard Worker call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), 32*9880d681SAndroid Build Coastguard Worker i8* %src, i32 %i, i32 1, i1 false) 33*9880d681SAndroid Build Coastguard Worker ret void 34*9880d681SAndroid Build Coastguard Worker} 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerdefine void @mov(i8* %src, i32 %i) { 37*9880d681SAndroid Build Coastguard Worker ; ALL-LABEL: mov: 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}}) 41*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: sw $4, 24($sp) 42*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: move $4, $[[T0]] 43*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: sw $5, 20($sp) 44*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T1:[0-9]+]], 24($sp) 45*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: move $5, $[[T1]] 46*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $6, 20($sp) 47*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memmove)(${{[0-9]+}}) 48*9880d681SAndroid Build Coastguard Worker ; ALL: jalr $[[T2]] 49*9880d681SAndroid Build Coastguard Worker ; ALL-NEXT: nop 50*9880d681SAndroid Build Coastguard Worker ; ALL-NOT: {{.*}}$2{{.*}} 51*9880d681SAndroid Build Coastguard Worker call void @llvm.memmove.p0i8.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), 52*9880d681SAndroid Build Coastguard Worker i8* %src, i32 %i, i32 1, i1 false) 53*9880d681SAndroid Build Coastguard Worker ret void 54*9880d681SAndroid Build Coastguard Worker} 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Workerdefine void @clear(i32 %i) { 57*9880d681SAndroid Build Coastguard Worker ; ALL-LABEL: clear: 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}}) 60*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: sw $4, 16($sp) 61*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: move $4, $[[T0]] 62*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: addiu $[[T1:[0-9]+]], $zero, 42 63*9880d681SAndroid Build Coastguard Worker ; 32R1-DAG: sll $[[T2:[0-9]+]], $[[T1]], 24 64*9880d681SAndroid Build Coastguard Worker ; 32R1-DAG: sra $5, $[[T2]], 24 65*9880d681SAndroid Build Coastguard Worker ; 32R2-DAG: seb $5, $[[T1]] 66*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $6, 16($sp) 67*9880d681SAndroid Build Coastguard Worker ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memset)(${{[0-9]+}}) 68*9880d681SAndroid Build Coastguard Worker ; ALL: jalr $[[T2]] 69*9880d681SAndroid Build Coastguard Worker ; ALL-NEXT: nop 70*9880d681SAndroid Build Coastguard Worker ; ALL-NOT: {{.*}}$2{{.*}} 71*9880d681SAndroid Build Coastguard Worker call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), 72*9880d681SAndroid Build Coastguard Worker i8 42, i32 %i, i32 1, i1 false) 73*9880d681SAndroid Build Coastguard Worker ret void 74*9880d681SAndroid Build Coastguard Worker} 75