[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / calculate-emitted-block-size.s
blobb1d05b83cb87c74d8794066504331e47899452d0
1 # Test BinaryContext::calculateEmittedSize's functionality to update
2 # BinaryBasicBlock::OutputAddressRange in place so that the emitted size
3 # of each basic block is given by BinaryBasicBlock::getOutputSize()
5 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
6 # RUN: link_fdata %s %t.o %t.fdata
7 # RUN: llvm-strip --strip-unneeded %t.o
8 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
9 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=all \
10 # RUN: --print-split --print-only=chain --print-output-address-range \
11 # RUN: --data=%t.fdata --reorder-blocks=ext-tsp \
12 # RUN: 2>&1 | FileCheck --check-prefix=SPLITALL %s
13 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
14 # RUN: link_fdata %s %t.o %t.fdata
15 # RUN: llvm-strip --strip-unneeded %t.o
16 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
17 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --print-split \
18 # RUN: --print-only=chain --print-output-address-range \
19 # RUN: --data=%t.fdata --reorder-blocks=ext-tsp \
20 # RUN: 2>&1 | FileCheck --check-prefix=SPLITHOTCOLD %s
22 # SPLITALL: {{^\.LBB00}}
23 # SPLITALL: Output Address Range: [0x0, 0x12) (18 bytes)
24 # SPLITALL: {{^\.LFT0}}
25 # SPLITALL: Output Address Range: [0x0, 0xa) (10 bytes)
26 # SPLITALL: {{^\.Ltmp1}}
27 # SPLITALL: Output Address Range: [0x0, 0x2) (2 bytes)
28 # SPLITALL: {{^\.Ltmp0}}
29 # SPLITALL: Output Address Range: [0x0, 0x10) (16 bytes)
30 # SPLITALL: {{^\.Ltmp2}}
31 # SPLITALL: Output Address Range: [0x0, 0x8) (8 bytes)
32 # SPLITALL: {{^\.LFT1}}
33 # SPLITALL: Output Address Range: [0x0, 0x8) (8 bytes)
35 # SPLITHOTCOLD: {{^\.LBB00}}
36 # SPLITHOTCOLD: Output Address Range: [0x0, 0x9) (9 bytes)
37 # SPLITHOTCOLD: {{^\.LFT0}}
38 # SPLITHOTCOLD: Output Address Range: [0x9, 0xe) (5 bytes)
39 # SPLITHOTCOLD: {{^\.Ltmp1}}
40 # SPLITHOTCOLD: Output Address Range: [0xe, 0x10) (2 bytes)
41 # SPLITHOTCOLD: {{^\.Ltmp0}}
42 # SPLITHOTCOLD: Output Address Range: [0x10, 0x1b) (11 bytes)
43 # SPLITHOTCOLD: {{^\.Ltmp2}}
44 # SPLITHOTCOLD: Output Address Range: [0x1b, 0x20) (5 bytes)
45 # SPLITHOTCOLD: {{^\.LFT1}}
46 # SPLITHOTCOLD: Output Address Range: [0x0, 0x8) (8 bytes)
48 .text
49 .globl chain
50 .type chain, @function
51 chain:
52 pushq %rbp
53 movq %rsp, %rbp
54 cmpl $2, %edi
55 LLentry_LLchain_start:
56 jge LLchain_start
57 # FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 10
58 # FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 500
59 LLfast:
60 movl $5, %eax
61 LLfast_LLexit:
62 jmp LLexit
63 # FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 500
64 LLchain_start:
65 movl $10, %eax
66 LLchain_start_LLchain1:
67 jge LLchain1
68 # FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 10
69 # FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 0
70 LLcold:
71 addl $1, %eax
72 LLchain1:
73 addl $1, %eax
74 LLchain1_LLexit:
75 jmp LLexit
76 # FDATA: 1 chain #LLchain1_LLexit# 1 chain #LLexit# 0 10
77 LLexit:
78 popq %rbp
79 ret
80 LLchain_end:
81 .size chain, LLchain_end-chain
84 .globl main
85 .type main, @function
86 main:
87 pushq %rbp
88 movq %rsp, %rbp
89 movl $1, %edi
90 LLmain_chain1:
91 call chain
92 # FDATA: 1 main #LLmain_chain1# 1 chain 0 0 500
93 movl $4, %edi
94 LLmain_chain2:
95 call chain
96 # FDATA: 1 main #LLmain_chain2# 1 chain 0 0 10
97 xorl %eax, %eax
98 popq %rbp
99 retq
100 .Lmain_end:
101 .size main, .Lmain_end-main