1 ; RUN: llc < %s -march=mipsel -mcpu=mips32 -O0 -relocation-model=pic \
2 ; RUN: -fast-isel-abort=3 -verify-machineinstrs | FileCheck %s \
3 ; RUN: -check-prefix=ALL -check-prefix=32R1
4 ; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -O0 -relocation-model=pic \
5 ; RUN: -fast-isel-abort=3 -verify-machineinstrs | FileCheck %s \
6 ; RUN: -check-prefix=ALL -check-prefix=32R2
8 @str = private unnamed_addr constant [12 x i8] c"hello there\00", align 1
9 @src = global i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i32 0, i32 0), align 4
10 @i = global i32 12, align 4
11 @dest = common global [50 x i8] zeroinitializer, align 1
13 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1)
14 declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1)
15 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1)
17 define void @cpy(i8* %src, i32 %i) {
20 ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}})
21 ; ALL-DAG: sw $4, 24($sp)
22 ; ALL-DAG: move $4, $[[T0]]
23 ; ALL-DAG: sw $5, 20($sp)
24 ; ALL-DAG: lw $[[T1:[0-9]+]], 24($sp)
25 ; ALL-DAG: move $5, $[[T1]]
26 ; ALL-DAG: lw $6, 20($sp)
27 ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memcpy)(${{[0-9]+}})
30 ; ALL-NOT: {{.*}}$2{{.*}}
31 call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), i8* %src, i32 %i, i1 false)
35 define void @mov(i8* %src, i32 %i) {
39 ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}})
40 ; ALL-DAG: sw $4, 24($sp)
41 ; ALL-DAG: move $4, $[[T0]]
42 ; ALL-DAG: sw $5, 20($sp)
43 ; ALL-DAG: lw $[[T1:[0-9]+]], 24($sp)
44 ; ALL-DAG: move $5, $[[T1]]
45 ; ALL-DAG: lw $6, 20($sp)
46 ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memmove)(${{[0-9]+}})
49 ; ALL-NOT: {{.*}}$2{{.*}}
50 call void @llvm.memmove.p0i8.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), i8* %src, i32 %i, i1 false)
54 define void @clear(i32 %i) {
57 ; ALL-DAG: lw $[[T0:[0-9]+]], %got(dest)(${{[0-9]+}})
58 ; ALL-DAG: sw $4, 16($sp)
59 ; ALL-DAG: move $4, $[[T0]]
60 ; ALL-DAG: addiu $[[T1:[0-9]+]], $zero, 42
61 ; 32R1-DAG: sll $[[T2:[0-9]+]], $[[T1]], 24
62 ; 32R1-DAG: sra $5, $[[T2]], 24
63 ; 32R2-DAG: seb $5, $[[T1]]
64 ; ALL-DAG: lw $6, 16($sp)
65 ; ALL-DAG: lw $[[T2:[0-9]+]], %got(memset)(${{[0-9]+}})
68 ; ALL-NOT: {{.*}}$2{{.*}}
69 call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @dest, i32 0, i32 0), i8 42, i32 %i, i1 false)