xref: /llvm-project/bolt/test/RISCV/reloc-bb-split.s (revision ab14eb23b6b4939cefa01f8cb16d7540f9686144)
1// RUN: %clang %cflags -o %t %s
2// RUN: llvm-bolt --print-cfg --print-only=_start -o %t.null %t \
3// RUN:    | FileCheck %s
4
5  .data
6  .globl d
7  .p2align 3
8d:
9  .dword 0
10
11  .text
12  .globl _start
13  .p2align 1
14// CHECK-LABEL: Binary Function "_start" after building cfg {
15_start:
16/// The local label is used for %pcrel_lo as well as a jump target so a new
17/// basic block should start there.
18// CHECK-LABEL: {{^}}.LBB00
19// CHECK: nop
20// CHECK-LABEL: {{^}}.Ltmp0
21// CHECK: auipc t0, %pcrel_hi(d) # Label: .Ltmp1
22// CHECK-NEXT: ld t0, %pcrel_lo(.Ltmp1)(t0)
23// CHECK-NEXT: j .Ltmp0
24  nop
251:
26  auipc t0, %pcrel_hi(d)
27  ld t0, %pcrel_lo(1b)(t0)
28  j 1b
29
30/// The local label is used only for %pcrel_lo so no new basic block should
31/// start there.
32// CHECK-LABEL: {{^}}.LFT0
33// CHECK: nop
34// CHECK-NEXT: auipc t0, %pcrel_hi(d) # Label: .Ltmp2
35// CHECK-NEXT: ld t0, %pcrel_lo(.Ltmp2)(t0)
36// CHECK-NEXT: ret
37  nop
381:
39  auipc t0, %pcrel_hi(d)
40  ld t0, %pcrel_lo(1b)(t0)
41  ret
42  .size _start, .-_start
43