blob: 305dcf8557298ba8378cb354686f65d8575fd1da [file] [log] [blame]
Petar Jovanovice578e972016-04-11 15:24:23 +00001; RUN: llc -march=mipsel -mxgot -relocation-model=pic < %s | FileCheck %s -check-prefix=O32
Simon Dardis57f4ae42016-08-04 09:17:07 +00002; RUN: llc -march=mips64el -mcpu=mips64r2 -mxgot -relocation-model=pic < %s | \
Akira Hatanakabb6e74a2012-11-21 20:40:38 +00003; RUN: FileCheck %s -check-prefix=N64
Petar Jovanovic3c039d92017-06-07 12:59:53 +00004; RUN: llc -march=mipsel -mxgot -relocation-model=pic -fast-isel < %s | FileCheck %s -check-prefix=O32
5; RUN: llc -march=mips64el -mcpu=mips64r2 -mxgot -relocation-model=pic -fast-isel < %s | \
6; RUN: FileCheck %s -check-prefix=N64
Akira Hatanakabb6e74a2012-11-21 20:40:38 +00007
8@v0 = external global i32
9
10define void @foo1() nounwind {
11entry:
Simon Dardis57f4ae42016-08-04 09:17:07 +000012; O32-LABEL: foo1:
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000013; O32: lui $[[R0:[0-9]+]], %got_hi(v0)
14; O32: addu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
15; O32: lw ${{[0-9]+}}, %got_lo(v0)($[[R1]])
16; O32: lui $[[R2:[0-9]+]], %call_hi(foo0)
17; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
18; O32: lw ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
19
Simon Dardis57f4ae42016-08-04 09:17:07 +000020; N64-LABEL: foo1:
Simon Dardisbd271542016-09-01 14:53:53 +000021; N64-DAG: lui $[[R0:[0-9]+]], %got_hi(v0)
22; N64-DAG: daddu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
23; N64-DAG: lui $[[R2:[0-9]+]], %call_hi(foo0)
24; N64-DAG: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
25; N64-DAG: ld ${{[0-9]+}}, %got_lo(v0)($[[R1]])
26; N64-DAG: ld ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000027
David Blaikiea79ac142015-02-27 21:17:42 +000028 %0 = load i32, i32* @v0, align 4
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000029 tail call void @foo0(i32 %0) nounwind
30 ret void
31}
32
33declare void @foo0(i32)
34
35; call to external function.
36
37define void @foo2(i32* nocapture %d, i32* nocapture %s, i32 %n) nounwind {
38entry:
Stephen Lind24ab202013-07-14 06:24:09 +000039; O32-LABEL: foo2:
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000040; O32: lui $[[R2:[0-9]+]], %call_hi(memcpy)
41; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
42; O32: lw ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
43
Stephen Lind24ab202013-07-14 06:24:09 +000044; N64-LABEL: foo2:
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000045; N64: lui $[[R2:[0-9]+]], %call_hi(memcpy)
46; N64: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
47; N64: ld ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
48
49 %0 = bitcast i32* %d to i8*
50 %1 = bitcast i32* %s to i8*
Daniel Neilson1e687242018-01-19 17:13:12 +000051 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 %1, i32 %n, i1 false)
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000052 ret void
53}
54
Daniel Neilson1e687242018-01-19 17:13:12 +000055declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind