| 1 |
; RUN: llvm-as %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 3 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc |
| 4 |
; RUN: llvm-dis < %t.rev.bc | FileCheck %s |
| 5 |
|
| 6 |
source_filename = "the_file.ll" |
| 7 |
target triple = "spir64-unknown-unknown" |
| 8 |
|
| 9 |
; Function Attrs: nounwind |
| 10 |
define spir_func i1 @trunc_to_i1(i32 %iarg) #0 !dbg !7 { |
| 11 |
; CHECK: @trunc_to_i1(i32 %iarg) #[[#]] !dbg ![[#]] { |
| 12 |
; CHECK-NEXT: !dbg ![[#TRUNC_LINE:]] |
| 13 |
; CHECK-NEXT: !dbg ![[#TRUNC_LINE]] |
| 14 |
; CHECK-NEXT: ret i1 %res, !dbg ![[#TRUNC_RET_LINE:]] |
| 15 |
%res = trunc i32 %iarg to i1, !dbg !9 |
| 16 |
ret i1 %res, !dbg !10 |
| 17 |
} |
| 18 |
|
| 19 |
; Function Attrs: nounwind |
| 20 |
define spir_func i32 @sext_from_i1(i1 %barg) #0 !dbg !11 { |
| 21 |
; CHECK: @sext_from_i1(i1 %barg) #[[#]] !dbg ![[#]] { |
| 22 |
; CHECK-NEXT: !dbg ![[#SEXT_LINE:]] |
| 23 |
; CHECK: ret i32 %res, !dbg ![[#SEXT_RET_LINE:]] |
| 24 |
%res = sext i1 %barg to i32, !dbg !12 |
| 25 |
ret i32 %res, !dbg !13 |
| 26 |
} |
| 27 |
|
| 28 |
; Function Attrs: nounwind |
| 29 |
define spir_func i32 @zext_from_i1(i1 %barg) #0 !dbg !14 { |
| 30 |
; CHECK: @zext_from_i1(i1 %barg) #[[#]] !dbg ![[#]] { |
| 31 |
; CHECK-NEXT: !dbg ![[#ZEXT_LINE:]] |
| 32 |
; CHECK: ret i32 %res, !dbg ![[#ZEXT_RET_LINE:]] |
| 33 |
%res = zext i1 %barg to i32, !dbg !15 |
| 34 |
ret i32 %res, !dbg !16 |
| 35 |
} |
| 36 |
|
| 37 |
; Function Attrs: nounwind |
| 38 |
define spir_func float @sitofp_b(i1 %barg) #0 !dbg !17 { |
| 39 |
; CHECK: @sitofp_b(i1 %barg) #[[#]] !dbg ![[#]] { |
| 40 |
; CHECK-NEXT: !dbg ![[#SITOFP_LINE:]] |
| 41 |
; CHECK-NEXT: !dbg ![[#SITOFP_LINE]] |
| 42 |
; CHECK: ret float %res, !dbg ![[#SITOFP_RET_LINE:]] |
| 43 |
%res = sitofp i1 %barg to float, !dbg !18 |
| 44 |
ret float %res, !dbg !19 |
| 45 |
} |
| 46 |
|
| 47 |
; Function Attrs: nounwind |
| 48 |
define spir_func float @uitofp_b(i1 %barg) #0 !dbg !20 { |
| 49 |
; CHECK: @uitofp_b(i1 %barg) #[[#]] !dbg ![[#]] { |
| 50 |
; CHECK-NEXT: !dbg ![[#UITOFP_LINE:]] |
| 51 |
; CHECK-NEXT: !dbg ![[#UITOFP_LINE]] |
| 52 |
; CHECK: ret float %res, !dbg ![[#UITOFP_RET_LINE:]] |
| 53 |
%res = uitofp i1 %barg to float, !dbg !21 |
| 54 |
ret float %res, !dbg !22 |
| 55 |
} |
| 56 |
|
| 57 |
; CHECK-DAG: ![[#TRUNC_LINE]] = !DILocation(line: 1, column: 1 |
| 58 |
; CHECK-DAG: ![[#TRUNC_RET_LINE]] = !DILocation(line: 2, column: 1 |
| 59 |
|
| 60 |
; CHECK-DAG: ![[#SEXT_LINE]] = !DILocation(line: 3, column: 1 |
| 61 |
; CHECK-DAG: ![[#SEXT_RET_LINE]] = !DILocation(line: 4, column: 1 |
| 62 |
|
| 63 |
; CHECK-DAG: ![[#ZEXT_LINE]] = !DILocation(line: 5, column: 1 |
| 64 |
; CHECK-DAG: ![[#ZEXT_RET_LINE]] = !DILocation(line: 6, column: 1 |
| 65 |
|
| 66 |
; CHECK-DAG: ![[#SITOFP_LINE]] = !DILocation(line: 7, column: 1 |
| 67 |
; CHECK-DAG: ![[#SITOFP_RET_LINE]] = !DILocation(line: 8, column: 1 |
| 68 |
|
| 69 |
; CHECK-DAG: ![[#UITOFP_LINE]] = !DILocation(line: 9, column: 1 |
| 70 |
; CHECK-DAG: ![[#UITOFP_RET_LINE]] = !DILocation(line: 10, column: 1 |
| 71 |
|
| 72 |
attributes #0 = { nounwind } |
| 73 |
|
| 74 |
!llvm.dbg.cu = !{!2} |
| 75 |
!llvm.debugify = !{!4, !5} |
| 76 |
!llvm.module.flags = !{!6} |
| 77 |
|
| 78 |
!0 = !{i32 1, i32 2} |
| 79 |
!1 = !{} |
| 80 |
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) |
| 81 |
!3 = !DIFile(filename: "the_file.ll", directory: "", checksumkind: CSK_MD5, checksum: "18aa9ce738eaafc7b7b7181c19092815") |
| 82 |
!4 = !{i32 10} |
| 83 |
!5 = !{i32 0} |
| 84 |
!6 = !{i32 2, !"Debug Info Version", i32 3} |
| 85 |
!7 = distinct !DISubprogram(name: "trunc_to_i1", scope: !3, file: !3, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !1) |
| 86 |
!8 = !DISubroutineType(types: !1) |
| 87 |
!9 = !DILocation(line: 1, column: 1, scope: !7) |
| 88 |
!10 = !DILocation(line: 2, column: 1, scope: !7) |
| 89 |
!11 = distinct !DISubprogram(name: "sext_from_i1", scope: !3, file: !3, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !1) |
| 90 |
!12 = !DILocation(line: 3, column: 1, scope: !11) |
| 91 |
!13 = !DILocation(line: 4, column: 1, scope: !11) |
| 92 |
!14 = distinct !DISubprogram(name: "zext_from_i1", scope: !3, file: !3, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped , spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !1) |
| 93 |
!15 = !DILocation(line: 5, column: 1, scope: !14) |
| 94 |
!16 = !DILocation(line: 6, column: 1, scope: !14) |
| 95 |
!17 = distinct !DISubprogram(name: "sitofp_b", scope: !3, file: !3, line: 7, type: !8, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !1) |
| 96 |
!18 = !DILocation(line: 7, column: 1, scope: !17) |
| 97 |
!19 = !DILocation(line: 8, column: 1, scope: !17) |
| 98 |
!20 = distinct !DISubprogram(name: "uitofp_b", scope: !3, file: !3, line: 9, type: !8, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !1) |
| 99 |
!21 = !DILocation(line: 9, column: 1, scope: !20) |
| 100 |
!22 = !DILocation(line: 10, column: 1, scope: !20) |