| 1 |
;Source: |
| 2 |
;void __kernel test(float2 x, uint c, |
| 3 |
; read_only image2d_t image_in, |
| 4 |
; write_only image2d_t image_out, |
| 5 |
; int2 coord, |
| 6 |
; __global uint* p, |
| 7 |
; __global ushort* sp, |
| 8 |
; __global uchar* cp, |
| 9 |
; __global ulong* lp) { |
| 10 |
; intel_sub_group_shuffle(x, c); |
| 11 |
; intel_sub_group_shuffle_down(x, x, c); |
| 12 |
; intel_sub_group_shuffle_up(x, x, c); |
| 13 |
; intel_sub_group_shuffle_xor(x, c); |
| 14 |
; |
| 15 |
; uint2 ui2 = intel_sub_group_block_read2(image_in, coord); |
| 16 |
; intel_sub_group_block_write2(image_out, coord, ui2); |
| 17 |
; ui2 = intel_sub_group_block_read2(p); |
| 18 |
; intel_sub_group_block_write2(p, ui2); |
| 19 |
; |
| 20 |
; ushort2 us2 = intel_sub_group_block_read_us2(image_in, coord); |
| 21 |
; intel_sub_group_block_write_us2(image_out, coord, us2); |
| 22 |
; us2 = intel_sub_group_block_read_us2(sp); |
| 23 |
; intel_sub_group_block_write_us2(sp, us2); |
| 24 |
; |
| 25 |
; uchar2 uc2 = intel_sub_group_block_read_uc2(image_in, coord); |
| 26 |
; intel_sub_group_block_write_uc2(image_out, coord, uc2); |
| 27 |
; uc2 = intel_sub_group_block_read_uc2(cp); |
| 28 |
; intel_sub_group_block_write_uc2(cp, uc2); |
| 29 |
; |
| 30 |
; ulong2 ul2 = intel_sub_group_block_read_ul2(image_in, coord); |
| 31 |
; intel_sub_group_block_write_ul2(image_out, coord, ul2); |
| 32 |
; ul2 = intel_sub_group_block_read_ul2(lp); |
| 33 |
; intel_sub_group_block_write_ul2(lp, ul2); |
| 34 |
;} |
| 35 |
|
| 36 |
; UNSUPPORTED: system-windows |
| 37 |
; REQUIRES: llvm-spirv, regkeys, dg2-supported |
| 38 |
|
| 39 |
; RUN: llvm-as %s -o %t.bc |
| 40 |
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_subgroups -o %t.spv |
| 41 |
; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM |
| 42 |
|
| 43 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 44 |
target triple = "spir64" |
| 45 |
|
| 46 |
%opencl.image2d_ro_t = type opaque |
| 47 |
%opencl.image2d_wo_t = type opaque |
| 48 |
|
| 49 |
; LLVM checks were generated by update_test_checks.py using opt without any passes. |
| 50 |
; Function Attrs: convergent nounwind |
| 51 |
define spir_kernel void @test(<2 x float> %x, i32 %c, %opencl.image2d_ro_t addrspace(1)* %image_in, %opencl.image2d_wo_t addrspace(1)* %image_out, <2 x i32> %coord, i32 addrspace(1)* %p, i16 addrspace(1)* %sp, i8 addrspace(1)* %cp, i64 addrspace(1)* %lp) local_unnamed_addr #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 !kernel_arg_name !6 { |
| 52 |
; CHECK-LLVM-LABEL: @test( |
| 53 |
; CHECK-LLVM-NEXT: entry: |
| 54 |
; CHECK-LLVM-NEXT: [[CALL:%.*]] = call spir_func <2 x float> @_Z28__spirv_SubgroupShuffleINTELDv2_fj(<2 x float> [[X:%.*]], i32 [[C:%.*]]) |
| 55 |
; CHECK-LLVM-NEXT: [[CALL1:%.*]] = call spir_func <2 x float> @_Z32__spirv_SubgroupShuffleDownINTELDv2_fS_j(<2 x float> [[X]], <2 x float> [[X]], i32 [[C]]) |
| 56 |
; CHECK-LLVM-NEXT: [[CALL2:%.*]] = call spir_func <2 x float> @_Z30__spirv_SubgroupShuffleUpINTELDv2_fS_j(<2 x float> [[X]], <2 x float> [[X]], i32 [[C]]) |
| 57 |
; CHECK-LLVM-NEXT: [[CALL3:%.*]] = call spir_func <2 x float> @_Z31__spirv_SubgroupShuffleXorINTELDv2_fj(<2 x float> [[X]], i32 [[C]]) |
| 58 |
; CHECK-LLVM-NEXT: [[CALL4:%.*]] = call spir_func <2 x i32> @_Z41__spirv_SubgroupImageBlockReadINTEL_Rint2PU3AS133__spirv_Image__void_1_0_0_0_0_0_0Dv2_i(%spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)* [[IMAGE_IN:%.*]], <2 x i32> [[COORD:%.*]]) |
| 59 |
; CHECK-LLVM-NEXT: call spir_func void @_Z36__spirv_SubgroupImageBlockWriteINTELPU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv2_j(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)* [[IMAGE_OUT:%.*]], <2 x i32> [[COORD]], <2 x i32> [[CALL4]]) |
| 60 |
; CHECK-LLVM-NEXT: [[CALL5:%.*]] = call spir_func <2 x i32> @_Z36__spirv_SubgroupBlockReadINTEL_Rint2PU3AS1Kj(i32 addrspace(1)* [[P:%.*]]) |
| 61 |
; CHECK-LLVM-NEXT: call spir_func void @_Z31__spirv_SubgroupBlockWriteINTELPU3AS1jDv2_j(i32 addrspace(1)* [[P]], <2 x i32> [[CALL5]]) |
| 62 |
; CHECK-LLVM-NEXT: [[CALL6:%.*]] = call spir_func <2 x i16> @_Z43__spirv_SubgroupImageBlockReadINTEL_Rshort2PU3AS133__spirv_Image__void_1_0_0_0_0_0_0Dv2_i(%spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)* [[IMAGE_IN]], <2 x i32> [[COORD]]) |
| 63 |
; CHECK-LLVM-NEXT: call spir_func void @_Z36__spirv_SubgroupImageBlockWriteINTELPU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv2_t(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)* [[IMAGE_OUT]], <2 x i32> [[COORD]], <2 x i16> [[CALL6]]) |
| 64 |
; CHECK-LLVM-NEXT: [[CALL7:%.*]] = call spir_func <2 x i16> @_Z38__spirv_SubgroupBlockReadINTEL_Rshort2PU3AS1Kt(i16 addrspace(1)* [[SP:%.*]]) |
| 65 |
; CHECK-LLVM-NEXT: call spir_func void @_Z31__spirv_SubgroupBlockWriteINTELPU3AS1tDv2_t(i16 addrspace(1)* [[SP]], <2 x i16> [[CALL7]]) |
| 66 |
; CHECK-LLVM-NEXT: [[CALL8:%.*]] = call spir_func <2 x i8> @_Z42__spirv_SubgroupImageBlockReadINTEL_Rchar2PU3AS133__spirv_Image__void_1_0_0_0_0_0_0Dv2_i(%spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)* [[IMAGE_IN]], <2 x i32> [[COORD]]) |
| 67 |
; CHECK-LLVM-NEXT: call spir_func void @_Z36__spirv_SubgroupImageBlockWriteINTELPU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv2_h(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)* [[IMAGE_OUT]], <2 x i32> [[COORD]], <2 x i8> [[CALL8]]) |
| 68 |
; CHECK-LLVM-NEXT: [[CALL9:%.*]] = call spir_func <2 x i8> @_Z37__spirv_SubgroupBlockReadINTEL_Rchar2PU3AS1Kh(i8 addrspace(1)* [[CP:%.*]]) |
| 69 |
; CHECK-LLVM-NEXT: call spir_func void @_Z31__spirv_SubgroupBlockWriteINTELPU3AS1hDv2_h(i8 addrspace(1)* [[CP]], <2 x i8> [[CALL9]]) |
| 70 |
; CHECK-LLVM-NEXT: [[CALL10:%.*]] = call spir_func <2 x i64> @_Z42__spirv_SubgroupImageBlockReadINTEL_Rlong2PU3AS133__spirv_Image__void_1_0_0_0_0_0_0Dv2_i(%spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)* [[IMAGE_IN]], <2 x i32> [[COORD]]) |
| 71 |
; CHECK-LLVM-NEXT: call spir_func void @_Z36__spirv_SubgroupImageBlockWriteINTELPU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv2_m(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)* [[IMAGE_OUT]], <2 x i32> [[COORD]], <2 x i64> [[CALL10]]) |
| 72 |
; CHECK-LLVM-NEXT: [[CALL11:%.*]] = call spir_func <2 x i64> @_Z37__spirv_SubgroupBlockReadINTEL_Rlong2PU3AS1Km(i64 addrspace(1)* [[LP:%.*]]) |
| 73 |
; CHECK-LLVM-NEXT: call spir_func void @_Z31__spirv_SubgroupBlockWriteINTELPU3AS1mDv2_m(i64 addrspace(1)* [[LP]], <2 x i64> [[CALL11]]) |
| 74 |
; CHECK-LLVM-NEXT: ret void |
| 75 |
|
| 76 |
entry: |
| 77 |
%call = tail call spir_func <2 x float> @_Z23intel_sub_group_shuffleDv2_fj(<2 x float> %x, i32 %c) #2 |
| 78 |
%call1 = tail call spir_func <2 x float> @_Z28intel_sub_group_shuffle_downDv2_fS_j(<2 x float> %x, <2 x float> %x, i32 %c) #2 |
| 79 |
%call2 = tail call spir_func <2 x float> @_Z26intel_sub_group_shuffle_upDv2_fS_j(<2 x float> %x, <2 x float> %x, i32 %c) #2 |
| 80 |
%call3 = tail call spir_func <2 x float> @_Z27intel_sub_group_shuffle_xorDv2_fj(<2 x float> %x, i32 %c) #2 |
| 81 |
|
| 82 |
%call4 = tail call spir_func <2 x i32> @_Z27intel_sub_group_block_read214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)* %image_in, <2 x i32> %coord) #2 |
| 83 |
tail call spir_func void @_Z28intel_sub_group_block_write214ocl_image2d_woDv2_iDv2_j(%opencl.image2d_wo_t addrspace(1)* %image_out, <2 x i32> %coord, <2 x i32> %call4) #2 |
| 84 |
%call5 = tail call spir_func <2 x i32> @_Z27intel_sub_group_block_read2PU3AS1Kj(i32 addrspace(1)* %p) #2 |
| 85 |
tail call spir_func void @_Z28intel_sub_group_block_write2PU3AS1jDv2_j(i32 addrspace(1)* %p, <2 x i32> %call5) #2 |
| 86 |
|
| 87 |
%call6 = tail call spir_func <2 x i16> @_Z30intel_sub_group_block_read_us214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)* %image_in, <2 x i32> %coord) #2 |
| 88 |
tail call spir_func void @_Z31intel_sub_group_block_write_us214ocl_image2d_woDv2_iDv2_t(%opencl.image2d_wo_t addrspace(1)* %image_out, <2 x i32> %coord, <2 x i16> %call6) #2 |
| 89 |
%call7 = tail call spir_func <2 x i16> @_Z30intel_sub_group_block_read_us2PU3AS1Kt(i16 addrspace(1)* %sp) #2 |
| 90 |
tail call spir_func void @_Z31intel_sub_group_block_write_us2PU3AS1tDv2_t(i16 addrspace(1)* %sp, <2 x i16> %call7) #2 |
| 91 |
|
| 92 |
%call8 = tail call spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)* %image_in, <2 x i32> %coord) #2 |
| 93 |
tail call spir_func void @_Z31intel_sub_group_block_write_uc214ocl_image2d_woDv2_iDv2_h(%opencl.image2d_wo_t addrspace(1)* %image_out, <2 x i32> %coord, <2 x i8> %call8) #2 |
| 94 |
%call9 = tail call spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc2PU3AS1Kh(i8 addrspace(1)* %cp) #2 |
| 95 |
tail call spir_func void @_Z31intel_sub_group_block_write_uc2PU3AS1hDv2_h(i8 addrspace(1)* %cp, <2 x i8> %call9) #2 |
| 96 |
|
| 97 |
%call10 = tail call spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)* %image_in, <2 x i32> %coord) #2 |
| 98 |
tail call spir_func void @_Z31intel_sub_group_block_write_ul214ocl_image2d_woDv2_iDv2_m(%opencl.image2d_wo_t addrspace(1)* %image_out, <2 x i32> %coord, <2 x i64> %call10) #2 |
| 99 |
%call11 = tail call spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul2PU3AS1Km(i64 addrspace(1)* %lp) #2 |
| 100 |
tail call spir_func void @_Z31intel_sub_group_block_write_ul2PU3AS1mDv2_m(i64 addrspace(1)* %lp, <2 x i64> %call11) #2 |
| 101 |
|
| 102 |
ret void |
| 103 |
} |
| 104 |
|
| 105 |
; Function Attrs: convergent |
| 106 |
declare spir_func <2 x float> @_Z23intel_sub_group_shuffleDv2_fj(<2 x float>, i32) local_unnamed_addr #1 |
| 107 |
|
| 108 |
; Function Attrs: convergent |
| 109 |
declare spir_func <2 x float> @_Z28intel_sub_group_shuffle_downDv2_fS_j(<2 x float>, <2 x float>, i32) local_unnamed_addr #1 |
| 110 |
|
| 111 |
; Function Attrs: convergent |
| 112 |
declare spir_func <2 x float> @_Z26intel_sub_group_shuffle_upDv2_fS_j(<2 x float>, <2 x float>, i32) local_unnamed_addr #1 |
| 113 |
|
| 114 |
; Function Attrs: convergent |
| 115 |
declare spir_func <2 x float> @_Z27intel_sub_group_shuffle_xorDv2_fj(<2 x float>, i32) local_unnamed_addr #1 |
| 116 |
|
| 117 |
; Function Attrs: convergent |
| 118 |
declare spir_func <2 x i32> @_Z27intel_sub_group_block_read214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 119 |
|
| 120 |
; Function Attrs: convergent |
| 121 |
declare spir_func void @_Z28intel_sub_group_block_write214ocl_image2d_woDv2_iDv2_j(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <2 x i32>) local_unnamed_addr #1 |
| 122 |
|
| 123 |
; Function Attrs: convergent |
| 124 |
declare spir_func <2 x i32> @_Z27intel_sub_group_block_read2PU3AS1Kj(i32 addrspace(1)*) local_unnamed_addr #1 |
| 125 |
|
| 126 |
; Function Attrs: convergent |
| 127 |
declare spir_func void @_Z28intel_sub_group_block_write2PU3AS1jDv2_j(i32 addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 128 |
|
| 129 |
; Function Attrs: convergent |
| 130 |
declare spir_func <2 x i16> @_Z30intel_sub_group_block_read_us214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 131 |
|
| 132 |
; Function Attrs: convergent |
| 133 |
declare spir_func void @_Z31intel_sub_group_block_write_us214ocl_image2d_woDv2_iDv2_t(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <2 x i16>) local_unnamed_addr #1 |
| 134 |
|
| 135 |
; Function Attrs: convergent |
| 136 |
declare spir_func <2 x i16> @_Z30intel_sub_group_block_read_us2PU3AS1Kt(i16 addrspace(1)*) local_unnamed_addr #1 |
| 137 |
|
| 138 |
; Function Attrs: convergent |
| 139 |
declare spir_func void @_Z31intel_sub_group_block_write_us2PU3AS1tDv2_t(i16 addrspace(1)*, <2 x i16>) local_unnamed_addr #1 |
| 140 |
|
| 141 |
; Function Attrs: convergent |
| 142 |
declare spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 143 |
|
| 144 |
; Function Attrs: convergent |
| 145 |
declare spir_func void @_Z31intel_sub_group_block_write_uc214ocl_image2d_woDv2_iDv2_h(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <2 x i8>) local_unnamed_addr #1 |
| 146 |
|
| 147 |
; Function Attrs: convergent |
| 148 |
declare spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc2PU3AS1Kh(i8 addrspace(1)*) local_unnamed_addr #1 |
| 149 |
|
| 150 |
; Function Attrs: convergent |
| 151 |
declare spir_func void @_Z31intel_sub_group_block_write_uc2PU3AS1hDv2_h(i8 addrspace(1)*, <2 x i8>) local_unnamed_addr #1 |
| 152 |
|
| 153 |
; Function Attrs: convergent |
| 154 |
declare spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul214ocl_image2d_roDv2_i(%opencl.image2d_ro_t addrspace(1)*, <2 x i32>) local_unnamed_addr #1 |
| 155 |
|
| 156 |
; Function Attrs: convergent |
| 157 |
declare spir_func void @_Z31intel_sub_group_block_write_ul214ocl_image2d_woDv2_iDv2_m(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <2 x i64>) local_unnamed_addr #1 |
| 158 |
|
| 159 |
; Function Attrs: convergent |
| 160 |
declare spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul2PU3AS1Km(i64 addrspace(1)*) local_unnamed_addr #1 |
| 161 |
|
| 162 |
; Function Attrs: convergent |
| 163 |
declare spir_func void @_Z31intel_sub_group_block_write_ul2PU3AS1mDv2_m(i64 addrspace(1)*, <2 x i64>) local_unnamed_addr #1 |
| 164 |
|
| 165 |
attributes #0 = { convergent nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="128" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 166 |
attributes #1 = { convergent "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 167 |
attributes #2 = { convergent nounwind } |
| 168 |
|
| 169 |
!opencl.ocl.version = !{!0} |
| 170 |
!opencl.spir.version = !{!0} |
| 171 |
|
| 172 |
!0 = !{i32 1, i32 2} |
| 173 |
!1 = !{i32 0, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 1} |
| 174 |
!2 = !{!"none", !"none", !"read_only", !"write_only", !"none", !"none", !"none", !"none", !"none"} |
| 175 |
!3 = !{!"float2", !"uint", !"image2d_t", !"image2d_t", !"int2", !"uint*", !"ushort*", !"uchar*", !"ulong*"} |
| 176 |
!4 = !{!"float __attribute__((ext_vector_type(2)))", !"uint", !"image2d_t", !"image2d_t", !"int __attribute__((ext_vector_type(2)))", !"uint*", !"ushort*", !"uchar*", !"ulong*"} |
| 177 |
!5 = !{!"", !"", !"", !"", !"", !"", !"", !"", !""} |
| 178 |
!6 = !{!"x", !"c", !"image_in", !"image_out", !"coord", !"p", !"sp", !"cp", !"lp"} |