1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -O0 < %s | FileCheck --check-prefix=X86 %s
2; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s | llvm-mc -triple=i686-pc-win32 -filetype=obj | llvm-readobj -S --sr --codeview - | FileCheck --check-prefix=OBJ32 %s
3; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -O0 < %s | FileCheck --check-prefix=X64 %s
4; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -o - -O0 < %s | llvm-mc -triple=x86_64-pc-win32 -filetype=obj | llvm-readobj -S --sr --codeview - | FileCheck --check-prefix=OBJ64 %s
5
6; This LL file was generated by running clang on the following code:
7; D:\asm.c:
8;  1 void g(void);
9;  2
10;  3 void f(void) {
11;  4   __asm align 4;
12;  5   g();
13;  6 }
14
15; X86-LABEL: _f:
16; X86:      .cv_file 1 "D:\\asm.c"
17; X86:      .cv_loc 0 1 4 0
18; X86:      .cv_loc 0 1 5 0
19; X86:      calll   _g
20; X86:      .cv_loc 0 1 6 0
21; X86:      ret
22; X86:      [[END_OF_F:.?Lfunc_end.*]]:
23
24; Line table
25; X86:      .cv_linetable 0, _f, [[END_OF_F]]
26; File index to string table offset subsection
27; X86-NEXT: .cv_filechecksums
28; String table
29; X86-NEXT: .cv_stringtable
30
31; OBJ32:    Section {
32; OBJ32:      Name: .debug$S (2E 64 65 62 75 67 24 53)
33; OBJ32:      Characteristics [ (0x42300040)
34; OBJ32:      ]
35; OBJ32:    CodeViewDebugInfo [
36; OBJ32:      Subsection [
37; OBJ32-NEXT:   SubSectionType: Symbols (0xF1)
38; OBJ32:        {{.*}}Proc{{.*}}Sym {
39; OBJ32:          CodeSize: 0x6
40; OBJ32:          DisplayName: f
41; OBJ32:          LinkageName: _f
42; OBJ32:        }
43; OBJ32:        ProcEnd {
44; OBJ32:        }
45; OBJ32-NEXT: ]
46; OBJ32:      FunctionLineTable [
47; OBJ32-NEXT:   Name: _f
48; OBJ32-NEXT:   Flags: 0x0
49; OBJ32-NEXT:   CodeSize: 0x6
50; OBJ32-NEXT:   FilenameSegment [
51; OBJ32-NEXT:   Filename: D:\asm.c
52; FIXME: An empty __asm stmt creates an extra entry.
53; We seem to know that these offsets are the same statically during the
54; execution of endModule().  See PR18679 for the details.
55; OBJ32-NEXT:   +0x0 [
56; OBJ32-NEXT:     LineNumberStart: 4
57; OBJ32-NEXT:     LineNumberEndDelta: 0
58; OBJ32-NEXT:     IsStatement: No
59; OBJ32-NEXT:   ]
60; OBJ32-NEXT:   +0x0 [
61; OBJ32-NEXT:     LineNumberStart: 5
62; OBJ32-NEXT:     LineNumberEndDelta: 0
63; OBJ32-NEXT:     IsStatement: No
64; OBJ32-NEXT:   ]
65; OBJ32-NEXT:   +0x5 [
66; OBJ32-NEXT:     LineNumberStart: 6
67; OBJ32-NEXT:     LineNumberEndDelta: 0
68; OBJ32-NEXT:     IsStatement: No
69; OBJ32-NEXT:   ]
70; OBJ32-NEXT: ]
71
72; X64-LABEL: f:
73; X64:      .cv_file 1 "D:\\asm.c"
74; X64:      .cv_loc 0 1 3 0
75; X64:      subq    $40, %rsp
76; X64:      .cv_loc 0 1 4 0
77; X64:      .cv_loc 0 1 5 0
78; X64:      callq   g
79; X64:      .cv_loc 0 1 6 0
80; X64:      addq    $40, %rsp
81; X64-NEXT: ret
82; X64:      [[END_OF_F:.?Lfunc_end.*]]:
83
84; Line table
85; X64:      .cv_linetable 0, f, [[END_OF_F]]
86; File index to string table offset subsection
87; X64-NEXT: .cv_filechecksums
88; String table
89; X64-NEXT: .cv_stringtable
90
91; OBJ64:    Section {
92; OBJ64:      Name: .debug$S (2E 64 65 62 75 67 24 53)
93; OBJ64:      Characteristics [ (0x42300040)
94; OBJ64:      ]
95; OBJ64:      Subsection [
96; OBJ64-NEXT:   SubSectionType: Symbols (0xF1)
97; OBJ64:        {{.*}}Proc{{.*}}Sym {
98; OBJ64:          CodeSize: 0xE
99; OBJ64:          DisplayName: f
100; OBJ64:          LinkageName: f
101; OBJ64:        }
102; OBJ64:        ProcEnd {
103; OBJ64:        }
104; OBJ64-NEXT: ]
105; OBJ64:      FunctionLineTable [
106; OBJ64-NEXT:   Name: f
107; OBJ64-NEXT:   Flags: 0x0
108; OBJ64-NEXT:   CodeSize: 0xE
109; OBJ64-NEXT:   FilenameSegment [
110; OBJ64-NEXT:     Filename: D:\asm.c
111; FIXME: An empty __asm stmt creates an extra entry.
112; See PR18679 for the details.
113; OBJ64-NEXT:     +0x0 [
114; OBJ64-NEXT:       LineNumberStart: 3
115; OBJ64-NEXT:       LineNumberEndDelta: 0
116; OBJ64-NEXT:       IsStatement: No
117; OBJ64-NEXT:     ]
118; OBJ64-NEXT:     +0x4 [
119; OBJ64-NEXT:       LineNumberStart: 4
120; OBJ64-NEXT:       LineNumberEndDelta: 0
121; OBJ64-NEXT:       IsStatement: No
122; OBJ64-NEXT:     ]
123; OBJ64-NEXT:     +0x4 [
124; OBJ64-NEXT:       LineNumberStart: 5
125; OBJ64-NEXT:       LineNumberEndDelta: 0
126; OBJ64-NEXT:       IsStatement: No
127; OBJ64-NEXT:     ]
128; OBJ64-NEXT:     +0x9 [
129; OBJ64-NEXT:       LineNumberStart: 6
130; OBJ64-NEXT:       LineNumberEndDelta: 0
131; OBJ64-NEXT:       IsStatement: No
132; OBJ64-NEXT:     ]
133; OBJ64-NEXT:   ]
134; OBJ64-NEXT: ]
135
136; Function Attrs: nounwind
137define void @f() #0 !dbg !4 {
138entry:
139  call void asm sideeffect inteldialect ".align 4", "~{dirflag},~{fpsr},~{flags}"() #2, !dbg !12
140  call void @g(), !dbg !13
141  ret void, !dbg !14
142}
143
144declare void @g() #1
145
146attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
147attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
148attributes #2 = { nounwind }
149
150!llvm.dbg.cu = !{!0}
151!llvm.module.flags = !{!9, !10}
152!llvm.ident = !{!11}
153
154!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
155!1 = !DIFile(filename: "<unknown>", directory: "D:\5C")
156!2 = !{}
157!4 = distinct !DISubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !5, scope: !6, type: !7, retainedNodes: !2)
158!5 = !DIFile(filename: "asm.c", directory: "D:\5C")
159!6 = !DIFile(filename: "asm.c", directory: "D:C")
160!7 = !DISubroutineType(types: !8)
161!8 = !{null}
162!9 = !{i32 2, !"CodeView", i32 1}
163!10 = !{i32 1, !"Debug Info Version", i32 3}
164!11 = !{!"clang version 3.5 "}
165!12 = !DILocation(line: 4, scope: !4)
166!13 = !DILocation(line: 5, scope: !4)
167!14 = !DILocation(line: 6, scope: !4)
168