1 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
3 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-32R2,TAILCALL-32R2
5 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
7 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-64R2,TAILCALL-64R2
9 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
10 ; RUN: -O2 -mcpu=mips32r6 -mips-compact-branches=always < %s | \
11 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-32R6,TAILCALL-32R6
13 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
14 ; RUN: -O2 -mcpu=mips64r6 -mips-compact-branches=always < %s | \
15 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-64R6,TAILCALL-64R6
17 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
18 ; RUN: -O2 -mcpu=mips32r6 -mips-compact-branches=never < %s | \
19 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-32R2,TAILCALL-32R2
21 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
22 ; RUN: -O2 -mcpu=mips64r6 -mips-compact-branches=never < %s | \
23 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-64R2,TAILCALL-64R2
25 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
26 ; RUN: -O2 -mattr=+micromips -mcpu=mips32r2 < %s | \
27 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-MM,TAILCALL-MM
29 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
30 ; RUN: -O2 -mattr=+micromips -mcpu=mips32r6 < %s | \
31 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-MM
33 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic \
34 ; RUN: -O0 < %s | FileCheck %s -check-prefixes=ALL,JALR-32R2
36 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic \
37 ; RUN: -O0 < %s | FileCheck %s -check-prefixes=ALL,JALR-64R2
39 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic \
40 ; RUN: -O0 -mcpu=mips32r6 -mips-compact-branches=always < %s | \
41 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-32R6
43 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic \
44 ; RUN: -O0 -mcpu=mips64r6 -mips-compact-branches=always < %s | \
45 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-64R6
47 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic \
48 ; RUN: -O0 -mcpu=mips32r6 -mips-compact-branches=never < %s | \
49 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-32R2
51 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic \
52 ; RUN: -O0 -mcpu=mips64r6 -mips-compact-branches=never < %s | \
53 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-64R2
55 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic \
56 ; RUN: -O0 -mattr=+micromips -mcpu=mips32r2 < %s | \
57 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-MM
59 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic \
60 ; RUN: -O0 -mattr=+micromips -mcpu=mips32r6 < %s | \
61 ; RUN: FileCheck %s -check-prefixes=ALL,JALR-MM
63 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
64 ; RUN: -O2 -mips-jalr-reloc=false < %s | \
65 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
67 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static -mips-tail-calls=1 \
69 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
71 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
72 ; RUN: -O0 -mips-jalr-reloc=false < %s | \
73 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
75 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static -mips-tail-calls=1 \
77 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
79 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic -mips-tail-calls=1 \
80 ; RUN: -O2 -mips-jalr-reloc=false < %s | \
81 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
83 ; RUN: llc -mtriple=mips64-linux-gnu -mips-tail-calls=1 \
84 ; RUN: -O2 -relocation-model=static < %s | \
85 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
87 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=pic \
88 ; RUN: -O0 -mips-jalr-reloc=false < %s | \
89 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
91 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static \
93 ; RUN: FileCheck %s -check-prefixes=ALL,NORELOC
95 define internal void @foo() noinline {
100 define void @checkCall() {
102 ; ALL-LABEL: checkCall:
104 ; JALR-32R2: .reloc ([[TMPLABEL:.*]]), R_MIPS_JALR, foo
105 ; JALR-32R2-NEXT: [[TMPLABEL]]:
106 ; JALR-32R2-NEXT: jalr $25
108 ; JALR-64R2: .reloc [[TMPLABEL:.*]], R_MIPS_JALR, foo
109 ; JALR-64R2-NEXT: [[TMPLABEL]]:
110 ; JALR-64R2-NEXT: jalr $25
112 ; JALR-MM: .reloc ([[TMPLABEL:.*]]), R_MICROMIPS_JALR, foo
113 ; JALR-MM-NEXT: [[TMPLABEL]]:
114 ; JALR-MM-NEXT: jalr $25
116 ; JALR-32R6: .reloc ([[TMPLABEL:.*]]), R_MIPS_JALR, foo
117 ; JALR-32R6-NEXT: [[TMPLABEL]]:
118 ; JALR-32R6-NEXT: jalrc $25
120 ; JALR-64R6: .reloc [[TMPLABEL:.*]], R_MIPS_JALR, foo
121 ; JALR-64R6-NEXT: [[TMPLABEL]]:
122 ; JALR-64R6-NEXT: jalrc $25
124 ; NORELOC-NOT: R_MIPS_JALR
128 define void @checkTailCall() {
130 ; ALL-LABEL: checkTailCall:
131 tail call void @foo()
132 ; TAILCALL-32R2: .reloc ([[TMPLABEL:.*]]), R_MIPS_JALR, foo
133 ; TAILCALL-32R2-NEXT: [[TMPLABEL]]:
134 ; TAILCALL-32R2-NEXT: jr $25
136 ; TAILCALL-64R2: .reloc [[TMPLABEL:.*]], R_MIPS_JALR, foo
137 ; TAILCALL-64R2-NEXT: [[TMPLABEL]]:
138 ; TAILCALL-64R2-NEXT: jr $25
140 ; TAILCALL-MM: .reloc ([[TMPLABEL:.*]]), R_MICROMIPS_JALR, foo
141 ; TAILCALL-MM-NEXT: [[TMPLABEL]]:
142 ; TAILCALL-MM-NEXT: jrc $25
144 ; TAILCALL-32R6: .reloc ([[TMPLABEL:.*]]), R_MIPS_JALR, foo
145 ; TAILCALL-32R6-NEXT: [[TMPLABEL]]:
146 ; TAILCALL-32R6-NEXT: jrc $25
148 ; TAILCALL-64R6: .reloc [[TMPLABEL:.*]], R_MIPS_JALR, foo
149 ; TAILCALL-64R6-NEXT: [[TMPLABEL]]:
150 ; TAILCALL-64R6-NEXT: jrc $25
152 ; NORELOC-NOT: R_MIPS_JALR