1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
7 ; CHECK-SPIRV-DAG: %[[Float:.*]] = OpTypeFloat 32
8 ; CHECK-SPIRV-DAG: %[[FloatPtr:.*]] = OpTypePointer Function %[[Float]]
9 ; CHECK-SPIRV: OpInBoundsPtrAccessChain %[[FloatPtr]]
10 ; CHECK-SPIRV: OpInBoundsPtrAccessChain %[[FloatPtr]]
11 ; CHECK-SPIRV: OpSelect %[[FloatPtr]]
12 ; CHECK-SPIRV: OpLoad %[[Float]]
14 %struct = type { [3 x float] }
16 define spir_kernel void @bar(i1 %sw) {
18 %var1 = alloca %struct
19 %var2 = alloca %struct
20 %elem1 = getelementptr inbounds [3 x float], ptr %var1, i64 0, i64 0
21 %elem2 = getelementptr inbounds [3 x float], ptr %var2, i64 0, i64 1
22 %elem = select i1 %sw, ptr %elem1, ptr %elem2
23 %res = load float, ptr %elem