1# REQUIRES: mips
2# Check various cases of microMIPS - regular code cross-calls.
3
4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
5# RUN:         -mattr=micromips %s -o %t-eb.o
6# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
7# RUN:         -position-independent -mattr=micromips \
8# RUN:         %S/Inputs/mips-micro.s -o %t-eb-pic.o
9# RUN: ld.lld -o %t-eb.exe %t-eb.o %t-eb-pic.o
10# RUN: llvm-objdump -d -t --mattr=-micromips \
11# RUN:              --no-show-raw-insn --print-imm-hex %t-eb.exe \
12# RUN:   | FileCheck --check-prefixes=SYM,REG %s
13# RUN: llvm-objdump -d -t --mattr=+micromips \
14# RUN:              --no-show-raw-insn --print-imm-hex %t-eb.exe \
15# RUN:   | FileCheck --check-prefixes=SYM,MICRO %s
16
17# REG:  {{0*}}[[FOOT:[0-9a-f]+]]   l     F .text  0000000e 0x80 __microLA25Thunk_foo
18# REG:  {{0*}}[[BAR:[0-9a-f]+]]    g     F .text  00000000 bar
19# REG:  {{0*}}[[MIC:[0-9a-f]+]]    g       .text  00000000 0x80 micro
20
21# REG:        <__start>:
22# REG-NEXT:      jalx 0x[[MIC]] <micro>
23# REG-NEXT:      nop
24# REG-NEXT:      jalx 0x[[FOOT]] <__microLA25Thunk_foo>
25
26# REG:        <__LA25Thunk_bar>:
27# REG-NEXT:      lui  $25, 0x2
28# REG-NEXT:      j    0x[[BAR]] <bar>
29
30# MICRO: {{0*}}[[BART:[0-9a-f]+]]  l     F .text  00000010 __LA25Thunk_bar
31# MICRO: {{0*}}[[START:[0-9a-f]+]] g       .text  00000000 __start
32# MICRO: {{0*}}[[FOO:[0-9a-f]+]]   g     F .text  00000000 0x80 foo
33
34# MICRO:      <micro>:
35# MICRO-NEXT:    jalx 0x[[START]]
36# MICRO-NEXT:    nop
37# MICRO-NEXT:    jalx 0x[[BART]]
38
39# MICRO:      <__microLA25Thunk_foo>:
40# MICRO-NEXT:    lui  $25, 0x2
41# MICRO-NEXT:    j    0x[[FOO]] <foo>
42
43  .text
44  .set nomicromips
45  .global __start
46__start:
47  jal micro
48  jal foo
49
50  .set micromips
51  .global micro
52micro:
53  jal __start
54  jal bar
55