xref: /llvm-project/llvm/test/DebugInfo/NVPTX/packed_bitfields.ll (revision 119aecb955df91173d69c455bba0abd74271c215)
1; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
2; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-nvidia-cuda | %ptxas-verify %}
3
4; Produced at -O0 from:
5; struct {
6;   char : 3;
7;   char a : 6;
8; } __attribute__((__packed__)) b;
9
10; Note that DWARF 2 counts bit offsets backwards from the high end of
11; the storage unit to the high end of the bit field.
12
13; CHECK: .section .debug_info
14; CHECK:      .b8 3    // Abbrev {{.*}} DW_TAG_structure_type
15; CHECK:      .b8 3    // DW_AT_decl_line
16; CHECK-NEXT: .b8 1    // DW_AT_byte_size
17; CHECK-NEXT: .b8 6    // DW_AT_bit_size
18; Negative offset must be encoded as an unsigned integer.
19; CHECK-NEXT: .b8 127  // DW_AT_bit_offset
20; CHECK-NEXT: .b8 2    // DW_AT_data_member_location
21
22%struct.anon = type { i16 }
23
24@b = global %struct.anon zeroinitializer, align 1, !dbg !0
25
26!llvm.dbg.cu = !{!2}
27!llvm.module.flags = !{!10, !11, !12, !13}
28!llvm.ident = !{!14}
29
30!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
31!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 4, type: !6, isLocal: false, isDefinition: true)
32!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None, sysroot: "/")
33!3 = !DIFile(filename: "repro.c", directory: "/tmp")
34!4 = !{}
35!5 = !{!0}
36!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 1, size: 16, elements: !7)
37!7 = !{!8}
38!8 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !6, file: !3, line: 3, baseType: !9, size: 6, offset: 3, flags: DIFlagBitField, extraData: i64 0)
39!9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
40!10 = !{i32 7, !"Dwarf Version", i32 2}
41!11 = !{i32 2, !"Debug Info Version", i32 3}
42!12 = !{i32 1, !"wchar_size", i32 4}
43!13 = !{i32 7, !"PIC Level", i32 2}
44!14 = !{!"clang version 11.0.0 "}
45