[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / bolt / test / AArch64 / compact-code-model.s
blob0805302a885981a39dc34e68e6dbb00605c85cf1
1 ## Check that llvm-bolt successfully relaxes branches for compact (<128MB) code
2 ## model.
4 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
5 # RUN: link_fdata %s %t.o %t.fdata
6 # RUN: llvm-strip --strip-unneeded %t.o
7 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static
8 # RUN: llvm-bolt %t.exe -o %t.bolt --data %t.fdata --split-functions \
9 # RUN: --keep-nops --compact-code-model
10 # RUN: llvm-objdump -d \
11 # RUN: --disassemble-symbols=_start,_start.cold.0,foo,foo.cold.0 %t.bolt \
12 # RUN: | FileCheck %s
13 # RUN: llvm-nm -nS %t.bolt | FileCheck %s --check-prefix=CHECK-NM
15 ## Fragments of _start and foo will be separated by large_function which is over
16 ## 1MB in size - larger than all conditional branches can cover requiring branch
17 ## relaxation.
19 # CHECK-NM: _start
20 # CHECK-NM: foo
21 # CHECK-NM: 0000000000124f84 T large_function
22 # CHECK-NM: _start.cold.0
23 # CHECK-NM: foo.cold.0
25 .text
26 .globl _start
27 .type _start, %function
28 _start:
29 # CHECK: <_start>:
30 # FDATA: 0 [unknown] 0 1 _start 0 0 100
31 .cfi_startproc
32 cmp x0, 1
33 b.eq .L0
34 # CHECK: b.eq
35 # CHECK-NEXT: b
36 # CHECK-NEXT: b
38 bl large_function
39 .L0:
40 ret x30
41 .cfi_endproc
42 .size _start, .-_start
44 ## Check that long branch in foo() is reused during relaxation. I.e. we should
45 ## see just one branch to the cold fragment.
47 .globl foo
48 .type foo, %function
49 foo:
50 # CHECK: <foo>:
51 # FDATA: 0 [unknown] 0 1 foo 0 0 100
52 .cfi_startproc
53 cmp x0, 0
54 .T0:
55 b.eq .ERROR
56 # CHECK: b {{.*}} <foo.cold.0>
57 # CHECK-NOT: b {{.*}} <foo.cold.0>
58 # FDATA: 1 foo #.T0# 1 foo #.T1# 0 100
59 .T1:
60 bl large_function
61 cmp x0, 1
62 .T2:
63 b.eq .ERROR
64 # FDATA: 1 foo #.T2# 1 foo #.T3# 0 100
65 .T3:
66 mov x1, x0
67 mov x0, 0
68 ret x30
70 # CHECK: <foo.cold.0>:
71 # CHECK-NEXT: mov x0, #0x1
72 # CHECK-NEXT: ret
73 .ERROR:
74 mov x0, 1
75 ret x30
76 .cfi_endproc
77 .size foo, .-foo
79 .globl large_function
80 .type large_function, %function
81 large_function:
82 # FDATA: 0 [unknown] 0 1 large_function 0 0 100
83 .cfi_startproc
84 .rept 300000
85 nop
86 .endr
87 ret x30
88 .cfi_endproc
89 .size large_function, .-large_function
91 ## Force relocation mode.
92 .reloc 0, R_AARCH64_NONE