blob: aafaf55ae184693c8d2dc0aafcfb5b5b8aac6095 [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
2; RUN: llc -march=mips64el -mcpu=mips64r2 -mattr=+n64 -mxgot -relocation-model=pic < %s | \
Akira Hatanakabb6e74a2012-11-21 20:40:38 +00003; RUN: FileCheck %s -check-prefix=N64
4
5@v0 = external global i32
6
7define void @foo1() nounwind {
8entry:
9; O32: lui $[[R0:[0-9]+]], %got_hi(v0)
10; O32: addu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
11; O32: lw ${{[0-9]+}}, %got_lo(v0)($[[R1]])
12; O32: lui $[[R2:[0-9]+]], %call_hi(foo0)
13; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
14; O32: lw ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
15
16; N64: lui $[[R0:[0-9]+]], %got_hi(v0)
17; N64: daddu $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
18; N64: ld ${{[0-9]+}}, %got_lo(v0)($[[R1]])
19; N64: lui $[[R2:[0-9]+]], %call_hi(foo0)
20; N64: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
21; N64: ld ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
22
David Blaikiea79ac142015-02-27 21:17:42 +000023 %0 = load i32, i32* @v0, align 4
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000024 tail call void @foo0(i32 %0) nounwind
25 ret void
26}
27
28declare void @foo0(i32)
29
30; call to external function.
31
32define void @foo2(i32* nocapture %d, i32* nocapture %s, i32 %n) nounwind {
33entry:
Stephen Lind24ab202013-07-14 06:24:09 +000034; O32-LABEL: foo2:
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000035; O32: lui $[[R2:[0-9]+]], %call_hi(memcpy)
36; O32: addu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
37; O32: lw ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
38
Stephen Lind24ab202013-07-14 06:24:09 +000039; N64-LABEL: foo2:
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000040; N64: lui $[[R2:[0-9]+]], %call_hi(memcpy)
41; N64: daddu $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
42; N64: ld ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
43
44 %0 = bitcast i32* %d to i8*
45 %1 = bitcast i32* %s to i8*
Pete Cooper67cf9a72015-11-19 05:56:52 +000046 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 %n, i32 4, i1 false)
Akira Hatanakabb6e74a2012-11-21 20:40:38 +000047 ret void
48}
49
Pete Cooper67cf9a72015-11-19 05:56:52 +000050declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind