]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/X86/fp128-g.ll
Vendor import of llvm release_40 branch r292009:
[FreeBSD/FreeBSD.git] / test / CodeGen / X86 / fp128-g.ll
1 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s --check-prefix=X64
2 ;
3 ; These cases check if x86_64-linux-android works with -O2 -g,
4 ; especially CSE matching needed by SoftenFloatRes_LOAD.
5 ; Multiple common load patterns are included to have better coverage.
6 ; When CSE matching fails, SoftenFloatResult and SoftenFloatRes_LOAD
7 ; can be called in an infinite loop.
8
9 ; ModuleID = 'fp128-g.c'
10 source_filename = "fp128-g.c"
11 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
12 target triple = "x86_64--linux-android"
13
14 @ld_ptr = common local_unnamed_addr global fp128* null, align 8, !dbg !0
15
16 ; Function Attrs: nounwind readonly uwtable
17 define fp128 @test_return1(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !12 {
18 entry:
19   tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !16, metadata !17), !dbg !18
20   %0 = load fp128, fp128* %ptr, align 16, !dbg !19, !tbaa !20
21   ret fp128 %0, !dbg !24
22 ; X64-LABEL: test_return1:
23 ; X64:       .loc
24 ; X64:       movaps     (%rdi), %xmm0
25 ; X64:       .loc
26 ; X64:       retq
27 }
28
29 ; Function Attrs: nounwind readonly uwtable
30 define fp128 @test_return2(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !25 {
31 entry:
32   tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !27, metadata !17), !dbg !29
33   %0 = load fp128, fp128* %ptr, align 16, !dbg !30, !tbaa !20
34   tail call void @llvm.dbg.value(metadata fp128 %0, i64 0, metadata !28, metadata !17), !dbg !31
35   ret fp128 %0, !dbg !32
36 }
37
38 ; X64-LABEL: test_return2:
39 ; X64:       .loc
40 ; X64:       movaps     (%rdi), %xmm0
41 ; X64:       .loc
42 ; X64:       retq
43 ; Function Attrs: nounwind readonly uwtable
44
45 define fp128 @test_return3(fp128* nocapture readonly %ptr) local_unnamed_addr #0 !dbg !33 {
46 entry:
47   tail call void @llvm.dbg.value(metadata fp128* %ptr, i64 0, metadata !35, metadata !17), !dbg !36
48   %0 = load fp128, fp128* %ptr, align 16, !dbg !37, !tbaa !20
49   %add = fadd fp128 %0, %0, !dbg !38
50   ret fp128 %add, !dbg !39
51 ; X64-LABEL: test_return3:
52 ; X64:       .loc
53 ; X64:       movaps     (%rdi), %xmm0
54 ; X64:       .loc
55 ; X64:       movaps     %xmm0, %xmm1
56 ; X64:       callq      __addtf3
57 ; X64:       .loc
58 ; X64:       retq
59 }
60
61 ; Function Attrs: norecurse nounwind readonly uwtable
62 define fp128 @test_return4() local_unnamed_addr #1 !dbg !40 {
63 entry:
64   %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !43, !tbaa !44
65   %1 = load fp128, fp128* %0, align 16, !dbg !46, !tbaa !20
66   ret fp128 %1, !dbg !47
67 ; X64-LABEL: test_return4:
68 ; X64:       .loc
69 ; X64:       movq       ld_ptr(%rip), %rax
70 ; X64:       .loc
71 ; X64:       movaps     (%rax), %xmm0
72 ; X64:       .loc
73 ; X64:       retq
74 }
75
76 ; Function Attrs: nounwind readonly uwtable
77 define fp128 @test_return5() local_unnamed_addr #0 !dbg !48 {
78 entry:
79   %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !51, !tbaa !44
80   %1 = load fp128, fp128* %0, align 16, !dbg !52, !tbaa !20
81   tail call void @llvm.dbg.value(metadata fp128 %1, i64 0, metadata !50, metadata !17), !dbg !53
82   ret fp128 %1, !dbg !54
83 ; X64-LABEL: test_return5:
84 ; X64:       .loc
85 ; X64:       movq       ld_ptr(%rip), %rax
86 ; X64:       .loc
87 ; X64:       movaps     (%rax), %xmm0
88 ; X64:       .loc
89 ; X64:       retq
90 }
91
92 ; Function Attrs: norecurse nounwind readonly uwtable
93 define fp128 @test_return6() local_unnamed_addr #1 !dbg !55 {
94 entry:
95   %0 = load fp128*, fp128** @ld_ptr, align 8, !dbg !56, !tbaa !44
96   %1 = load fp128, fp128* %0, align 16, !dbg !57, !tbaa !20
97   %add = fadd fp128 %1, %1, !dbg !58
98   ret fp128 %add, !dbg !59
99 ; X64-LABEL: test_return6:
100 ; X64:       .loc
101 ; X64:       movaps     (%rax), %xmm0
102 ; X64:       .loc
103 ; X64:       movaps     %xmm0, %xmm1
104 ; X64:       callq      __addtf3
105 ; X64:       .loc
106 ; X64:       retq
107 }
108
109 ; Function Attrs: nounwind readnone
110 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
111
112 attributes #0 = { nounwind readonly uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
113 attributes #1 = { norecurse nounwind readonly uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
114 attributes #2 = { nounwind readnone }
115
116 !llvm.dbg.cu = !{!2}
117 !llvm.module.flags = !{!8, !9, !10}
118 !llvm.ident = !{!11}
119
120 !0 = !DIGlobalVariableExpression(var: !1)
121 !1 = !DIGlobalVariable(name: "ld_ptr", scope: !2, file: !3, line: 17, type: !6, isLocal: false, isDefinition: true)
122 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 4.0.0 (trunk 281495)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
123 !3 = !DIFile(filename: "fp128-g.c", directory: "/disk5/chh/Debug/ld.loop")
124 !4 = !{}
125 !5 = !{!0}
126 !6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64)
127 !7 = !DIBasicType(name: "long double", size: 128, align: 128, encoding: DW_ATE_float)
128 !8 = !{i32 2, !"Dwarf Version", i32 4}
129 !9 = !{i32 2, !"Debug Info Version", i32 3}
130 !10 = !{i32 1, !"PIC Level", i32 2}
131 !11 = !{!"clang version 4.0.0 (trunk 281495)"}
132 !12 = distinct !DISubprogram(name: "test_return1", scope: !3, file: !3, line: 3, type: !13, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !15)
133 !13 = !DISubroutineType(types: !14)
134 !14 = !{!7, !6}
135 !15 = !{!16}
136 !16 = !DILocalVariable(name: "ptr", arg: 1, scope: !12, file: !3, line: 3, type: !6)
137 !17 = !DIExpression()
138 !18 = !DILocation(line: 3, column: 39, scope: !12)
139 !19 = !DILocation(line: 4, column: 12, scope: !12)
140 !20 = !{!21, !21, i64 0}
141 !21 = !{!"long double", !22, i64 0}
142 !22 = !{!"omnipotent char", !23, i64 0}
143 !23 = !{!"Simple C/C++ TBAA"}
144 !24 = !DILocation(line: 4, column: 5, scope: !12)
145 !25 = distinct !DISubprogram(name: "test_return2", scope: !3, file: !3, line: 7, type: !13, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !26)
146 !26 = !{!27, !28}
147 !27 = !DILocalVariable(name: "ptr", arg: 1, scope: !25, file: !3, line: 7, type: !6)
148 !28 = !DILocalVariable(name: "value", scope: !25, file: !3, line: 8, type: !7)
149 !29 = !DILocation(line: 7, column: 39, scope: !25)
150 !30 = !DILocation(line: 9, column: 14, scope: !25)
151 !31 = !DILocation(line: 8, column: 17, scope: !25)
152 !32 = !DILocation(line: 10, column: 5, scope: !25)
153 !33 = distinct !DISubprogram(name: "test_return3", scope: !3, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !34)
154 !34 = !{!35}
155 !35 = !DILocalVariable(name: "ptr", arg: 1, scope: !33, file: !3, line: 13, type: !6)
156 !36 = !DILocation(line: 13, column: 39, scope: !33)
157 !37 = !DILocation(line: 14, column: 12, scope: !33)
158 !38 = !DILocation(line: 14, column: 17, scope: !33)
159 !39 = !DILocation(line: 14, column: 5, scope: !33)
160 !40 = distinct !DISubprogram(name: "test_return4", scope: !3, file: !3, line: 18, type: !41, isLocal: false, isDefinition: true, scopeLine: 18, isOptimized: true, unit: !2, variables: !4)
161 !41 = !DISubroutineType(types: !42)
162 !42 = !{!7}
163 !43 = !DILocation(line: 19, column: 13, scope: !40)
164 !44 = !{!45, !45, i64 0}
165 !45 = !{!"any pointer", !22, i64 0}
166 !46 = !DILocation(line: 19, column: 12, scope: !40)
167 !47 = !DILocation(line: 19, column: 5, scope: !40)
168 !48 = distinct !DISubprogram(name: "test_return5", scope: !3, file: !3, line: 22, type: !41, isLocal: false, isDefinition: true, scopeLine: 22, isOptimized: true, unit: !2, variables: !49)
169 !49 = !{!50}
170 !50 = !DILocalVariable(name: "value", scope: !48, file: !3, line: 23, type: !7)
171 !51 = !DILocation(line: 23, column: 26, scope: !48)
172 !52 = !DILocation(line: 23, column: 25, scope: !48)
173 !53 = !DILocation(line: 23, column: 17, scope: !48)
174 !54 = !DILocation(line: 24, column: 5, scope: !48)
175 !55 = distinct !DISubprogram(name: "test_return6", scope: !3, file: !3, line: 27, type: !41, isLocal: false, isDefinition: true, scopeLine: 27, isOptimized: true, unit: !2, variables: !4)
176 !56 = !DILocation(line: 28, column: 13, scope: !55)
177 !57 = !DILocation(line: 28, column: 12, scope: !55)
178 !58 = !DILocation(line: 28, column: 20, scope: !55)
179 !59 = !DILocation(line: 28, column: 5, scope: !55)
180