1; RUN: llc -mtriple=i386 %s -o - | FileCheck --check-prefixes=CHECK,NOFSECT,32 %s
2; RUN: llc -mtriple=x86_64 %s -o - | FileCheck --check-prefixes=CHECK,NOFSECT,64 %s
3; RUN: llc -mtriple=x86_64 -function-sections %s -o - | FileCheck --check-prefixes=CHECK,FSECT,64 %s
4
5define void @f0() "patchable-function-entry"="0" {
6; CHECK-LABEL: f0:
7; CHECK-NEXT: .Lfunc_begin0:
8; CHECK-NOT:   nop
9; CHECK:       ret
10; CHECK-NOT:   .section __patchable_function_entries
11  ret void
12}
13
14define void @f1() "patchable-function-entry"="1" {
15; CHECK-LABEL: f1:
16; CHECK-NEXT: .Lfunc_begin1:
17; CHECK:       nop
18; CHECK-NEXT:  ret
19; CHECK:       .section __patchable_function_entries,"awo",@progbits,f1,unique,0
20; 32:          .p2align 2
21; 32-NEXT:     .long .Lfunc_begin1
22; 64:          .p2align 3
23; 64-NEXT:     .quad .Lfunc_begin1
24  ret void
25}
26
27define void @f2() "patchable-function-entry"="2" {
28; CHECK-LABEL: f2:
29; 32-COUNT-2:  nop
30; 64:          xchgw %ax, %ax
31; CHECK-NEXT:  ret
32; NOFSECT:     .section __patchable_function_entries,"awo",@progbits,f1,unique,0
33; FSECT:       .section __patchable_function_entries,"awo",@progbits,f2,unique,1
34; 32:          .p2align 2
35; 32-NEXT:     .long .Lfunc_begin2
36; 64:          .p2align 3
37; 64-NEXT:     .quad .Lfunc_begin2
38  ret void
39}
40
41$f3 = comdat any
42define void @f3() "patchable-function-entry"="3" comdat {
43; CHECK-LABEL: f3:
44; 32-COUNT-3:  nop
45; 64:          nopl (%rax)
46; CHECK:       ret
47; NOFSECT:     .section __patchable_function_entries,"aGwo",@progbits,f3,comdat,f3,unique,1
48; FSECT:       .section __patchable_function_entries,"aGwo",@progbits,f3,comdat,f3,unique,2
49; 32:          .p2align 2
50; 32-NEXT:     .long .Lfunc_begin3
51; 64:          .p2align 3
52; 64-NEXT:     .quad .Lfunc_begin3
53  ret void
54}
55
56$f5 = comdat any
57define void @f5() "patchable-function-entry"="5" comdat {
58; CHECK-LABEL: f5:
59; 32-COUNT-5:  nop
60; 64:          nopl 8(%rax,%rax)
61; CHECK-NEXT:  ret
62; NOFSECT      .section __patchable_function_entries,"aGwo",@progbits,f5,comdat,f5,unique,2
63; FSECT:       .section __patchable_function_entries,"aGwo",@progbits,f5,comdat,f5,unique,3
64; 32:          .p2align 2
65; 32-NEXT:     .long .Lfunc_begin4
66; 64:          .p2align 3
67; 64-NEXT:     .quad .Lfunc_begin4
68  ret void
69}
70