Skip to content

Commit

Permalink
Update LLVM (#1359)
Browse files Browse the repository at this point in the history
LLVM is now doing even more canonicalization of GEP to i8.
It leads to unsupported pattern in ClusterPodKernelArgumentsPass.
Running SimplifyPointerBitcastPass before it allows to remove them.

2 tests are failing due to a unidentified bug and need more time to be
fixed.

Ref #1358
  • Loading branch information
rjodinchr authored May 23, 2024
1 parent c1ca1b8 commit ec5a294
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 73 deletions.
2 changes: 1 addition & 1 deletion deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"subrepo" : "llvm/llvm-project",
"branch" : "main",
"subdir" : "third_party/llvm",
"commit" : "932ca85680db5e4579306f37e55746097fb8ec7f"
"commit" : "4fbc95d1360147e9c4aceeadd1bda17d68364b85"
},
{
"name" : "SPIRV-Headers",
Expand Down
3 changes: 3 additions & 0 deletions lib/BitcastUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ void GroupScalarValuesIntoVector(IRBuilder<> &Builder,
unsigned NumElePerVec);
// Returns the size in bits of 'Ty'
size_t SizeInBits(const DataLayout &DL, Type *Ty) {
if (Ty->isVoidTy()) {
return 0;
}
return DL.getTypeAllocSizeInBits(Ty);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ int RunPassPipeline(llvm::Module &M, llvm::raw_svector_ostream *binaryStream) {
// %2 = bitcast float* %1
// %3 = load float %2
pm.addPass(llvm::createModuleToFunctionPassAdaptor(llvm::PromotePass()));
pm.addPass(clspv::SimplifyPointerBitcastPass());
pm.addPass(clspv::ClusterPodKernelArgumentsPass());

pm.addPass(clspv::InlineEntryPointsPass());
Expand Down
3 changes: 2 additions & 1 deletion test/Int8/char_struct_ssbo.cl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ kernel void foo(global S* data) {
// CHECK: OpDecorate [[array:%[a-zA-Z0-9_]+]] ArrayStride 1
// CHECK: [[char:%[a-zA-Z0-9_]+]] = OpTypeInt 8 0
// CHECK: [[char2:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 2
// CHECK: [[char3:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 3
// CHECK: [[char4:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 4
// CHECK: [[four:%[a-zA-Z0-9_]+]] = OpConstant {{.*}} 4
// CHECK: [[array:%[a-zA-Z0-9_]+]] = OpTypeArray [[char]] [[four]]
// CHECK: [[struct:%[a-zA-Z0-9_]+]] = OpTypeStruct [[char]] [[char]] [[char2]] [[char4]] [[char4]] [[array]]
// CHECK: [[struct:%[a-zA-Z0-9_]+]] = OpTypeStruct [[char]] [[char]] [[char2]] [[char3]] [[char4]] [[array]]
// CHECK: [[rta:%[a-zA-Z0-9_]+]] = OpTypeRuntimeArray [[struct]]
// CHECK: [[block:%[a-zA-Z0-9_]+]] = OpTypeStruct [[rta]]
// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer StorageBuffer [[block]]
Expand Down
3 changes: 2 additions & 1 deletion test/LongVectorLowering/char_struct_ssbo.cl
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ kernel void foo(global S* data) {
// CHECK: [[uint:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0
// CHECK: [[char:%[a-zA-Z0-9_]+]] = OpTypeInt 8 0
// CHECK: [[char2:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 2
// CHECK: [[char3:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 3
// CHECK: [[char4:%[a-zA-Z0-9_]+]] = OpTypeVector [[char]] 4
// CHECK: [[one:%[a-zA-Z0-9_]+]] = OpConstant {{.*}} 1
// CHECK: [[padding:%[a-zA-Z0-9_]+]] = OpTypeArray [[uint]] [[one]]
// CHECK: [[eight:%[a-zA-Z0-9_]+]] = OpConstant {{.*}} 8
// CHECK: [[char8:%[a-zA-Z0-9_]+]] = OpTypeArray [[char]] [[eight]]
// CHECK: [[four:%[a-zA-Z0-9_]+]] = OpConstant {{.*}} 4
// CHECK: [[array:%[a-zA-Z0-9_]+]] = OpTypeArray [[char]] [[four]]
// CHECK: [[struct:%[a-zA-Z0-9_]+]] = OpTypeStruct [[char]] [[char]] [[char2]] [[char4]] [[char4]] [[padding]] [[char8]] [[array]] [[padding]]
// CHECK: [[struct:%[a-zA-Z0-9_]+]] = OpTypeStruct [[char]] [[char]] [[char2]] [[char3]] [[char4]] [[padding]] [[char8]] [[array]] [[padding]]
// CHECK: [[rta:%[a-zA-Z0-9_]+]] = OpTypeRuntimeArray [[struct]]
// CHECK: [[block:%[a-zA-Z0-9_]+]] = OpTypeStruct [[rta]]
// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer StorageBuffer [[block]]
Expand Down
3 changes: 3 additions & 0 deletions test/PhysicalStorageBuffers/physical_constant_ptrtoint.cl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// RUN: FileCheck %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// TODO(#1358): Invalid SPIR-V trying to extract the 5th element of a 4-element vector
// XFAIL: *

constant char myconst[5] = { 42 };

kernel void test(global ulong *a, constant int *b)
Expand Down
3 changes: 3 additions & 0 deletions test/PhysicalStorageBuffers/physical_global_ptrtoint.cl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// RUN: FileCheck %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// TODO(#1358): Invalid SPIR-V trying to extract the 5th element of a 4-element vector
// XFAIL: *

kernel void test(global ulong *a, global int *b)
{
size_t tid = get_global_id(0);
Expand Down
16 changes: 3 additions & 13 deletions test/PushConstant/global_push_constant_pod_args.cl
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// RUN: clspv %target %s -o %t.spv -cl-std=CL2.0 -global-offset -inline-entry-points -arch=spir
// RUN: clspv %target %s -o %t.spv -cl-std=CL2.0 -global-offset -inline-entry-points
// RUN: spirv-dis %t.spv -o %t.spvasm
// RUN: FileCheck %s < %t.spvasm --check-prefixes=CHECK,CHECK-32
// RUN: clspv-reflection %t.spv -o %t.map
// RUN: FileCheck --check-prefix=MAP %s < %t.map
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// RUN: clspv %target %s -o %t.spv -cl-std=CL2.0 -global-offset -inline-entry-points -arch=spir64
// RUN: spirv-dis %t.spv -o %t.spvasm
// RUN: FileCheck %s < %t.spvasm --check-prefixes=CHECK,CHECK-64
// RUN: FileCheck %s < %t.spvasm
// RUN: clspv-reflection %t.spv -o %t.map
// RUN: FileCheck --check-prefix=MAP %s < %t.map
// RUN: spirv-val --target-env vulkan1.0 %t.spv
Expand All @@ -25,7 +18,6 @@ kernel void foo(global int* out, int a) {
// CHECK-DAG: OpMemberDecorate [[pc_block]] 2 Offset 32
// CHECK-DAG: OpMemberDecorate [[pc_block]] 0 Offset 0
// CHECK: [[int:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0
// CHECK-64-DAG: [[long:%[a-zA-Z0-9_]+]] = OpTypeInt 64 0
// CHECK-DAG: [[int3:%[a-zA-Z0-9_]+]] = OpTypeVector [[int]] 3
// CHECK-DAG: [[pod_arg_struct:%[a-zA-Z0-9_]+]] = OpTypeStruct [[int]]
// CHECK-DAG: [[pc_block]] = OpTypeStruct [[int3]] [[int3]] [[pod_arg_struct]]
Expand All @@ -34,12 +26,10 @@ kernel void foo(global int* out, int a) {
// CHECK-DAG: [[int_0:%[a-zA-Z0-9_]+]] = OpConstant [[int]] 0
// CHECK-DAG: [[int_1:%[a-zA-Z0-9_]+]] = OpConstant [[int]] 1
// CHECK-DAG: [[int_2:%[a-zA-Z0-9_]+]] = OpConstant [[int]] 2
// CHECK-64-DAG: [[long_0:%[a-zA-Z0-9_]+]] = OpConstant [[long]] 0
// CHECK: [[pc_var:%[a-zA-Z0-9_]+]] = OpVariable [[pc_block_ptr]] PushConstant
// CHECK: [[gep_arg:%[a-zA-Z0-9_]+]] = OpAccessChain [[int_ptr]] [[pc_var]] [[int_2]] [[int_0]]
// CHECK: [[ld_arg:%[a-zA-Z0-9_]+]] = OpLoad [[int]] [[gep_arg]]
// CHECK-32: [[gep:%[a-zA-Z0-9_]+]] = OpAccessChain [[int_ptr]] [[pc_var]] [[int_1]] [[int_0]]
// CHECK-64: [[gep:%[a-zA-Z0-9_]+]] = OpAccessChain [[int_ptr]] [[pc_var]] [[int_1]] [[long_0]]
// CHECK: [[gep:%[a-zA-Z0-9_]+]] = OpAccessChain [[int_ptr]] [[pc_var]] [[int_1]] [[int_0]]
// CHECK: [[ld_offset:%[a-zA-Z0-9_]+]] = OpLoad [[int]] [[gep]]
// CHECK: [[add1:%[a-zA-Z0-9_]+]] = OpIAdd [[int]] {{.*}} [[ld_arg]]
// CHECK: [[add2:%[a-zA-Z0-9_]+]] = OpIAdd [[int]] [[add1]] [[ld_offset]]
40 changes: 11 additions & 29 deletions test/WorkItemBuiltins/get_global_linear.cl
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv -arch=spir
// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck --check-prefixes=CHECK,CHECK-32 %s < %t2.spvasm
// RUN: FileCheck --check-prefix=NO-OFFSET %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv -arch=spir64
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck --check-prefixes=CHECK,CHECK-64 %s < %t2.spvasm
// RUN: FileCheck --check-prefixes=CHECK %s < %t2.spvasm
// RUN: FileCheck --check-prefix=NO-OFFSET %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points -global-offset=1 %s -o %t.spv -arch=spir
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck %s < %t2.spvasm --check-prefixes=CHECK,CHECK-32
// RUN: FileCheck %s < %t2.spvasm --check-prefixes=CHECK
// RUN: FileCheck --check-prefix=CHECK-OFFSET %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// CHECK-DAG: %[[uint:[0-9a-zA-Z_]+]] = OpTypeInt 32 0
// CHECK-64-DAG: %[[ulong:[0-9a-zA-Z_]+]] = OpTypeInt 64 0
// CHECK-DAG: %[[uint_0:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 0
// CHECK-DAG: %[[uint_1:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 1
// CHECK-DAG: %[[uint_2:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 2
// CHECK-64-DAG: %[[ulong_0:[0-9a-zA-Z_]+]] = OpConstant %[[ulong]] 0
// CHECK-64-DAG: %[[ulong_1:[0-9a-zA-Z_]+]] = OpConstant %[[ulong]] 1
// CHECK-64-DAG: %[[ulong_2:[0-9a-zA-Z_]+]] = OpConstant %[[ulong]] 2
// CHECK-DAG: %[[v3uint:[0-9a-zA-Z_]+]] = OpTypeVector %[[uint]] 3

// CHECK-DAG: %[[ptr_input_uint:[0-9a-zA-Z_]+]] = OpTypePointer Input %[[uint]]
Expand All @@ -36,28 +26,20 @@

// CHECK: OpFunction

// CHECK-32-DAG: %[[gid0_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_0]]
// CHECK-32-DAG: %[[gid1_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_1]]
// CHECK-32-DAG: %[[gid2_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_2]]
// CHECK-DAG: %[[gid0_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_0]]
// CHECK-DAG: %[[gid1_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_1]]
// CHECK-DAG: %[[gid2_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_2]]

// CHECK-64-DAG: %[[gid0_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[uint_0]]
// CHECK-64-DAG: %[[gid1_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[ulong_1]]
// CHECK-64-DAG: %[[gid2_ptr:[0-9]+]] = OpAccessChain %[[ptr_input_uint]] %[[gl_GlobalInvocationID]] %[[ulong_2]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[gid0_ptr]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[gid1_ptr]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[gid2_ptr]]

// can't tell which is global offset and which is global size
// CHECK-32-DAG: %[[goff0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_0]]
// CHECK-32-DAG: %[[goff1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_1]]
// CHECK-32-DAG: %[[goff2_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_2]]
// CHECK-32-DAG: %[[gsize0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_0]]
// CHECK-32-DAG: %[[gsize1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_1]]
// CHECK-64-DAG: %[[goff0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] %[[uint_1]] %[[ulong_0]]
// CHECK-64-DAG: %[[goff1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] %[[uint_1]] %[[ulong_1]]
// CHECK-64-DAG: %[[goff2_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] %[[uint_1]] %[[ulong_2]]
// CHECK-64-DAG: %[[gsize0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] %[[uint_0]] %[[uint_0]]
// CHECK-64-DAG: %[[gsize1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] %[[uint_0]] %[[ulong_1]]
// CHECK-DAG: %[[goff0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_0]]
// CHECK-DAG: %[[goff1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_1]]
// CHECK-DAG: %[[goff2_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_2]]
// CHECK-DAG: %[[gsize0_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_0]]
// CHECK-DAG: %[[gsize1_ptr:[0-9]+]] = OpAccessChain %[[push_ptr_int]] %[[push]] {{.*}} %[[uint_1]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[goff0_ptr]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[goff1_ptr]]
// CHECK-DAG: %{{[0-9]+}} = OpLoad %[[uint]] %[[goff2_ptr]]
Expand Down
21 changes: 5 additions & 16 deletions test/WorkItemBuiltins/get_local_linear_id.cl
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv -arch=spir
// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck %s < %t2.spvasm --check-prefixes=CHECK,CHECK-32
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// RUN: clspv %target -cl-std=CL2.0 -inline-entry-points %s -o %t.spv -arch=spir64
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck %s < %t2.spvasm --check-prefixes=CHECK,CHECK-64
// RUN: FileCheck %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv

// CHECK-DAG: %[[uint:[0-9a-zA-Z_]+]] = OpTypeInt 32 0
// CHECK-64-DAG: %[[ulong:[0-9a-zA-Z_]+]] = OpTypeInt 64 0
// CHECK-DAG: %[[uint_0:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 0
// CHECK-DAG: %[[uint_1:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 1
// CHECK-DAG: %[[uint_2:[0-9a-zA-Z_]+]] = OpConstant %[[uint]] 2
// CHECK-64-DAG: %[[ulong_1:[0-9a-zA-Z_]+]] = OpConstant %[[ulong]] 1
// CHECK-64-DAG: %[[ulong_2:[0-9a-zA-Z_]+]] = OpConstant %[[ulong]] 2
// CHECK-DAG: %[[v3uint:[0-9a-zA-Z_]+]] = OpTypeVector %[[uint]] 3

// CHECK-DAG: %[[ptr_input_v3uint:[0-9a-zA-Z_]+]] = OpTypePointer Input %[[v3uint]]
Expand All @@ -24,12 +16,9 @@

// CHECK: OpFunction

// CHECK-32-DAG: %[[lid0_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_0]]
// CHECK-32-DAG: %[[lid1_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_1]]
// CHECK-32-DAG: %[[lid2_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_2]]
// CHECK-64-DAG: %[[lid0_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_0]]
// CHECK-64-DAG: %[[lid1_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[ulong_1]]
// CHECK-64-DAG: %[[lid2_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[ulong_2]]
// CHECK-DAG: %[[lid0_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_0]]
// CHECK-DAG: %[[lid1_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_1]]
// CHECK-DAG: %[[lid2_ptr:[0-9]+]] = OpAccessChain {{.*}} %[[gl_LocalInvocationID]] %[[uint_2]]
// CHECK-DAG: %[[lid0:[0-9]+]] = OpLoad %[[uint]] %[[lid0_ptr]]
// CHECK-DAG: %[[lid1:[0-9]+]] = OpLoad %[[uint]] %[[lid1_ptr]]
// CHECK-DAG: %[[lid2:[0-9]+]] = OpLoad %[[uint]] %[[lid2_ptr]]
Expand Down
40 changes: 28 additions & 12 deletions test/packed_struct_novec3.cl
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,54 @@ __kernel void test(__global int *a) {
}


// CHECK-DAG: [[uchar:%[^ ]+]] = OpTypeInt 8 0
// CHECK-DAG: [[uint:%[^ ]+]] = OpTypeInt 32 0
// CHECK-64-DAG: [[ulong:%[^ ]+]] = OpTypeInt 64 0
// CHECK-DAG: [[uintv3:%[^ ]+]] = OpTypeVector [[uint]] 3
// CHECK-DAG: [[uintv4:%[^ ]+]] = OpTypeVector [[uint]] 4
// CHECK-DAG: [[uintinput:%[^ ]+]] = OpTypePointer Input [[uint]]
// CHECK-DAG: [[uintv3input:%[^ ]+]] = OpTypePointer Input [[uintv3]]
// CHECK-DAG: [[uintworkgroup:%[^ ]+]] = OpTypePointer Workgroup [[uint]]
// CHECK-DAG: [[uintv3workgroup:%[^ ]+]] = OpTypePointer Workgroup [[uintv3]]
// CHECK-DAG: [[uintv4workgroup:%[^ ]+]] = OpTypePointer Workgroup [[uintv4]]
// CHECK-DAG: [[uint12:%[^ ]+]] = OpConstant [[uint]] 12
// CHECK-DAG: [[uint64:%[^ ]+]] = OpConstant [[uint]] 64
// CHECK-DAG: [[uchararray12:%[^ ]+]] = OpTypeArray [[uchar]] [[uint12]]
// CHECK-DAG: [[uint512:%[^ ]+]] = OpConstant [[uint]] 512
// CHECK-DAG: [[S1:%[^ ]+]] = OpTypeStruct [[uintv3]] [[uint]]
// CHECK-DAG: [[S2:%[^ ]+]] = OpTypeStruct [[uintv4]] [[uint]] [[uchararray12]]
// CHECK-DAG: [[S1array:%[^ ]+]] = OpTypeArray [[S1]] [[uint64]]
// CHECK-DAG: [[S2array:%[^ ]+]] = OpTypeArray [[S2]] [[uint64]]
// CHECK-DAG: [[S2array:%[^ ]+]] = OpTypeArray [[uint]] [[uint512]]
// CHECK-DAG: [[S1arrayptr:%[^ ]+]] = OpTypePointer Workgroup [[S1array]]
// CHECK-DAG: [[S2arrayptr:%[^ ]+]] = OpTypePointer Workgroup [[S2array]]
// CHECK-DAG: [[uint0:%[^ ]+]] = OpConstant [[uint]] 0
// CHECK-DAG: [[uint1:%[^ ]+]] = OpConstant [[uint]] 1
// CHECK-DAG: [[uint2:%[^ ]+]] = OpConstant [[uint]] 2
// CHECK-32-DAG: [[uint3:%[^ ]+]] = OpConstant [[uint]] 3
// CHECK-32-DAG: [[uint4:%[^ ]+]] = OpConstant [[uint]] 4
// CHECK-64-DAG: [[ulong1:%[^ ]+]] = OpConstant [[ulong]] 1
// CHECK-64-DAG: [[ulong2:%[^ ]+]] = OpConstant [[ulong]] 2
// CHECK-64-DAG: [[ulong3:%[^ ]+]] = OpConstant [[ulong]] 3
// CHECK-64-DAG: [[ulong4:%[^ ]+]] = OpConstant [[ulong]] 4
// CHECK: [[s1:%[^ ]+]] = OpVariable [[S1arrayptr]] Workgroup
// CHECK: [[s2:%[^ ]+]] = OpVariable [[S2arrayptr]] Workgroup
// CHECK: [[gidptr:%[^ ]+]] = OpVariable [[uintv3input]] Input
// CHECK: [[gidgep:%[^ ]+]] = OpAccessChain [[uintinput]] [[gidptr]] [[uint0]]
// CHECK: [[gid:%[^ ]+]] = OpLoad [[uint]] [[gidgep]]

// CHECK-64: [[gid_long:%[^ ]+]] = OpSConvert [[ulong]] [[gid]]
// CHECK-64: [[_0:%[^ ]+]] = OpAccessChain [[uintv3workgroup]] [[s1]] [[gid_long]] [[uint0]]
// CHECK-32: [[_0:%[^ ]+]] = OpAccessChain [[uintv3workgroup]] [[s1]] [[gid]] [[uint0]]
// CHECK-64: [[_1:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s1]] [[gid_long]] [[uint1]]
// CHECK-64: [[gid_times_8:%[^ ]+]] = OpShiftLeftLogical [[ulong]] [[gid_long]] [[ulong3]]
// CHECK-64: [[id:%[^ ]+]] = OpBitwiseOr [[ulong]] [[gid_times_8]] [[ulong1]]
// CHECK-64: [[_2:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]
// CHECK-64: [[id:%[^ ]+]] = OpBitwiseOr [[ulong]] [[gid_times_8]] [[ulong2]]
// CHECK-64: [[_2:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]
// CHECK-64: [[_2:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[gid_times_8]]
// CHECK-64: [[id:%[^ ]+]] = OpBitwiseOr [[ulong]] [[gid_times_8]] [[ulong4]]
// CHECK-64: [[_2:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]

// CHECK-32: [[_0:%[^ ]+]] = OpAccessChain [[uintv3workgroup]] [[s1]] [[gid]] [[uint0]]
// CHECK-32: [[_1:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s1]] [[gid]] [[uint1]]
// CHECK-64: [[_2:%[^ ]+]] = OpAccessChain [[uintv4workgroup]] [[s2]] [[gid_long]] [[uint0]]
// CHECK-32: [[_2:%[^ ]+]] = OpAccessChain [[uintv4workgroup]] [[s2]] [[gid]] [[uint0]]
// CHECK-64: [[_3:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[gid_long]] [[uint1]]
// CHECK-32: [[_3:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[gid]] [[uint1]]
// CHECK-32: [[gid_times_8:%[^ ]+]] = OpShiftLeftLogical [[uint]] [[gid]] [[uint3]]
// CHECK-32: [[id:%[^ ]+]] = OpBitwiseOr [[uint]] [[gid_times_8]] [[uint1]]
// CHECK-32: [[_2:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]
// CHECK-32: [[id:%[^ ]+]] = OpBitwiseOr [[uint]] [[gid_times_8]] [[uint2]]
// CHECK-32: [[_3:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]
// CHECK-32: [[_4:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[gid_times_8]]
// CHECK-32: [[id:%[^ ]+]] = OpBitwiseOr [[uint]] [[gid_times_8]] [[uint4]]
// CHECK-32: [[_5:%[^ ]+]] = OpAccessChain [[uintworkgroup]] [[s2]] [[id]]

0 comments on commit ec5a294

Please sign in to comment.