1 # RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+c < %s \
2 # RUN: | llvm-objdump -d -riscv-no-aliases - | FileCheck -check-prefix=INSTR %s
3 # RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+c,+relax < %s \
4 # RUN: | llvm-objdump -d -riscv-no-aliases - | FileCheck -check-prefix=RELAX-INSTR %s
5 # RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+c,+relax < %s \
6 # RUN: | llvm-readobj -r | FileCheck -check-prefix=RELAX-RELOC %s
22 #RELAX-INSTR: c.bnez a0, 0
23 #RELAX-RELOC: R_RISCV_RVC_BRANCH
24 c.bnez a0
, NEAR_NEGATIVE
26 #RELAX-INSTR: c.bnez a0, 0
27 #RELAX-RELOC: R_RISCV_RVC_BRANCH
29 #INSTR-NEXT: bne a0, zero, 310
30 #RELAX-INSTR-NEXT: bne a0, zero, 0
31 #RELAX-RELOC: R_RISCV_BRANCH
32 c.bnez a0
, FAR_BRANCH_NEGATIVE
33 #INSTR-NEXT: bne a0, zero, -268
34 #RELAX-INSTR-NEXT: bne a0, zero, 0
35 #RELAX-RELOC: R_RISCV_BRANCH
37 #INSTR-NEXT: bne a0, zero, 2304
38 #RELAX-INSTR-NEXT: bne a0, zero, 0
39 #RELAX-RELOC: R_RISCV_BRANCH
40 c.bnez a0
, FAR_JUMP_NEGATIVE
41 #INSTR-NEXT: bne a0, zero, -2278
42 #RELAX-INSTR-NEXT: bne a0, zero, 0
43 #RELAX-RELOC: R_RISCV_BRANCH
46 #INSTR-NEXT: c.beqz a0, 36
47 #RELAX-INSTR-NEXT: c.beqz a0, 0
48 #RELAX-RELOC: R_RISCV_RVC_BRANCH
49 c.beqz a0
, NEAR_NEGATIVE
50 #INSTR-NEXT: c.beqz a0, -24
51 #RELAX-INSTR-NEXT: c.beqz a0, 0
52 #RELAX-RELOC: R_RISCV_RVC_BRANCH
54 #INSTR-NEXT: beq a0, zero, 290
55 #RELAX-INSTR-NEXT: beq a0, zero, 0
56 #RELAX-RELOC: R_RISCV_BRANCH
57 c.beqz a0
, FAR_BRANCH_NEGATIVE
58 #INSTR-NEXT: beq a0, zero, -288
59 #RELAX-INSTR-NEXT: beq a0, zero, 0
60 #RELAX-RELOC: R_RISCV_BRANCH
62 #INSTR-NEXT: beq a0, zero, 2284
63 #RELAX-INSTR-NEXT: beq a0, zero, 0
64 #RELAX-RELOC: R_RISCV_BRANCH
65 c.beqz a0
, FAR_JUMP_NEGATIVE
66 #INSTR-NEXT: beq a0, zero, -2298
67 #RELAX-INSTR-NEXT: beq a0, zero, 0
68 #RELAX-RELOC: R_RISCV_BRANCH
72 #RELAX-INSTR-NEXT: c.j 0
73 #RELAX-RELOC: R_RISCV_RVC_JUMP
76 #RELAX-INSTR-NEXT: c.j 0
77 #RELAX-RELOC: R_RISCV_RVC_JUMP
80 #RELAX-INSTR-NEXT: c.j 0
81 #RELAX-RELOC: R_RISCV_RVC_JUMP
82 c.j FAR_BRANCH_NEGATIVE
84 #RELAX-INSTR-NEXT: c.j 0
85 #RELAX-RELOC: R_RISCV_RVC_JUMP
87 #INSTR-NEXT: jal zero, 2268
88 #RELAX-INSTR-NEXT: jal zero, 0
89 #RELAX-RELOC: R_RISCV_JAL
91 #INSTR-NEXT: jal zero, -2314
92 #RELAX-INSTR-NEXT: jal zero, 0
93 #RELAX-RELOC: R_RISCV_JAL