|
| 1 | +; RUN: llvm-as %s -o %t.bc |
| 2 | +; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV |
| 3 | +; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_cache_controls %t.bc -o %t.spv |
| 4 | +; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM |
| 5 | + |
| 6 | +; CHECK-SPIRV-DAG: Load {{[0-9]+}} {{[0-9]+}} [[LoadPtr:[0-9]+]] |
| 7 | +; CHECK-SPIRV-DAG: Store [[StorePtr:[0-9]+]] |
| 8 | + |
| 9 | +; CHECK-SPIRV-DAG: Decorate [[LoadPtr]] CacheControlLoadINTEL 0 1 |
| 10 | +; CHECK-SPIRV-DAG: Decorate [[LoadPtr]] CacheControlLoadINTEL 1 1 |
| 11 | +; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 0 1 |
| 12 | +; CHECK-SPIRV-DAG: Decorate [[StorePtr]] CacheControlStoreINTEL 1 2 |
| 13 | + |
| 14 | +; CHECK-LLVM: %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 1, !spirv.Decorations [[LoadMD:![0-9]+]] |
| 15 | +; CHECK-LLVM: load i32, ptr addrspace(1) %arrayidx, align 4 |
| 16 | + |
| 17 | +; CHECK-LLVM: %arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 0, !spirv.Decorations [[StoreMD:![0-9]+]] |
| 18 | +; CHECK-LLVM: store i32 %0, ptr addrspace(1) %arrayidx1, align 4 |
| 19 | + |
| 20 | +; CHECK-LLVM: [[LoadMD]] = !{[[CC0:![0-9]+]], [[CC1:![0-9]+]]} |
| 21 | +; CHECK-LLVM: [[CC0]] = !{i32 6442, i32 0, i32 1} |
| 22 | +; CHECK-LLVM: [[CC1]] = !{i32 6442, i32 1, i32 1} |
| 23 | + |
| 24 | +; CHECK-LLVM: [[StoreMD]] = !{[[CC2:![0-9]+]], [[CC3:![0-9]+]]} |
| 25 | +; CHECK-LLVM: [[CC2]] = !{i32 6443, i32 0, i32 1} |
| 26 | +; CHECK-LLVM: [[CC3]] = !{i32 6443, i32 1, i32 2} |
| 27 | + |
| 28 | +target triple = "spir64-unknown-unknown" |
| 29 | + |
| 30 | +define spir_kernel void @test(ptr addrspace(1) %buffer) { |
| 31 | +entry: |
| 32 | + %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 1, !spirv.Decorations !3 |
| 33 | + %0 = load i32, ptr addrspace(1) %arrayidx, align 4 |
| 34 | + %arrayidx1 = getelementptr inbounds i32, ptr addrspace(1) %buffer, i64 0, !spirv.Decorations !6 |
| 35 | + store i32 %0, ptr addrspace(1) %arrayidx1, align 4 |
| 36 | + ret void |
| 37 | +} |
| 38 | + |
| 39 | +!spirv.MemoryModel = !{!0} |
| 40 | +!spirv.Source = !{!1} |
| 41 | +!opencl.spir.version = !{!2} |
| 42 | +!opencl.ocl.version = !{!2} |
| 43 | + |
| 44 | +!0 = !{i32 2, i32 2} |
| 45 | +!1 = !{i32 3, i32 102000} |
| 46 | +!2 = !{i32 1, i32 2} |
| 47 | +!3 = !{!4, !5} |
| 48 | +!4 = !{i32 6442, i32 0, i32 1} ; {CacheControlLoadINTEL, CacheLevel=0, Cached} |
| 49 | +!5 = !{i32 6442, i32 1, i32 1} ; {CacheControlLoadINTEL, CacheLevel=1, Cached} |
| 50 | +!6 = !{!7, !8} |
| 51 | +!7 = !{i32 6443, i32 0, i32 1} ; {CacheControlStoreINTEL, CacheLevel=0, WriteThrough} |
| 52 | +!8 = !{i32 6443, i32 1, i32 2} ; {CacheControlStoreINTEL, CacheLevel=1, WriteBack} |
0 commit comments