[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / llvm / test / MC / RISCV / rv32-relaxation.s
blob1a5da352aa2bbc3a224c6e72aee08b7351239d02
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
8 FAR_JUMP_NEGATIVE:
9 c.nop
10 .space 2000
12 FAR_BRANCH_NEGATIVE:
13 c.nop
14 .space 256
16 NEAR_NEGATIVE:
17 c.nop
19 start:
20 c.bnez a0, NEAR
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
28 c.bnez a0, FAR_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
36 c.bnez a0, FAR_JUMP
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
45 c.beqz a0, NEAR
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
53 c.beqz a0, FAR_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
61 c.beqz a0, FAR_JUMP
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
70 c.j NEAR
71 #INSTR-NEXT: c.j 0x91e
72 #RELAX-INSTR-NEXT: c.j 0
73 #RELAX-RELOC: R_RISCV_RVC_JUMP
74 c.j NEAR_NEGATIVE
75 #INSTR-NEXT: c.j 0x8d4
76 #RELAX-INSTR-NEXT: c.j 0
77 #RELAX-RELOC: R_RISCV_RVC_JUMP
78 c.j FAR_BRANCH
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
86 c.j FAR_JUMP
87 #INSTR-NEXT: jal zero, 0x11f2
88 #RELAX-INSTR-NEXT: jal zero, 0
89 #RELAX-RELOC: R_RISCV_JAL
90 c.j FAR_JUMP_NEGATIVE
91 #INSTR-NEXT: jal zero, 0x0
92 #RELAX-INSTR-NEXT: jal zero, 0
93 #RELAX-RELOC: R_RISCV_JAL
95 c.jal NEAR
96 #INSTR: c.jal 0x91e
97 #RELAX-INSTR: c.jal 0
98 #RELAX-RELOC: R_RISCV_RVC_JUMP
99 c.jal NEAR_NEGATIVE
100 #INSTR: c.jal 0x8d4
101 #RELAX-INSTR: c.jal 0
102 #RELAX-RELOC: R_RISCV_RVC_JUMP
103 c.jal FAR_BRANCH
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
111 c.jal FAR_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
120 NEAR:
121 c.nop
122 .space 256
123 FAR_BRANCH:
124 c.nop
125 .space 2000
126 FAR_JUMP:
127 c.nop