| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv --spirv-debug-info-version=ocl-100 %t.bc |
| 3 |
; RUN: llvm-spirv %t.spv -o %t.spt --to-text |
| 4 |
; RUN: FileCheck %s --input-file %t.spt -check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NO-BITFIELD |
| 5 |
; RUN: llvm-spirv -r %t.spv -o %t_1.bc |
| 6 |
; RUN: llvm-dis %t_1.bc -o %t_1.ll |
| 7 |
; RUN: FileCheck %s --input-file %t_1.ll -check-prefixes=CHECK-LLVM,CHECK-LLVM-NO-BITFIELD |
| 8 |
|
| 9 |
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_non_semantic_info --spirv-debug-info-version=nonsemantic-shader-100 %t.bc |
| 10 |
; RUN: llvm-spirv %t.spv -o %t.spt --to-text |
| 11 |
; RUN: FileCheck %s --input-file %t.spt -check-prefixes=CHECK-SPIRV,CHECK-SPIRV-BITFIELD |
| 12 |
; RUN: llvm-spirv -r %t.spv -o %t_1.bc |
| 13 |
; RUN: llvm-dis %t_1.bc -o %t_1.ll |
| 14 |
; RUN: FileCheck %s --input-file %t_1.ll -check-prefixes=CHECK-LLVM,CHECK-LLVM-NO-BITFIELD |
| 15 |
|
| 16 |
; RUN: llvm-spirv --spirv-debug-info-version=nonsemantic-shader-200 %t.bc -o %t.spv |
| 17 |
; RUN: llvm-spirv %t.spv -o %t.spt --to-text |
| 18 |
; RUN: FileCheck %s --input-file %t.spt -check-prefixes=CHECK-SPIRV,CHECK-SPIRV-BITFIELD |
| 19 |
; RUN: llvm-spirv -r %t.spv -o %t_1.bc |
| 20 |
; RUN: llvm-dis %t_1.bc -o %t_1.ll |
| 21 |
; RUN: FileCheck %s --input-file %t_1.ll -check-prefixes=CHECK-LLVM,CHECK-LLVM-BITFIELD |
| 22 |
|
| 23 |
; CHECK-SPIRV: String [[#A:]] "a" |
| 24 |
; CHECK-SPIRV: String [[#B:]] "b" |
| 25 |
; CHECK-SPIRV: String [[#C:]] "c" |
| 26 |
; CHECK-SPIRV: String [[#D:]] "d" |
| 27 |
; CHECK-SPIRV: String [[#E:]] "e" |
| 28 |
; CHECK-SPIRV: String [[#F:]] "f" |
| 29 |
|
| 30 |
; CHECK-SPIRV-DAG: Constant [[#]] [[#THREE:]] 3 {{$}} |
| 31 |
; CHECK-SPIRV-DAG: Constant [[#]] [[#ONE:]] 1 {{$}} |
| 32 |
|
| 33 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#A]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 34 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#B]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 35 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#C]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 36 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#D]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 37 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#E]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 38 |
; CHECK-SPIRV-NO-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#F]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#]] |
| 39 |
|
| 40 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#A]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#THREE]] [[#]] |
| 41 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#B]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#THREE]] [[#]] |
| 42 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#C]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#THREE]] [[#]] |
| 43 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#D]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#THREE]] [[#]] |
| 44 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#E]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#THREE]] [[#]] |
| 45 |
; CHECK-SPIRV-BITFIELD: ExtInst [[#]] [[#]] [[#]] DebugTypeMember [[#F]] [[#]] [[#]] [[#]] [[#]] [[#]] [[#ONE]] [[#]] |
| 46 |
|
| 47 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 48 |
target triple = "spir64-unknown-unknown" |
| 49 |
|
| 50 |
%struct.struct_bit_fields1 = type { i16 } |
| 51 |
|
| 52 |
@__const._Z3fooii.arr_bf1 = private unnamed_addr addrspace(1) constant [1 x { i8, i8 }] [{ i8, i8 } { i8 -47, i8 8 }], align 2 |
| 53 |
|
| 54 |
; Function Attrs: convergent mustprogress noinline norecurse nounwind optnone |
| 55 |
define dso_local spir_func noundef i32 @_Z3fooii(i32 noundef %0, i32 noundef %1) #0 !dbg !10 { |
| 56 |
%3 = alloca i32, align 4 |
| 57 |
%4 = alloca i32, align 4 |
| 58 |
%5 = alloca i32, align 4 |
| 59 |
%6 = alloca [1 x %struct.struct_bit_fields1], align 2 |
| 60 |
%7 = alloca i32, align 4 |
| 61 |
%8 = addrspacecast i32* %3 to i32 addrspace(4)* |
| 62 |
%9 = addrspacecast i32* %4 to i32 addrspace(4)* |
| 63 |
%10 = addrspacecast i32* %5 to i32 addrspace(4)* |
| 64 |
%11 = addrspacecast [1 x %struct.struct_bit_fields1]* %6 to [1 x %struct.struct_bit_fields1] addrspace(4)* |
| 65 |
%12 = addrspacecast i32* %7 to i32 addrspace(4)* |
| 66 |
store i32 %0, i32 addrspace(4)* %9, align 4 |
| 67 |
call void @llvm.dbg.declare(metadata i32* %4, metadata !15, metadata !DIExpression()), !dbg !16 |
| 68 |
store i32 %1, i32 addrspace(4)* %10, align 4 |
| 69 |
call void @llvm.dbg.declare(metadata i32* %5, metadata !17, metadata !DIExpression()), !dbg !18 |
| 70 |
call void @llvm.dbg.declare(metadata [1 x %struct.struct_bit_fields1]* %6, metadata !19, metadata !DIExpression()), !dbg !32 |
| 71 |
%13 = bitcast [1 x %struct.struct_bit_fields1] addrspace(4)* %11 to i8 addrspace(4)*, !dbg !32 |
| 72 |
call void @llvm.memcpy.p4i8.p1i8.i64(i8 addrspace(4)* align 2 %13, i8 addrspace(1)* align 2 getelementptr inbounds ([1 x { i8, i8 }], [1 x { i8, i8 }] addrspace(1)* @__const._Z3fooii.arr_bf1, i32 0, i32 0, i32 0), i64 2, i1 false), !dbg !32 |
| 73 |
call void @llvm.dbg.declare(metadata i32* %7, metadata !33, metadata !DIExpression()), !dbg !34 |
| 74 |
store i32 0, i32 addrspace(4)* %12, align 4, !dbg !34 |
| 75 |
%14 = load i32, i32 addrspace(4)* %12, align 4, !dbg !35 |
| 76 |
ret i32 %14, !dbg !36 |
| 77 |
} |
| 78 |
|
| 79 |
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) |
| 80 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 81 |
|
| 82 |
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) |
| 83 |
declare void @llvm.memcpy.p4i8.p1i8.i64(i8 addrspace(4)* noalias nocapture writeonly, i8 addrspace(1)* noalias nocapture readonly, i64, i1 immarg) #2 |
| 84 |
|
| 85 |
attributes #0 = { convergent mustprogress noinline norecurse nounwind optnone "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="bitfields-packed.cpp" "unsafe-fp-math"="true" } |
| 86 |
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn } |
| 87 |
attributes #2 = { nocallback nofree nounwind willreturn } |
| 88 |
|
| 89 |
!llvm.dbg.cu = !{!0} |
| 90 |
!opencl.spir.version = !{!2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2} |
| 91 |
!spirv.Source = !{!3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3} |
| 92 |
!opencl.compiler.options = !{!4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4, !4} |
| 93 |
!llvm.ident = !{!5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5, !5} |
| 94 |
!llvm.module.flags = !{!6, !7, !8, !9} |
| 95 |
|
| 96 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, flags: "", runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 97 |
!1 = !DIFile(filename: "bitfields-packed.cpp", directory: "/tmp") |
| 98 |
!2 = !{i32 1, i32 2} |
| 99 |
!3 = !{i32 4, i32 100000} |
| 100 |
!4 = !{} |
| 101 |
!5 = !{!"Compiler"} |
| 102 |
!6 = !{i32 7, !"Dwarf Version", i32 4} |
| 103 |
!7 = !{i32 2, !"Debug Info Version", i32 3} |
| 104 |
!8 = !{i32 1, !"wchar_size", i32 4} |
| 105 |
!9 = !{i32 7, !"frame-pointer", i32 2} |
| 106 |
!10 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !11, file: !11, line: 29, type: !12, scopeLine: 29, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !4) |
| 107 |
!11 = !DIFile(filename: "bitfields-packed.cpp", directory: "/tmp") |
| 108 |
!12 = !DISubroutineType(cc: DW_CC_LLVM_SpirFunction, types: !13) |
| 109 |
!13 = !{!14, !14, !14} |
| 110 |
!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 111 |
!15 = !DILocalVariable(name: "a", arg: 1, scope: !10, file: !11, line: 29, type: !14) |
| 112 |
!16 = !DILocation(line: 29, column: 43, scope: !10) |
| 113 |
!17 = !DILocalVariable(name: "b", arg: 2, scope: !10, file: !11, line: 29, type: !14) |
| 114 |
!18 = !DILocation(line: 29, column: 50, scope: !10) |
| 115 |
; CHECK-LLVM: !DILocalVariable(name: "arr_bf1", {{.*}}, type: ![[#ARRAY_TYPE:]]) |
| 116 |
!19 = !DILocalVariable(name: "arr_bf1", scope: !10, file: !11, line: 33, type: !20) |
| 117 |
; CHECK-LLVM: ![[#ARRAY_TYPE]] = {{.*}}!DICompositeType(tag: DW_TAG_array_type, baseType: ![[#BITFIELD_STRUCT:]], {{.*}}) |
| 118 |
!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, size: 16, elements: !30) |
| 119 |
; CHECK-LLVM: ![[#BITFIELD_STRUCT]] = {{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "struct_bit_fields1", {{.*}}, identifier: "_ZTS18struct_bit_fields1") |
| 120 |
!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "struct_bit_fields1", file: !11, line: 19, size: 16, flags: DIFlagTypePassByValue, elements: !22, identifier: "_ZTS18struct_bit_fields1") |
| 121 |
!22 = !{!23, !25, !26, !27, !28, !29} |
| 122 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "a", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 3, flags: {{.*}}DIFlagBitField{{.*}}) |
| 123 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "b", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 3, offset: 3, flags: {{.*}}DIFlagBitField{{.*}}) |
| 124 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "c", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 3, offset: 6, flags: {{.*}}DIFlagBitField{{.*}}) |
| 125 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "d", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 3, offset: 9, flags: {{.*}}DIFlagBitField{{.*}}) |
| 126 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "e", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 3, offset: 12, flags: {{.*}}DIFlagBitField{{.*}}) |
| 127 |
; CHECK-LLVM-BITFIELD: !DIDerivedType(tag: DW_TAG_member, name: "f", scope: ![[#BITFIELD_STRUCT]], {{.*}}, size: 1, offset: 15, flags: {{.*}}DIFlagBitField{{.*}}) |
| 128 |
; CHECK-LLVM-NO-BITFIELD-NOT: DIFlagBitField |
| 129 |
!23 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !21, file: !11, line: 21, baseType: !24, size: 3, flags: DIFlagBitField, extraData: i64 0) |
| 130 |
!24 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) |
| 131 |
!25 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !21, file: !11, line: 22, baseType: !24, size: 3, offset: 3, flags: DIFlagBitField, extraData: i64 0) |
| 132 |
!26 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !21, file: !11, line: 23, baseType: !24, size: 3, offset: 6, flags: DIFlagBitField, extraData: i64 0) |
| 133 |
!27 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !21, file: !11, line: 24, baseType: !24, size: 3, offset: 9, flags: DIFlagBitField, extraData: i64 0) |
| 134 |
!28 = !DIDerivedType(tag: DW_TAG_member, name: "e", scope: !21, file: !11, line: 25, baseType: !24, size: 3, offset: 12, flags: DIFlagBitField, extraData: i64 0) |
| 135 |
!29 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !21, file: !11, line: 26, baseType: !24, size: 1, offset: 15, flags: DIFlagBitField, extraData: i64 0) |
| 136 |
!30 = !{!31} |
| 137 |
!31 = !DISubrange(count: 1) |
| 138 |
!32 = !DILocation(line: 33, column: 22, scope: !10) |
| 139 |
!33 = !DILocalVariable(name: "ans", scope: !10, file: !11, line: 35, type: !14) |
| 140 |
!34 = !DILocation(line: 35, column: 7, scope: !10) |
| 141 |
!35 = !DILocation(line: 36, column: 10, scope: !10) |
| 142 |
!36 = !DILocation(line: 36, column: 3, scope: !10) |