1# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
2# RUN:   | llvm-objdump -d - | FileCheck --check-prefix=INSTR %s
3# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
4# RUN:   | llvm-readobj -r - | FileCheck -check-prefix=RELOC %s
5# RUN: llvm-mc -triple riscv32 < %s -show-encoding \
6# RUN:   | FileCheck -check-prefix=FIXUP %s
7
8# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
9# RUN:   | llvm-objdump -d - | FileCheck --check-prefix=INSTR %s
10# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
11# RUN:   | llvm-readobj -r - | FileCheck -check-prefix=RELOC %s
12# RUN: llvm-mc -triple riscv64 < %s -show-encoding \
13# RUN:   | FileCheck -check-prefix=FIXUP %s
14
15.long foo
16
17tail foo
18# RELOC: R_RISCV_CALL foo 0x0
19# INSTR: auipc t1, 0
20# INSTR: jr  t1
21# FIXUP: fixup A - offset: 0, value: foo, kind:
22tail bar
23# RELOC: R_RISCV_CALL bar 0x0
24# INSTR: auipc t1, 0
25# INSTR: jr  t1
26# FIXUP: fixup A - offset: 0, value: bar, kind:
27
28# Ensure that tail calls to functions whose names coincide with register names
29# work.
30
31tail zero
32# RELOC: R_RISCV_CALL zero 0x0
33# INSTR: auipc t1, 0
34# INSTR: jr  t1
35# FIXUP: fixup A - offset: 0, value: zero, kind:
36
37tail f1
38# RELOC: R_RISCV_CALL f1 0x0
39# INSTR: auipc t1, 0
40# INSTR: jr  t1
41# FIXUP: fixup A - offset: 0, value: f1, kind:
42
43tail ra
44# RELOC: R_RISCV_CALL ra 0x0
45# INSTR: auipc t1, 0
46# INSTR: jr  t1
47# FIXUP: fixup A - offset: 0, value: ra, kind:
48
49tail foo@plt
50# RELOC: R_RISCV_CALL_PLT foo 0x0
51# INSTR: auipc t1, 0
52# INSTR: jr  t1
53# FIXUP: fixup A - offset: 0, value: foo@plt, kind:
54