| 1 |
; Adapted from https://github.com/KhronosGroup/SPIRV-LLVM-Translator/tree/main/test/extensions/INTEL/SPV_INTEL_cache_controls |
| 2 |
|
| 3 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_cache_controls %s -o - | FileCheck %s --check-prefixes=CHECK-SPIRV |
| 4 |
; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_cache_controls %s -o - -filetype=obj | spirv-val %} |
| 5 |
|
| 6 |
; CHECK-SPIRV: Capability CacheControlsINTEL |
| 7 |
; CHECK-SPIRV: Extension "SPV_INTEL_cache_controls" |
| 8 |
; CHECK-SPIRV-DAG: OpName %[[#GVar:]] "G" |
| 9 |
; CHECK-SPIRV-DAG: OpName %[[#Arg:]] "buffer" |
| 10 |
; CHECK-SPIRV-DAG: OpDecorate %[[#GVar]] CacheControlStoreINTEL 0 1 |
| 11 |
; CHECK-SPIRV-DAG: OpDecorate %[[#GVar]] CacheControlStoreINTEL 1 3 |
| 12 |
; CHECK-SPIRV-DAG: OpDecorate %[[#Arg]] CacheControlLoadINTEL 0 0 |
| 13 |
; CHECK-SPIRV-DAG: OpDecorate %[[#Arg]] CacheControlStoreINTEL 0 1 |
| 14 |
; CHECK-SPIRV-DAG: OpDecorate %[[#LoadPtr:]] CacheControlLoadINTEL 0 1 |
| 15 |
; CHECK-SPIRV-DAG: OpDecorate %[[#LoadPtr]] CacheControlLoadINTEL 1 1 |
| 16 |
; CHECK-SPIRV-DAG: OpDecorate %[[#StorePtr:]] CacheControlStoreINTEL 0 1 |
| 17 |
; CHECK-SPIRV-DAG: OpDecorate %[[#StorePtr]] CacheControlStoreINTEL 1 2 |
| 18 |
; CHECK-SPIRV: OpLoad %[[#]] %[[#LoadPtr]] |
| 19 |
; CHECK-SPIRV: OpStore %[[#StorePtr]] %[[#]] |
| 20 |
|
| 21 |
@G = common addrspace(1) global i32 0, align 4, !spirv.Decorations !9 |
| 22 |
|
| 23 |
define spir_kernel void @test(ptr addrspace(1) %dummy, ptr addrspace(1) %buffer) !spirv.ParameterDecorations !12 { |
| 24 |
entry: |
| 25 |
%arrayidx = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 1, !spirv.Decorations !3 |
| 26 |
%0 = load i32, ptr addrspace(1) %arrayidx, align 4 |
| 27 |
%arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 0, !spirv.Decorations !6 |
| 28 |
store i32 %0, ptr addrspace(1) %arrayidx1, align 4 |
| 29 |
ret void |
| 30 |
} |
| 31 |
|
| 32 |
!spirv.MemoryModel = !{!0} |
| 33 |
!spirv.Source = !{!1} |
| 34 |
!opencl.spir.version = !{!2} |
| 35 |
!opencl.ocl.version = !{!2} |
| 36 |
|
| 37 |
!0 = !{i32 2, i32 2} |
| 38 |
!1 = !{i32 3, i32 102000} |
| 39 |
!2 = !{i32 1, i32 2} |
| 40 |
!3 = !{!4, !5} |
| 41 |
!4 = !{i32 6442, i32 0, i32 1} ; {CacheControlLoadINTEL, CacheLevel=0, Cached} |
| 42 |
!5 = !{i32 6442, i32 1, i32 1} ; {CacheControlLoadINTEL, CacheLevel=1, Cached} |
| 43 |
!6 = !{!7, !8} |
| 44 |
!7 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} |
| 45 |
!8 = !{i32 6443, i32 1, i32 2} ; {CacheControlStoreINTEL, CacheLevel=1, WriteBack} |
| 46 |
!9 = !{!10, !11} |
| 47 |
!10 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} |
| 48 |
!11 = !{i32 6443, i32 1, i32 3} ; {CacheControlStoreINTEL, CacheLevel=1, Streaming} |
| 49 |
!12 = !{!13, !14} |
| 50 |
!13 = !{} |
| 51 |
!14 = !{!15, !16} |
| 52 |
!15 = !{i32 6442, i32 0, i32 0} ; {CacheControlLoadINTEL, CacheLevel=0, Uncached} |
| 53 |
!16 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} |