|
| 1 | +; RUN: llvm-as %s -o %t.bc |
| 2 | +; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 | +; RUN: llvm-spirv %t.spv -to-text -o %t.spt |
| 4 | +; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV |
| 5 | +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 6 | +; RUN: llvm-dis %t.rev.bc |
| 7 | +; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM |
| 8 | + |
| 9 | +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" |
| 10 | +target triple = "spir64" |
| 11 | + |
| 12 | +define linkonce_odr hidden spir_func void @foo() { |
| 13 | +entry: |
| 14 | +; CHECK-SPIRV-DAG: Constant [[#]] [[#CONSTANT1:]] 65793 |
| 15 | +; CHECK-SPIRV-DAG: Constant [[#]] [[#CONSTANT2:]] 131586 |
| 16 | + |
| 17 | +; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS0:]] [[#CONSTANT1]] |
| 18 | +; 124 is OpBitcast opcode |
| 19 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES0:]] 124 [[#COMPOS0]] |
| 20 | + |
| 21 | +; 81 is OpCompositeExtract opcode |
| 22 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES0:]] 81 [[#BITCAST_RES0]] 0 |
| 23 | +; CHECK-SPIRV: ConstantComposite [[#]] [[#COMPOS1:]] [[#CONSTANT2]] |
| 24 | + |
| 25 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES1:]] 124 [[#COMPOS1]] |
| 26 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES1:]] 81 [[#BITCAST_RES1]] 0 |
| 27 | +; 129 is OpFAdd opcode |
| 28 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_1:]] 129 [[#EXTRACT_RES0:]] [[#EXTRACT_RES1]] |
| 29 | + |
| 30 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES2:]] 81 [[#BITCAST_RES0]] 1 |
| 31 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#EXTRACT_RES3:]] 81 [[#BITCAST_RES1]] 1 |
| 32 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_2:]] 129 [[#EXTRACT_RES2]] [[#EXTRACT_RES3]] |
| 33 | + |
| 34 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES2:]] 81 [[#BITCAST_RES0]] 2 |
| 35 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#BITCAST_RES2:]] 81 [[#BITCAST_RES1]] 2 |
| 36 | +; CHECK-SPIRV: SpecConstantOp [[#]] [[#MEMBER_3:]] 129 [[#]] [[#BITCAST_RES2]] |
| 37 | + |
| 38 | +; CHECK-SPIRV: Undef [[#]] [[#MEMBER_4:]] |
| 39 | +; CHECK-SPIRV: ConstantComposite [[#]] [[#FINAL_COMPOS:]] [[#MEMBER_1]] [[#MEMBER_2]] [[#MEMBER_3]] [[#MEMBER_4]] |
| 40 | +; CHECK-SPIRV: DebugValue [[#]] [[#FINAL_COMPOS]] |
| 41 | + |
| 42 | +; CHECK-LLVM: call void @llvm.dbg.value( |
| 43 | +; CHECK-LLVM-SAME: metadata <4 x half> < |
| 44 | +; CHECK-LLVM-SAME: half fadd ( |
| 45 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 0), |
| 46 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 0)), |
| 47 | +; CHECK-LLVM-SAME: half fadd ( |
| 48 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 1), |
| 49 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 1)), |
| 50 | +; CHECK-LLVM-SAME: half fadd ( |
| 51 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 2), |
| 52 | +; CHECK-LLVM-SAME: half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 2)), |
| 53 | +; CHECK-LLVM-SAME: half undef>, |
| 54 | +; CHECK-LLVM-SAME: metadata ![[#]], metadata !DIExpression()), !dbg ![[#]] |
| 55 | + call void @llvm.dbg.value( |
| 56 | + metadata <4 x half> < |
| 57 | + half fadd ( |
| 58 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 0), |
| 59 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 0)), |
| 60 | + half fadd ( |
| 61 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 1), |
| 62 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 1)), |
| 63 | + half fadd ( |
| 64 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 65793, i32 65793> to <4 x half>), i32 2), |
| 65 | + half extractelement (<4 x half> bitcast (<2 x i32> <i32 131586, i32 131586> to <4 x half>), i32 2)), |
| 66 | + half undef>, |
| 67 | + metadata !12, metadata !DIExpression()), !dbg !7 |
| 68 | + ret void |
| 69 | +} |
| 70 | + |
| 71 | +; Function Attrs: nofree nosync nounwind readnone speculatable willreturn |
| 72 | +declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 73 | + |
| 74 | +!llvm.dbg.cu = !{!0} |
| 75 | +!llvm.module.flags = !{!3, !4} |
| 76 | +!opencl.used.extensions = !{!2} |
| 77 | +!opencl.used.optional.core.features = !{!2} |
| 78 | +!opencl.compiler.options = !{!2} |
| 79 | +!llvm.ident = !{!5} |
| 80 | + |
| 81 | +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/intel/llvm.git)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) |
| 82 | +!1 = !DIFile(filename: "main.cpp", directory: "/export/users") |
| 83 | +!2 = !{} |
| 84 | +!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 85 | +!4 = !{i32 1, !"wchar_size", i32 4} |
| 86 | +!5 = !{!"clang version 13.0.0"} |
| 87 | +!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) |
| 88 | +!7 = !DILocation(line: 1, scope: !6, inlinedAt: !11) |
| 89 | +!8 = !DISubroutineType(types: !9) |
| 90 | +!9 = !{!10} |
| 91 | +!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 92 | +!11 = !DILocation(line: 1, column: 0, scope: !6) |
| 93 | +!12 = !DILocalVariable(name: "resVec", scope: !6, file: !1, line: 1, type: !13) |
| 94 | +!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "vec<cl::sycl::detail::half_impl::half, 3>", scope: !6, file: !1, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !2) |
0 commit comments