1; RUN: llc < %s -mtriple=powerpc-apple-darwin | FileCheck -check-prefix=CHECK-MACHO %s
2; RUN: llc < %s -mtriple=powerpc-apple-darwin -disable-fp-elim | FileCheck -check-prefix=CHECK-MACHO %s
3; RUN: llc < %s -mtriple=powerpc-linux-gnu | FileCheck -check-prefix=LINUX-NO-FP %s
4; RUN: llc < %s -mtriple=powerpc-linux-gnu -disable-fp-elim | FileCheck -check-prefix=LINUX-FP %s
5
6define void @func() {
7entry:
8  unreachable
9}
10
11; MachO cannot handle an empty function.
12; CHECK-MACHO:     _func:
13; CHECK-MACHO-NEXT: .cfi_startproc
14; CHECK-MACHO-NEXT: {{^}};
15; CHECK-MACHO-NEXT:     nop
16; CHECK-MACHO-NEXT: .cfi_endproc
17
18; An empty function is perfectly fine on ELF.
19; LINUX-NO-FP: func:
20; LINUX-NO-FP-NEXT: {{^}}.L[[BEGIN:.*]]:{{$}}
21; LINUX-NO-FP-NEXT: .cfi_startproc
22; LINUX-NO-FP-NEXT: {{^}}#
23; LINUX-NO-FP-NEXT: {{^}}.L[[END:.*]]:{{$}}
24; LINUX-NO-FP-NEXT: .size   func, .L[[END]]-.L[[BEGIN]]
25; LINUX-NO-FP-NEXT: .cfi_endproc
26
27; A cfi directive can point to the end of a function. It (and in fact the
28; entire body) could be optimized out because of the unreachable, but we
29; don't do it right now.
30; LINUX-FP: func:
31; LINUX-FP-NEXT: {{^}}.L[[BEGIN:.*]]:{{$}}
32; LINUX-FP-NEXT: .cfi_startproc
33; LINUX-FP-NEXT: {{^}}#
34; LINUX-FP-NEXT: stw 31, -4(1)
35; LINUX-FP-NEXT: stwu 1, -16(1)
36; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
37; LINUX-FP-NEXT:  .cfi_def_cfa_offset 16
38; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
39; LINUX-FP-NEXT: .cfi_offset r31, -4
40; LINUX-FP-NEXT: mr 31, 1
41; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
42; LINUX-FP-NEXT: .cfi_def_cfa_register r31
43; LINUX-FP-NEXT: {{^}}.L[[END:.*]]:{{$}}
44; LINUX-FP-NEXT: .size   func, .L[[END]]-.L[[BEGIN]]
45; LINUX-FP-NEXT: .cfi_endproc
46