xref: /llvm-project/llvm/test/DebugInfo/COFF/integer-128.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: llc < %s | FileCheck %s --check-prefix=ASM
2
3; // C++ source to regenerate:
4; enum class uns : __uint128_t { unsval = __uint128_t(1) << 64 };
5; uns t1() { return uns::unsval; }
6; enum class sig : __int128 { sigval = -(__int128(1) << 64) };
7; sig t2() { return sig::sigval; }
8; struct test {
9;   static const __uint128_t u128 = __uint128_t(1) << 64;
10;   static const __int128    s128 = -(__int128(1) << 64);
11; };
12; test t3() { return test(); }
13;
14; $ clang a.cpp -S -emit-llvm -g -gcodeview
15
16; ------------------------------------------------------------------------------
17
18; ASM-LABEL: .long   241                             # Symbol subsection for globals
19;
20; ASM-LABEL: .short	4359                            # Record kind: S_CONSTANT
21; ASM-NEXT:  .long	4110                            # Type
22; ASM-NEXT:  .byte	0x0a, 0x80, 0xff, 0xff          # Value
23; ASM-NEXT:  .byte	0xff, 0xff, 0xff, 0xff
24; ASM-NEXT:  .byte	0xff, 0xff
25; ASM-NEXT:  .asciz	"test::u128"                    # Name
26; ASM-NEXT:  .p2align	2
27;
28; ASM-LABEL: .short	4359                            # Record kind: S_CONSTANT
29; ASM-NEXT:  .long	4111                            # Type
30; ASM-NEXT:  .byte	0x09, 0x80, 0x00, 0x00          # Value
31; ASM-NEXT:  .byte	0x00, 0x00, 0x00, 0x00
32; ASM-NEXT:  .byte	0x00, 0x80
33; ASM-NEXT:  .asciz	"test::s128"                    # Name
34; ASM-NEXT:  .p2align	2
35;
36; ASM-LABEL: .short	0x1203                          # Record kind: LF_FIELDLIST
37; ASM-NEXT:  .short	0x1502                          # Member kind: Enumerator ( LF_ENUMERATE )
38; ASM-NEXT:  .short	0x3                             # Attrs: Public
39; ASM-NEXT:  .short	0x800a
40; ASM-NEXT:  .quad	0xffffffffffffffff              # EnumValue
41; ASM-NEXT:  .asciz	"unsval"                        # Name
42;
43; ASM-LABEL: .short	0x1203                          # Record kind: LF_FIELDLIST
44; ASM-NEXT:  .short	0x1502                          # Member kind: Enumerator ( LF_ENUMERATE )
45; ASM-NEXT:  .short	0x3                             # Attrs: Public
46; ASM-NEXT:  .short	0x800a
47; ASM-NEXT:  .quad	0xffffffffffffffff              # EnumValue
48; ASM-NEXT:  .asciz	"sigval"                        # Name
49
50; ------------------------------------------------------------------------------
51
52; ModuleID = 'a.cpp'
53source_filename = "a.cpp"
54target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
55target triple = "x86_64-unknown-windows-gnu"
56
57%struct.test = type { i8 }
58
59; Function Attrs: mustprogress noinline nounwind optnone
60define dso_local <2 x i64> @_Z2t1v() #0 !dbg !23 {
61entry:
62  %retval = alloca i128, align 16
63  store i128 18446744073709551616, ptr %retval, align 16, !dbg !27
64  %0 = load <2 x i64>, ptr %retval, align 16, !dbg !27
65  ret <2 x i64> %0, !dbg !27
66}
67
68; Function Attrs: mustprogress noinline nounwind optnone
69define dso_local <2 x i64> @_Z2t2v() #0 !dbg !28 {
70entry:
71  %retval = alloca i128, align 16
72  store i128 -18446744073709551616, ptr %retval, align 16, !dbg !31
73  %0 = load <2 x i64>, ptr %retval, align 16, !dbg !31
74  ret <2 x i64> %0, !dbg !31
75}
76
77; Function Attrs: mustprogress noinline nounwind optnone
78define dso_local i8 @_Z2t3v() #1 !dbg !32 {
79entry:
80  %retval = alloca %struct.test, align 1
81  %0 = load i8, ptr %retval, align 1, !dbg !41
82  ret i8 %0, !dbg !41
83}
84
85attributes #0 = { mustprogress noinline nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="128" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
86attributes #1 = { mustprogress noinline nounwind optnone "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
87
88!llvm.dbg.cu = !{!0}
89!llvm.module.flags = !{!19, !20, !21}
90!llvm.ident = !{!22}
91
92!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !14, splitDebugInlining: false, nameTableKind: None)
93!1 = !DIFile(filename: "a.cpp", directory: ".", checksumkind: CSK_MD5, checksum: "b37f4034fd610917975e9c5ff097fa6b")
94!2 = !{!3, !10}
95!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "uns", file: !4, line: 4, baseType: !5, size: 128, flags: DIFlagEnumClass, elements: !8, identifier: "_ZTS3uns")
96!4 = !DIFile(filename: "a.cpp", directory: ".", checksumkind: CSK_MD5, checksum: "b37f4034fd610917975e9c5ff097fa6b")
97!5 = !DIDerivedType(tag: DW_TAG_typedef, name: "__uint128_t", file: !6, baseType: !7)
98!6 = !DIFile(filename: "a.cpp", directory: ".")
99!7 = !DIBasicType(name: "unsigned __int128", size: 128, encoding: DW_ATE_unsigned)
100!8 = !{!9}
101!9 = !DIEnumerator(name: "unsval", value: 18446744073709551616, isUnsigned: true)
102!10 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "sig", file: !4, line: 7, baseType: !11, size: 128, flags: DIFlagEnumClass, elements: !12, identifier: "_ZTS3sig")
103!11 = !DIBasicType(name: "__int128", size: 128, encoding: DW_ATE_signed)
104!12 = !{!13}
105!13 = !DIEnumerator(name: "sigval", value: -18446744073709551616)
106!14 = !{!15, !17}
107!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
108!16 = distinct !DIGlobalVariable(name: "unsval", scope: !0, file: !4, line: 4, type: !3, isLocal: true, isDefinition: true)
109!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
110!18 = distinct !DIGlobalVariable(name: "sigval", scope: !0, file: !4, line: 7, type: !10, isLocal: true, isDefinition: true)
111!19 = !{i32 2, !"CodeView", i32 1}
112!20 = !{i32 2, !"Debug Info Version", i32 3}
113!21 = !{i32 1, !"wchar_size", i32 2}
114!22 = !{!"clang version 13.0.0"}
115!23 = distinct !DISubprogram(name: "t1", linkageName: "_Z2t1v", scope: !4, file: !4, line: 5, type: !24, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !26)
116!24 = !DISubroutineType(types: !25)
117!25 = !{!3}
118!26 = !{}
119!27 = !DILocation(line: 5, column: 12, scope: !23)
120!28 = distinct !DISubprogram(name: "t2", linkageName: "_Z2t2v", scope: !4, file: !4, line: 8, type: !29, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !26)
121!29 = !DISubroutineType(types: !30)
122!30 = !{!10}
123!31 = !DILocation(line: 8, column: 12, scope: !28)
124!32 = distinct !DISubprogram(name: "t3", linkageName: "_Z2t3v", scope: !4, file: !4, line: 14, type: !33, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !26)
125!33 = !DISubroutineType(types: !34)
126!34 = !{!35}
127!35 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "test", file: !4, line: 10, size: 8, flags: DIFlagTypePassByValue, elements: !36, identifier: "_ZTS4test")
128!36 = !{!37, !39}
129!37 = !DIDerivedType(tag: DW_TAG_member, name: "u128", scope: !35, file: !4, line: 11, baseType: !38, flags: DIFlagStaticMember, extraData: i128 18446744073709551616)
130!38 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !5)
131!39 = !DIDerivedType(tag: DW_TAG_member, name: "s128", scope: !35, file: !4, line: 12, baseType: !40, flags: DIFlagStaticMember, extraData: i128 -18446744073709551616)
132!40 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11)
133!41 = !DILocation(line: 14, column: 13, scope: !32)
134