xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/helloworld.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=C1
2*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=C2
3*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=PE
4*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=static -O3 < %s | FileCheck %s -check-prefix=ST1
5*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=static -O3 < %s | FileCheck %s -check-prefix=ST2
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=SR
8*9880d681SAndroid Build Coastguard Worker; RUN: llc  -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips32  -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=SR32
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker@.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00", align 1
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0))
16*9880d681SAndroid Build Coastguard Worker  ret i32 0
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; SR: 	.set	mips16
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; SR32: .set nomips16
21*9880d681SAndroid Build Coastguard Worker; SR32: .ent main
22*9880d681SAndroid Build Coastguard Worker; SR-NOT:  .set noreorder
23*9880d681SAndroid Build Coastguard Worker; SR-NOT:  .set nomacro
24*9880d681SAndroid Build Coastguard Worker; SR-NOT:  .set noat
25*9880d681SAndroid Build Coastguard Worker; SR32:  .set noreorder
26*9880d681SAndroid Build Coastguard Worker; SR32:  .set nomacro
27*9880d681SAndroid Build Coastguard Worker; SR32:  .set noat
28*9880d681SAndroid Build Coastguard Worker; SR:	save 	$ra, 24 # 16 bit inst
29*9880d681SAndroid Build Coastguard Worker; PE:    .ent main
30*9880d681SAndroid Build Coastguard Worker; PE:	li	$[[T1:[0-9]+]], %hi(_gp_disp)
31*9880d681SAndroid Build Coastguard Worker; PE-NEXT: 	addiu	$[[T2:[0-9]+]], $pc, %lo(_gp_disp)
32*9880d681SAndroid Build Coastguard Worker; PE:	        sll	$[[T3:[0-9]+]], $[[T1]], 16
33*9880d681SAndroid Build Coastguard Worker; C1:	lw	${{[0-9]+}}, %got($.str)(${{[0-9]+}})
34*9880d681SAndroid Build Coastguard Worker; C2:	lw	${{[0-9]+}}, %call16(printf)(${{[0-9]+}})
35*9880d681SAndroid Build Coastguard Worker; C1:	addiu	${{[0-9]+}}, %lo($.str)
36*9880d681SAndroid Build Coastguard Worker; C2:	move	$25, ${{[0-9]+}}
37*9880d681SAndroid Build Coastguard Worker; C1:	move 	$gp, ${{[0-9]+}}
38*9880d681SAndroid Build Coastguard Worker; C1:	jalrc 	${{[0-9]+}}
39*9880d681SAndroid Build Coastguard Worker; SR:	restore $ra,	24 # 16 bit inst
40*9880d681SAndroid Build Coastguard Worker; PE:	li	$2, 0
41*9880d681SAndroid Build Coastguard Worker; PE:	jrc 	$ra
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; ST1:  li	${{[0-9]+}}, %hi($.str)
44*9880d681SAndroid Build Coastguard Worker; ST1:  sll     ${{[0-9]+}}, ${{[0-9]+}}, 16
45*9880d681SAndroid Build Coastguard Worker; ST1:	addiu	${{[0-9]+}}, %lo($.str)
46*9880d681SAndroid Build Coastguard Worker; ST2:  li	${{[0-9]+}}, %hi($.str)
47*9880d681SAndroid Build Coastguard Worker; ST2:  jal     printf
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker;  SR-NOT:  .set at
51*9880d681SAndroid Build Coastguard Worker;  SR-NOT:  .set macro
52*9880d681SAndroid Build Coastguard Worker;  SR-NOT:  .set reorder
53*9880d681SAndroid Build Coastguard Worker;  SR32:  .set at
54*9880d681SAndroid Build Coastguard Worker;  SR32:  .set macro
55*9880d681SAndroid Build Coastguard Worker;  SR32:  .set reorder
56*9880d681SAndroid Build Coastguard Worker; SR:   .end main
57*9880d681SAndroid Build Coastguard Worker; SR32:   .end main
58*9880d681SAndroid Build Coastguard Workerdeclare i32 @printf(i8*, ...)
59