Move X86-only test case to appropriate directory
[oota-llvm.git] / test / DebugInfo / X86 / expressions.ll
1 ; REQUIRES: object-emission
2 ; RUN: %llc_dwarf -mtriple x86_64-apple-darwin14.0.0-elf -filetype=obj %s -o %t
3 ; RUN: %llc_dwarf -mtriple x86_64-apple-darwin14.0.0-elf -O0 -filetype=obj %s -o %t0
4 ; RUN: llvm-dwarfdump -debug-dump=loc %t | FileCheck %s
5 ; RUN: llvm-dwarfdump -debug-dump=loc %t0 | FileCheck -check-prefix CHECK-O0 %s
6
7 ; CHECK: 0x00000000: Beginning address offset: 0x0000000000000000
8 ; CHECK:                Ending address offset: 0x[[END:[0-9a-f]+]]
9 ; CHECK:                 Location description:
10 ; CHECK-NOT:                                   75 00 55
11 ; CHECK-SAME:                                  55
12 ; CHECK: 0x00000023: Beginning address offset: 0x0000000000000000
13 ; CHECK:                Ending address offset: 0x{{.*}}[[END]]
14 ; CHECK:                 Location description: 75 08 9f
15 ; CHECK: 0x00000048: Beginning address offset: 0x0000000000000000
16 ; CHECK:                Ending address offset: 0x{{.*}}[[END]]
17 ; CHECK:                 Location description: 75 10 9f
18 ; CHECK: 0x0000006d: Beginning address offset: 0x0000000000000000
19 ; CHECK:                Ending address offset: 0x{{.*}}[[END]]
20 ; CHECK:                 Location description: 75 18
21
22
23 ; CHECK-O0: 0x00000000: Beginning address offset: 0x0000000000000000
24 ; CHECK-O0:                Ending address offset: 0x000000000000001b
25 ; CHECK-O0:                 Location description: 55
26 ; CHECK-O0:             Beginning address offset: 0x000000000000001b
27 ; CHECK-O0:                Ending address offset: 0x0000000000000024
28 ; CHECK-O0:                 Location description: 54
29 ; CHECK-O0:             Beginning address offset: 0x0000000000000024
30 ; CHECK-O0:                Ending address offset: 0x0000000000000025
31 ; CHECK-O0:                 Location description: 77 78 23 00
32 ; CHECK-O0: 0x0000004c: Beginning address offset: 0x0000000000000000
33 ; CHECK-O0:                Ending address offset: 0x000000000000001b
34 ; CHECK-O0:                 Location description: 75 08 9f
35 ; CHECK-O0:             Beginning address offset: 0x000000000000001b
36 ; CHECK-O0:                Ending address offset: 0x0000000000000024
37 ; CHECK-O0:                 Location description: 74 08 9f
38 ; CHECK-O0:             Beginning address offset: 0x0000000000000024
39 ; CHECK-O0:                Ending address offset: 0x0000000000000025
40 ; CHECK-O0:                 Location description: 77 78 23 08
41 ; CHECK-O0: 0x0000009c: Beginning address offset: 0x0000000000000000
42 ; CHECK-O0:                Ending address offset: 0x000000000000001b
43 ; CHECK-O0:                 Location description: 75 10 9f
44 ; CHECK-O0:             Beginning address offset: 0x000000000000001b
45 ; CHECK-O0:                Ending address offset: 0x0000000000000024
46 ; CHECK-O0:                 Location description: 74 10 9f
47 ; CHECK-O0:             Beginning address offset: 0x0000000000000024
48 ; CHECK-O0:                Ending address offset: 0x0000000000000025
49 ; CHECK-O0:                 Location description: 77 78 23 08 23 08
50 ; CHECK-O0: 0x000000ee: Beginning address offset: 0x0000000000000000
51 ; CHECK-O0:                Ending address offset: 0x000000000000001b
52 ; CHECK-O0:                 Location description: 75 18
53 ; CHECK-O0:             Beginning address offset: 0x000000000000001b
54 ; CHECK-O0:                Ending address offset: 0x0000000000000024
55 ; CHECK-O0:                 Location description: 74 18
56 ; CHECK-O0:             Beginning address offset: 0x0000000000000024
57 ; CHECK-O0:                Ending address offset: 0x0000000000000025
58 ; CHECK-O0:                 Location description: 77 78 23 10 23 08 06
59
60 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
61
62 define float @foo(float* %args, float *%args2)
63 {
64     call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !11, metadata !12), !dbg !19
65     call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !13, metadata !14), !dbg !19
66     call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !15, metadata !16), !dbg !19
67     call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !17, metadata !18), !dbg !19
68     %a = load float, float* %args, !dbg !19
69     %bptr = getelementptr float, float* %args, i32 1, !dbg !19
70     %b = load float, float* %bptr, !dbg !19
71     %cptr = getelementptr float, float* %args, i32 2, !dbg !19
72     %c = load float, float* %cptr, !dbg !19
73     %dptr = getelementptr float, float* %args, i32 3, !dbg !19
74     %d = load float, float* %dptr, !dbg !19
75     %ret1 = fadd float %a, %b, !dbg !19
76     %ret2 = fadd float %c, %d, !dbg !19
77     call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !11, metadata !12), !dbg !19
78     call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !13, metadata !14), !dbg !19
79     call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !15, metadata !16), !dbg !19
80     call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !17, metadata !18), !dbg !19
81     %ret  = fsub float %ret1, %ret2, !dbg !19
82     ret float %ret, !dbg !19
83 }
84
85 attributes #0 = { nounwind readnone }
86
87 !llvm.module.flags = !{!0, !1}
88 !llvm.dbg.cu = !{!2}
89
90 !0 = !{i32 2, !"Dwarf Version", i32 4}
91 !1 = !{i32 1, !"Debug Info Version", i32 3}
92
93 !2 = !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "byHand", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !4, retainedTypes: !4, subprograms: !5, globals: !4, imports: !4)
94 !3 = !DIFile(filename: "expressions", directory: ".")
95 !4 = !{}
96 !5 = !{!6}
97 !6 = !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !3, type: !7, isLocal: false, isDefinition: true, isOptimized: true, function: float (float*, float*)* @foo, variables: !4)
98 !7 = !DISubroutineType(types: !8)
99 !8 = !{!10, !10}
100 !9 = !DIBasicType(name: "float", size: 4, align: 4, encoding: DW_ATE_float)
101 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64)
102 !11 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", arg: 1, scope: !6, file: !3, line: 1, type: !10)
103 !12 = !DIExpression(DW_OP_plus, 0)
104 !13 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "b", arg: 2, scope: !6, file: !3, line: 1, type: !10)
105 !14 = !DIExpression(DW_OP_plus, 8)
106 !15 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "c", arg: 3, scope: !6, file: !3, line: 1, type: !10)
107 !16 = !DIExpression(DW_OP_plus, 8, DW_OP_plus, 8)
108 !17 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "d", arg: 4, scope: !6, file: !3, line: 1, type: !9)
109 !18 = !DIExpression(DW_OP_plus, 16, DW_OP_plus, 8, DW_OP_deref)
110 !19 = !DILocation(line: 1, scope: !6)