xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/biggot.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mipsel -mxgot -relocation-model=pic < %s | FileCheck %s -check-prefix=O32
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mips64el -mcpu=mips64r2 -mattr=+n64 -mxgot -relocation-model=pic < %s | \
3*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=N64
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@v0 = external global i32
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @foo1() nounwind {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker; O32: lui $[[R0:[0-9]+]], %got_hi(v0)
10*9880d681SAndroid Build Coastguard Worker; O32: addu  $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
11*9880d681SAndroid Build Coastguard Worker; O32: lw  ${{[0-9]+}}, %got_lo(v0)($[[R1]])
12*9880d681SAndroid Build Coastguard Worker; O32: lui $[[R2:[0-9]+]], %call_hi(foo0)
13*9880d681SAndroid Build Coastguard Worker; O32: addu  $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
14*9880d681SAndroid Build Coastguard Worker; O32: lw  ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; N64: lui $[[R0:[0-9]+]], %got_hi(v0)
17*9880d681SAndroid Build Coastguard Worker; N64: daddu  $[[R1:[0-9]+]], $[[R0]], ${{[a-z0-9]+}}
18*9880d681SAndroid Build Coastguard Worker; N64: ld  ${{[0-9]+}}, %got_lo(v0)($[[R1]])
19*9880d681SAndroid Build Coastguard Worker; N64: lui $[[R2:[0-9]+]], %call_hi(foo0)
20*9880d681SAndroid Build Coastguard Worker; N64: daddu  $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
21*9880d681SAndroid Build Coastguard Worker; N64: ld  ${{[0-9]+}}, %call_lo(foo0)($[[R3]])
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* @v0, align 4
24*9880d681SAndroid Build Coastguard Worker  tail call void @foo0(i32 %0) nounwind
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdeclare void @foo0(i32)
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; call to external function.
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdefine void @foo2(i32* nocapture %d, i32* nocapture %s, i32 %n) nounwind {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker; O32-LABEL: foo2:
35*9880d681SAndroid Build Coastguard Worker; O32: lui $[[R2:[0-9]+]], %call_hi(memcpy)
36*9880d681SAndroid Build Coastguard Worker; O32: addu  $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
37*9880d681SAndroid Build Coastguard Worker; O32: lw  ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; N64-LABEL: foo2:
40*9880d681SAndroid Build Coastguard Worker; N64: lui $[[R2:[0-9]+]], %call_hi(memcpy)
41*9880d681SAndroid Build Coastguard Worker; N64: daddu  $[[R3:[0-9]+]], $[[R2]], ${{[a-z0-9]+}}
42*9880d681SAndroid Build Coastguard Worker; N64: ld  ${{[0-9]+}}, %call_lo(memcpy)($[[R3]])
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker  %0 = bitcast i32* %d to i8*
45*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i32* %s to i8*
46*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* %1, i32 %n, i32 4, i1 false)
47*9880d681SAndroid Build Coastguard Worker  ret void
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
51