1+ ; RUN: llc < %s -mpatmos-max-subfunction-size=32 | FileCheck %s
2+ ; RUN: llc < %s -mpatmos-max-subfunction-size=32 -filetype=obj -o %t -mforce-block-labels;\
3+ ; RUN: llvm-objdump %t -d -t | FileCheck %s --check-prefix OBJ
4+ ; END.
5+ ;//////////////////////////////////////////////////////////////////////////////////////////////////
6+ ;
7+ ; Tests that assembly and object outputs give subfunction labels the `STT_FUNC` symbol type.
8+ ;
9+ ; Using the "CHECK" filecheck prefix, we ensure assembly output adds the '@function' attribute to subfunctions.
10+ ; Using the "OBJ" filecheck prefix, we ensure that the labels of the subfunctions are local ('l') and functions ('F') in the symbol table.
11+ ;
12+ ;//////////////////////////////////////////////////////////////////////////////////////////////////
13+
14+ ; CHECK: .type main,@function
15+ ; CHECK: main:
16+ ; OBJ: main:
17+ define i32 @main () {
18+ entry:
19+ ; First 24 bytes
20+ %0 = call i32 asm "
21+ .inline_1:
22+ li $0 = 5001 # Long arithmetic, 8 bytes each
23+ add $0 = $0, 5002
24+ add $0 = $0, 5003
25+ " , "=r"
26+ ()
27+
28+ ; CHECK: .type {{.LBB0_[0-9]}},@function
29+ ; OBJ: [[INLINE1:.LBB0_[0-9]]]:
30+ ; Then 12 bytes
31+ %1 = call i32 asm "
32+ .inline_2:
33+ add $0 = $1, 4
34+ add $0 = $0, 5
35+ add $0 = $0, 6
36+ " , "=r, r"
37+ (i32 %0 )
38+
39+ ; CHECK: .type {{.LBB0_[0-9]}},@function
40+ ; OBJ: [[INLINE2:.LBB0_[0-9]]]:
41+ ; Then another 20 bytes
42+ %2 = call i32 asm "
43+ .inline_3:
44+ add $0 = $1, 7
45+ add $0 = $0, 8
46+ add $0 = $0, 9
47+ " , "=r, r"
48+ (i32 %1 )
49+
50+ ; CHECK: .type {{.LBB0_[0-9]}},@function
51+ ; OBJ: [[INLINE3:.LBB0_[0-9]]]:
52+ %3 = sub i32 %2 , 15045
53+ ret i32 %3 ; =0
54+ }
55+
56+ ; The following checks the type of the labels in the symbol table
57+ ; OBJ: l F .text {{([[:xdigit:]]{8})}} [[INLINE1]]
58+ ; OBJ: l F .text {{([[:xdigit:]]{8})}} [[INLINE2]]
59+ ; OBJ: l F .text {{([[:xdigit:]]{8})}} [[INLINE3]]
60+ ; OBJ: g F .text {{([[:xdigit:]]{8})}} main
0 commit comments