1// RUN: llvm-mc -filetype=obj -triple=mips64el-pc-linux -mcpu=mips64 %s -o - \
2// RUN: | llvm-readobj -r \
3// RUN: | FileCheck %s
4// RUN: llvm-mc -filetype=obj -triple=mips64-pc-linux -mcpu=mips64 %s -o - \
5// RUN: | llvm-readobj -r \
6// RUN: | FileCheck %s
7
8// Check that the appropriate relocations were created.
9
10// R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
11// CHECK:      Relocations [
12// CHECK:        Section ({{[a-z0-9]+}}) .rela.rodata {
13// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
14// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
15// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
16// CHECK-NEXT:     0x{{[0-9,A-F]+}} R_MIPS_GPREL32/R_MIPS_64/R_MIPS_NONE
17// CHECK-NEXT:   }
18// CHECK-NEXT: ]
19
20	.text
21	.abicalls
22	.section	.mdebug.abi64,"",@progbits
23	.file	"/home/espindola/llvm/llvm/test/MC/Mips/elf-gprel-32-64.ll"
24	.text
25	.globl	test
26	.align	3
27	.type	test,@function
28	.set	nomips16
29	.ent	test
30test:                                   # @test
31	.frame	$sp,0,$ra
32	.mask 	0x00000000,0
33	.fmask	0x00000000,0
34	.set	noreorder
35	.set	nomacro
36	.set	noat
37# BB#0:                                 # %entry
38	lui	$1, %hi(%neg(%gp_rel(test)))
39	daddu	$2, $1, $25
40	sltiu	$1, $4, 4
41	dsll	$3, $4, 32
42	bnez	$1, $BB0_2
43	nop
44$BB0_1:                                 # %sw.default
45	b	$BB0_3
46	addiu	$2, $zero, -1
47$BB0_2:                                 # %entry
48	daddiu	$1, $2, %lo(%neg(%gp_rel(test)))
49	dsrl	$3, $3, 32
50	daddiu	$4, $zero, 8
51	dmult	$3, $4
52	mflo	$3
53	ld	$4, %got_page($JTI0_0)($1)
54	daddu	$3, $3, $4
55	ld	$3, %got_ofst($JTI0_0)($3)
56	daddu	$1, $3, $1
57	jr	$1
58	addiu	$2, $zero, 1
59$BB0_3:                                 # %return
60	jr	$ra
61	nop
62$BB0_4:                                 # %sw.bb2
63	jr	$ra
64	addiu	$2, $zero, 3
65$BB0_5:                                 # %sw.bb5
66	jr	$ra
67	addiu	$2, $zero, 2
68$BB0_6:                                 # %sw.bb8
69	jr	$ra
70	addiu	$2, $zero, 7
71	.set	at
72	.set	macro
73	.set	reorder
74	.end	test
75$tmp0:
76	.size	test, ($tmp0)-test
77	.section	.rodata,"a",@progbits
78	.align	3
79$JTI0_0:
80	.gpdword	($BB0_3)
81	.gpdword	($BB0_4)
82	.gpdword	($BB0_5)
83	.gpdword	($BB0_6)
84
85
86	.text
87