| 1 |
; UNSUPPORTED: system-windows |
| 2 |
; TODO: Fix spirv.Decorations missing after spirv-translator promotion |
| 3 |
; REQUIRES: llvm-spirv, regkeys, dg2-supported, decorators-fix |
| 4 |
|
| 5 |
; RUN: llvm-as %s -o %t.bc |
| 6 |
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_cache_controls -o %t.spv |
| 7 |
; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=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-unknown-unknown" |
| 11 |
|
| 12 |
$_ZTSZ4mainEUlvE_ = comdat any |
| 13 |
|
| 14 |
; https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_cache_controls.asciidoc |
| 15 |
; These strings are: |
| 16 |
; {CacheControlLoadINTEL_Token:\22CacheLevel,CacheControl\22} |
| 17 |
@.str.1 = private unnamed_addr addrspace(1) constant [16 x i8] c"../prefetch.hpp\00", section "llvm.metadata" |
| 18 |
@.str.9 = private unnamed_addr addrspace(1) constant [13 x i8] c"{6442:\220,1\22}\00", section "llvm.metadata" |
| 19 |
@.str.10 = private unnamed_addr addrspace(1) constant [13 x i8] c"{6442:\221,1\22}\00", section "llvm.metadata" |
| 20 |
@.str.11 = private unnamed_addr addrspace(1) constant [13 x i8] c"{6442:\222,3\22}\00", section "llvm.metadata" |
| 21 |
|
| 22 |
; these CHECK-SPIRV check that prefetch's arg is decorated with the appropriate |
| 23 |
; CacheLevel and CacheControl values. |
| 24 |
|
| 25 |
; Check that the appropriate !spirv.Decorations are preserved after reverse |
| 26 |
; translation |
| 27 |
|
| 28 |
; CHECK-LLVM: %[[CALL1:.*]] = call spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobal{{.*}} |
| 29 |
; CHECK-LLVM: %[[CALL1P4:.*]] = addrspacecast i8 addrspace(1)* %[[CALL1]] to i8 addrspace(4)*, !spirv.Decorations ![[MD:.*]] |
| 30 |
; CHECK-LLVM: call spir_func void @_Z20__spirv_ocl_prefetch{{.*}}(i8 addrspace(4)* %[[CALL1P4]], i64 1) |
| 31 |
; CHECK-LLVM: %[[CALL2:.*]] = call spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobal{{.*}} |
| 32 |
; CHECK-LLVM: %[[CALL2P4:.*]] = addrspacecast i8 addrspace(1)* %[[CALL2]] to i8 addrspace(4)*, !spirv.Decorations ![[MD]] |
| 33 |
; CHECK-LLVM: call spir_func void @_Z20__spirv_ocl_prefetch{{.*}}(i8 addrspace(4)* %[[CALL2P4]], i64 1) |
| 34 |
; CHECK-LLVM: %[[CALL3:.*]] = call spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobal{{.*}} |
| 35 |
; CHECK-LLVM: %[[CALL3P4:.*]] = addrspacecast i8 addrspace(1)* %[[CALL3]] to i8 addrspace(4)*, !spirv.Decorations ![[MD]] |
| 36 |
; CHECK-LLVM: call spir_func void @_Z20__spirv_ocl_prefetch{{.*}}(i8 addrspace(4)* %[[CALL3P4]], i64 2) |
| 37 |
|
| 38 |
|
| 39 |
; Function Attrs: convergent norecurse nounwind |
| 40 |
define weak_odr dso_local spir_kernel void @_ZTSZ4mainEUlvE_(i8 addrspace(1)* noundef align 1 %_arg_dataPtr) local_unnamed_addr comdat !srcloc !5 !kernel_arg_buffer_location !6 !sycl_fixed_targets !7 !sycl_kernel_omit_args !8 { |
| 41 |
entry: |
| 42 |
%0 = addrspacecast i8 addrspace(1)* %_arg_dataPtr to i8 addrspace(4)* |
| 43 |
%call.i.i.i.i = tail call spir_func noundef i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPvi(i8 addrspace(4)* noundef %0, i32 noundef 5) |
| 44 |
%call.i.i.i.i.p4 = addrspacecast i8 addrspace(1)* %call.i.i.i.i to i8 addrspace(4)* |
| 45 |
%ptr1 = getelementptr inbounds [13 x i8], [13 x i8] addrspace(1)* @.str.9, i64 0, i64 0 |
| 46 |
%ptr2 = getelementptr inbounds [16 x i8], [16 x i8] addrspace(1)* @.str.1, i64 0, i64 0 |
| 47 |
%ptr1.p4 = addrspacecast i8 addrspace(1)* %ptr1 to i8 addrspace(4)* |
| 48 |
%ptr1.p0 = addrspacecast i8 addrspace(4)* %ptr1.p4 to i8* |
| 49 |
%ptr2.p4 = addrspacecast i8 addrspace(1)* %ptr2 to i8 addrspace(4)* |
| 50 |
%ptr2.p0 = addrspacecast i8 addrspace(4)* %ptr2.p4 to i8* |
| 51 |
%1 = tail call i8 addrspace(4)* @llvm.ptr.annotation.p4.p1(i8 addrspace(4)* %call.i.i.i.i.p4, i8* %ptr1.p0, i8* %ptr2.p0, i32 76) |
| 52 |
tail call spir_func void @_Z20__spirv_ocl_prefetchPU3AS1Kcm(i8 addrspace(4)* noundef %1, i64 noundef 1) |
| 53 |
%arrayidx3.i = getelementptr inbounds i8, i8 addrspace(4)* %0, i64 1 |
| 54 |
%call.i.i.i13.i = tail call spir_func noundef i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPvi(i8 addrspace(4)* noundef %arrayidx3.i, i32 noundef 5) |
| 55 |
%call.i.i.i13.i.p4 = addrspacecast i8 addrspace(1)* %call.i.i.i13.i to i8 addrspace(4)* |
| 56 |
%ptr3 = getelementptr inbounds [13 x i8], [13 x i8] addrspace(1)* @.str.10, i64 0, i64 0 |
| 57 |
%ptr3.p4 = addrspacecast i8 addrspace(1)* %ptr3 to i8 addrspace(4)* |
| 58 |
%ptr3.p0 = addrspacecast i8 addrspace(4)* %ptr3.p4 to i8* |
| 59 |
%2 = tail call i8 addrspace(4)* @llvm.ptr.annotation.p4.p1(i8 addrspace(4)* %call.i.i.i13.i.p4, i8* %ptr3.p0, i8* %ptr2.p0, i32 80) |
| 60 |
tail call spir_func void @_Z20__spirv_ocl_prefetchPU3AS1Kcm(i8 addrspace(4)* noundef %2, i64 noundef 1) |
| 61 |
%arrayidx7.i = getelementptr inbounds i8, i8 addrspace(4)* %0, i64 2 |
| 62 |
%call.i.i.i16.i = tail call spir_func noundef i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPvi(i8 addrspace(4)* noundef %arrayidx7.i, i32 noundef 5) |
| 63 |
%call.i.i.i16.i.p4 = addrspacecast i8 addrspace(1)* %call.i.i.i16.i to i8 addrspace(4)* |
| 64 |
%ptr4 = getelementptr inbounds [13 x i8], [13 x i8] addrspace(1)* @.str.11, i64 0, i64 0 |
| 65 |
%ptr4.p4 = addrspacecast i8 addrspace(1)* %ptr4 to i8 addrspace(4)* |
| 66 |
%ptr4.p0 = addrspacecast i8 addrspace(4)* %ptr4.p4 to i8* |
| 67 |
%3 = tail call i8 addrspace(4)* @llvm.ptr.annotation.p4.p1(i8 addrspace(4)* %call.i.i.i16.i.p4, i8* %ptr4.p0, i8* %ptr2.p0, i32 80) |
| 68 |
tail call spir_func void @_Z20__spirv_ocl_prefetchPU3AS1Kcm(i8 addrspace(4)* noundef %3, i64 noundef 2) |
| 69 |
ret void |
| 70 |
} |
| 71 |
|
| 72 |
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) |
| 73 |
declare i8 addrspace(4)* @llvm.ptr.annotation.p4.p1(i8 addrspace(4)*, i8*, i8*, i32) |
| 74 |
|
| 75 |
; Function Attrs: convergent nounwind |
| 76 |
declare dso_local spir_func void @_Z20__spirv_ocl_prefetchPU3AS1Kcm(i8 addrspace(4)* noundef, i64 noundef) local_unnamed_addr |
| 77 |
|
| 78 |
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none) |
| 79 |
declare dso_local spir_func noundef i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPvi(i8 addrspace(4)* noundef, i32 noundef) local_unnamed_addr |
| 80 |
|
| 81 |
!llvm.module.flags = !{!0, !1} |
| 82 |
!opencl.spir.version = !{!2} |
| 83 |
!spirv.Source = !{!3} |
| 84 |
!llvm.ident = !{!4} |
| 85 |
|
| 86 |
; CHECK-LLVM: ![[MD]] = !{![[MD1:.*]]} |
| 87 |
; CHECK-LLVM: ![[MD1]] = !{i32 5635, !""} |
| 88 |
|
| 89 |
!0 = !{i32 1, !"wchar_size", i32 4} |
| 90 |
!1 = !{i32 7, !"frame-pointer", i32 2} |
| 91 |
!2 = !{i32 1, i32 2} |
| 92 |
!3 = !{i32 4, i32 100000} |
| 93 |
!4 = !{!"clang version 18.0.0"} |
| 94 |
!5 = !{i32 1522} |
| 95 |
!6 = !{i32 -1} |
| 96 |
!7 = !{} |
| 97 |
!8 = !{i1 false} |