|
| 1 | +; Tests the Nontemporal image operand that was added for SPIR-V 1.6. |
| 2 | + |
| 3 | +; REQUIRES: spirv-as |
| 4 | +; RUN: spirv-as --target-env spv1.6 -o %t.spv %s |
| 5 | +; RUN: spirv-val %t.spv |
| 6 | +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 | +; RUN: llvm-dis %t.rev.bc |
| 8 | +; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM |
| 9 | + |
| 10 | + OpCapability Addresses |
| 11 | + OpCapability Kernel |
| 12 | + OpCapability ImageBasic |
| 13 | + OpCapability LiteralSampler |
| 14 | + OpMemoryModel Physical64 OpenCL |
| 15 | + OpEntryPoint Kernel %kernel "read_write_image_nontemporal" |
| 16 | + %uint = OpTypeInt 32 0 |
| 17 | + %void = OpTypeVoid |
| 18 | + %read_image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly |
| 19 | +%write_image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown WriteOnly |
| 20 | + %sampler_t = OpTypeSampler |
| 21 | + %kernel_sig = OpTypeFunction %void %read_image2d_t %write_image2d_t |
| 22 | +%sampledimage_t = OpTypeSampledImage %read_image2d_t |
| 23 | + %v2uint = OpTypeVector %uint 2 |
| 24 | + %float = OpTypeFloat 32 |
| 25 | + %v4float = OpTypeVector %float 4 |
| 26 | + %sampler = OpConstantSampler %sampler_t None 0 Nearest |
| 27 | + %coord_0_0 = OpConstantNull %v2uint |
| 28 | + %float_0 = OpConstant %float 0 |
| 29 | + %kernel = OpFunction %void None %kernel_sig |
| 30 | + %src = OpFunctionParameter %read_image2d_t |
| 31 | + %dst = OpFunctionParameter %write_image2d_t |
| 32 | + %entry = OpLabel |
| 33 | + %si = OpSampledImage %sampledimage_t %src %sampler |
| 34 | + %data0 = OpImageSampleExplicitLod %v4float %si %coord_0_0 Lod %float_0 |
| 35 | + OpImageWrite %dst %coord_0_0 %data0 |
| 36 | + %data1 = OpImageSampleExplicitLod %v4float %si %coord_0_0 Lod|Nontemporal %float_0 |
| 37 | + OpImageWrite %dst %coord_0_0 %data1 Nontemporal |
| 38 | + OpReturn |
| 39 | + OpFunctionEnd |
| 40 | + |
| 41 | +; CHECK-LLVM: define spir_kernel void @read_write_image_nontemporal |
| 42 | +; CHECK-LLVM: call spir_func <4 x float> [[READ_IMAGEF:@[a-zA-Z0-9_]+]]( |
| 43 | +; CHECK-LLVM: call spir_func void [[WRITE_IMAGEF:@[a-zA-Z0-9_]+]]( |
| 44 | +; CHECK-LLVM: call spir_func <4 x float> [[READ_IMAGEF]]( |
| 45 | +; CHECK-LLVM: call spir_func void [[WRITE_IMAGEF]]( |
0 commit comments