[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / cdsplit-call-scale.s
blob5701d9e6dfd6965abcdcae3696eccf1c019e4164
1 # Test the control of aggressiveness of 3-way splitting by -call-scale.
2 # When -call-scale=0.0, the tested function is 2-way splitted.
3 # When -call-scale=1.0, the tested function is 3-way splitted with 5 blocks
4 # in warm because of the increased benefit of shortening the call edges.
5 # When -call-scale=1000.0, the tested function is still 3-way splitted with
6 # 5 blocks in warm because cdsplit does not allow hot-warm splitting to break
7 # a fall through branch from a basic block to its most likely successor.
9 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
10 # RUN: link_fdata %s %t.o %t.fdata
11 # RUN: llvm-strip --strip-unneeded %t.o
12 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
13 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \
14 # RUN: --call-scale=0.0 --print-split --print-only=chain \
15 # RUN: --data=%t.fdata --reorder-blocks=ext-tsp \
16 # RUN: 2>&1 | FileCheck --check-prefix=LOWINCENTIVE %s
17 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \
18 # RUN: --call-scale=1.0 --print-split --print-only=chain \
19 # RUN: --data=%t.fdata --reorder-blocks=ext-tsp \
20 # RUN: 2>&1 | FileCheck --check-prefix=MEDINCENTIVE %s
21 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \
22 # RUN: --call-scale=1000.0 --print-split --print-only=chain \
23 # RUN: --data=%t.fdata --reorder-blocks=ext-tsp \
24 # RUN: 2>&1 | FileCheck --check-prefix=HIGHINCENTIVE %s
26 # LOWINCENTIVE: Binary Function "chain" after split-functions
27 # LOWINCENTIVE: {{^\.Ltmp5}}
28 # LOWINCENTIVE: ------- HOT-COLD SPLIT POINT -------
29 # LOWINCENTIVE: {{^\.LFT1}}
31 # MEDINCENTIVE: Binary Function "chain" after split-functions
32 # MEDINCENTIVE: {{^\.Ltmp1}}
33 # MEDINCENTIVE: ------- HOT-COLD SPLIT POINT -------
34 # MEDINCENTIVE: {{^\.LFT1}}
35 # MEDINCENTIVE: ------- HOT-COLD SPLIT POINT -------
36 # MEDINCENTIVE: {{^\.Ltmp0}}
37 # MEDINCENTIVE: {{^\.Ltmp2}}
38 # MEDINCENTIVE: {{^\.Ltmp3}}
39 # MEDINCENTIVE: {{^\.Ltmp4}}
40 # MEDINCENTIVE: {{^\.Ltmp5}}
42 # HIGHINCENTIVE: Binary Function "chain" after split-functions
43 # HIGHINCENTIVE: {{^\.Ltmp1}}
44 # HIGHINCENTIVE: ------- HOT-COLD SPLIT POINT -------
45 # HIGHINCENTIVE: {{^\.LFT1}}
46 # HIGHINCENTIVE: ------- HOT-COLD SPLIT POINT -------
47 # HIGHINCENTIVE: {{^\.Ltmp0}}
48 # HIGHINCENTIVE: {{^\.Ltmp2}}
49 # HIGHINCENTIVE: {{^\.Ltmp3}}
50 # HIGHINCENTIVE: {{^\.Ltmp4}}
51 # HIGHINCENTIVE: {{^\.Ltmp5}}
55 .text
56 .globl chain
57 .type chain, @function
58 chain:
59 pushq %rbp
60 movq %rsp, %rbp
61 cmpl $2, %edi
62 LLentry_LLchain_start:
63 jge LLchain_start
64 # FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 10
65 # FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 500
66 LLfast:
67 movl $5, %eax
68 LLfast_LLexit:
69 jmp LLexit
70 # FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 500
71 LLchain_start:
72 movl $10, %eax
73 LLchain_start_LLchain1:
74 jge LLchain1
75 # FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 10
76 # FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 0
77 LLcold:
78 addl $1, %eax
79 addl $1, %eax
80 addl $1, %eax
81 addl $1, %eax
82 addl $1, %eax
83 addl $1, %eax
84 LLchain1:
85 addl $1, %eax
86 LLchain1_LLchain2:
87 jmp LLchain2
88 # FDATA: 1 chain #LLchain1_LLchain2# 1 chain #LLchain2# 0 10
89 LLchain2:
90 addl $1, %eax
91 LLchain2_LLchain3:
92 jmp LLchain3
93 # FDATA: 1 chain #LLchain2_LLchain3# 1 chain #LLchain3# 0 10
94 LLchain3:
95 addl $1, %eax
96 addl $1, %eax
97 addl $1, %eax
98 addl $1, %eax
99 addl $1, %eax
100 LLchain3_LLchain4:
101 jmp LLchain4
102 # FDATA: 1 chain #LLchain3_LLchain4# 1 chain #LLchain4# 0 10
103 LLchain4:
104 addl $1, %eax
105 addl $1, %eax
106 addl $1, %eax
107 addl $1, %eax
108 addl $1, %eax
109 LLchain4_LLexit:
110 jmp LLexit
111 # FDATA: 1 chain #LLchain4_LLexit# 1 chain #LLexit# 0 10
112 LLexit:
113 popq %rbp
115 LLchain_end:
116 .size chain, LLchain_end-chain
119 .globl main
120 .type main, @function
121 main:
122 pushq %rbp
123 movq %rsp, %rbp
124 movl $1, %edi
125 LLmain_chain1:
126 call chain
127 # FDATA: 1 main #LLmain_chain1# 1 chain 0 0 500
128 movl $4, %edi
129 LLmain_chain2:
130 call chain
131 # FDATA: 1 main #LLmain_chain2# 1 chain 0 0 10
132 xorl %eax, %eax
133 popq %rbp
134 retq
135 .Lmain_end:
136 .size main, .Lmain_end-main