1 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \
2 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefix=INSTR %s
3 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c,+relax < %s \
4 # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefix=RELAX-INSTR %s
5 # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c,+relax < %s \
6 # RUN: | llvm-readobj -r - | FileCheck -check-prefix=RELAX-RELOC %s
21 #INSTR: c.bnez a0, 0x91e
22 #RELAX-INSTR: c.bnez a0, 0
23 #RELAX-RELOC: R_RISCV_RVC_BRANCH
24 c.bnez a0
, NEAR_NEGATIVE
25 #INSTR: c.bnez a0, 0x8d4
26 #RELAX-INSTR: c.bnez a0, 0
27 #RELAX-RELOC: R_RISCV_RVC_BRANCH
29 #INSTR-NEXT: bne a0, zero, 0xa20
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, 0x7d2
34 #RELAX-INSTR-NEXT: bne a0, zero, 0
35 #RELAX-RELOC: R_RISCV_BRANCH
37 #INSTR-NEXT: bne a0, zero, 0x11f2
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, 0x0
42 #RELAX-INSTR-NEXT: bne a0, zero, 0
43 #RELAX-RELOC: R_RISCV_BRANCH
46 #INSTR-NEXT: c.beqz a0, 0x91e
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, 0x8d4
51 #RELAX-INSTR-NEXT: c.beqz a0, 0
52 #RELAX-RELOC: R_RISCV_RVC_BRANCH
54 #INSTR-NEXT: beq a0, zero, 0xa20
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, 0x7d2
59 #RELAX-INSTR-NEXT: beq a0, zero, 0
60 #RELAX-RELOC: R_RISCV_BRANCH
62 #INSTR-NEXT: beq a0, zero, 0x11f2
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, 0x0
67 #RELAX-INSTR-NEXT: beq a0, zero, 0
68 #RELAX-RELOC: R_RISCV_BRANCH
71 #INSTR-NEXT: c.j 0x91e
72 #RELAX-INSTR-NEXT: c.j 0
73 #RELAX-RELOC: R_RISCV_RVC_JUMP
75 #INSTR-NEXT: c.j 0x8d4
76 #RELAX-INSTR-NEXT: c.j 0
77 #RELAX-RELOC: R_RISCV_RVC_JUMP
79 #INSTR-NEXT: c.j 0xa20
80 #RELAX-INSTR-NEXT: c.j 0
81 #RELAX-RELOC: R_RISCV_RVC_JUMP
82 c.j FAR_BRANCH_NEGATIVE
83 #INSTR-NEXT: c.j 0x7d2
84 #RELAX-INSTR-NEXT: c.j 0
85 #RELAX-RELOC: R_RISCV_RVC_JUMP
87 #INSTR-NEXT: jal zero, 0x11f2
88 #RELAX-INSTR-NEXT: jal zero, 0
89 #RELAX-RELOC: R_RISCV_JAL
91 #INSTR-NEXT: jal zero, 0x0
92 #RELAX-INSTR-NEXT: jal zero, 0
93 #RELAX-RELOC: R_RISCV_JAL
98 #RELAX-RELOC: R_RISCV_RVC_JUMP
101 #RELAX-INSTR: c.jal 0
102 #RELAX-RELOC: R_RISCV_RVC_JUMP
104 #INSTR-NEXT: c.jal 0xa20
105 #RELAX-INSTR-NEXT: c.jal 0
106 #RELAX-RELOC: R_RISCV_RVC_JUMP
107 c.jal FAR_BRANCH_NEGATIVE
108 #INSTR-NEXT: c.jal 0x7d2
109 #RELAX-INSTR-NEXT: c.jal 0
110 #RELAX-RELOC: R_RISCV_RVC_JUMP
112 #INSTR-NEXT: jal ra, 0x11f2
113 #RELAX-INSTR-NEXT: jal ra, 0
114 #RELAX-RELOC: R_RISCV_JAL
115 c.jal FAR_JUMP_NEGATIVE
116 #INSTR-NEXT: jal ra, 0x0
117 #RELAX-INSTR-NEXT: jal ra, 0
118 #RELAX-RELOC: R_RISCV_JAL