File: long-jump-disable-relax.s

package info (click to toggle)
llvm-toolchain-18 1%3A18.1.8-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,908,340 kB
  • sloc: cpp: 6,667,937; ansic: 1,440,452; asm: 883,619; python: 230,549; objc: 76,880; f90: 74,238; lisp: 35,989; pascal: 16,571; sh: 10,229; perl: 7,459; ml: 5,047; awk: 3,523; makefile: 2,987; javascript: 2,149; xml: 892; fortran: 649; cs: 573
file content (47 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Test that long branches are not relaxed with -riscv-asm-relax-branches=0
# RUN: split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c \
# RUN:       -riscv-asm-relax-branches=0 %t/pass.s \
# RUN:     | llvm-objdump -dr -M no-aliases - \
# RUN:     | FileCheck %t/pass.s
# RUN: not llvm-mc -filetype=obj -triple=riscv64 -mattr=+c -o /dev/null \
# RUN:       -riscv-asm-relax-branches=0 %t/fail.s 2>&1 \
# RUN:     | FileCheck %t/fail.s

#--- pass.s
  .text
test_undefined:
## Branches to undefined symbols should not be relaxed
# CHECK:      bne a0, a1, {{.*}}
# CHECK-NEXT: R_RISCV_BRANCH foo
   bne a0, a1, foo
# CHECK:      c.beqz a0, {{.*}}
# CHECK-NEXT: R_RISCV_RVC_BRANCH foo
   c.beqz a0, foo
# CHECK:      c.j {{.*}}
# CHECK-NEXT: R_RISCV_RVC_JUMP foo
   c.j foo

## Branches to defined in-range symbols should work normally
test_defined_in_range:
# CHECK:      bne a0, a1, {{.*}} <bar>
  bne a0, a1, bar
# CHECK:      c.beqz a0, {{.*}} <bar>
   c.beqz a0, bar
# CHECK:      c.j {{.*}} <bar>
   c.j bar
bar:

#--- fail.s
  .text
## Branches to defined out-of-range symbols should report an error
test_defined_out_of_range:
  bne a0, a1, 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
  .skip (1 << 12)
1:
  c.beqz a0, 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
  .skip (1 << 8)
1:
  c.j 1f # CHECK: :[[#@LINE]]:3: error: fixup value out of range
  .skip (1 << 11)
1: