|
| 1 | +; REQUIRES: spirv-as |
| 2 | +; RUN: spirv-as --target-env spv1.0 -o %t.spv %s |
| 3 | +; RUN: spirv-val %t.spv |
| 4 | +; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s |
| 5 | + OpCapability Addresses |
| 6 | + OpCapability Linkage |
| 7 | + OpCapability Kernel |
| 8 | + OpCapability ImageBasic |
| 9 | + OpExtension "SPV_EXT_image_raw10_raw12" |
| 10 | + OpMemoryModel Physical32 OpenCL |
| 11 | + |
| 12 | + OpDecorate %test_raw1012 LinkageAttributes "test_raw1012" Export |
| 13 | + OpDecorate %dst FuncParamAttr NoCapture |
| 14 | + OpDecorate %dst Alignment 4 |
| 15 | + |
| 16 | + %uint = OpTypeInt 32 0 |
| 17 | + %uint_12 = OpConstant %uint 12 |
| 18 | + %uint_10 = OpConstant %uint 10 |
| 19 | + %uint_8 = OpConstant %uint 8 |
| 20 | + %void = OpTypeVoid |
| 21 | + %_ptr_uint = OpTypePointer CrossWorkgroup %uint |
| 22 | + %5 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly |
| 23 | + %6 = OpTypeFunction %void %_ptr_uint %5 |
| 24 | + |
| 25 | +%test_raw1012 = OpFunction %void None %6 |
| 26 | + %dst = OpFunctionParameter %_ptr_uint |
| 27 | + %img = OpFunctionParameter %5 |
| 28 | + %entry = OpLabel |
| 29 | + %15 = OpImageQueryFormat %uint %img |
| 30 | + OpSwitch %15 %sw_epilog 0 %sw_epilog_sink_split 19 %sw_bb1 20 %sw_bb2 |
| 31 | + %sw_bb1 = OpLabel |
| 32 | + OpBranch %sw_epilog_sink_split |
| 33 | + %sw_bb2 = OpLabel |
| 34 | + OpBranch %sw_epilog_sink_split |
| 35 | +%sw_epilog_sink_split = OpLabel |
| 36 | + %_sink = OpPhi %uint %uint_12 %sw_bb2 %uint_10 %sw_bb1 %uint_8 %entry |
| 37 | + OpStore %dst %_sink Aligned 4 |
| 38 | + OpBranch %sw_epilog |
| 39 | + %sw_epilog = OpLabel |
| 40 | + OpReturn |
| 41 | + OpFunctionEnd |
| 42 | + |
| 43 | +; CHECK: %[[#datatype:]] = call spir_func i32 @_Z27get_image_channel_data_type14ocl_image2d_ro |
| 44 | +; CHECK-NEXT: %[[#sub:]] = sub i32 %[[#datatype]], 4304 |
| 45 | +; CHECK-NEXT: switch i32 %[[#sub]] |
| 46 | +; CHECK-NEXT: i32 0, label |
| 47 | +; CHECK-NEXT: i32 19, label |
| 48 | +; CHECK-NEXT: i32 20, label |
0 commit comments