Debian Codegraph @

llvm/test/CodeGen/SPIRV/SpecConstants/spec-constant-length-array.ll

raw
1 ; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_variable_length_array %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_variable_length_array %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK: OpCapability VariableLengthArrayINTEL
5 ; CHECK: OpExtension "SPV_INTEL_variable_length_array"
6
7 ; CHECK-DAG: OpDecorate %[[#]] SpecId 0
8 ; CHECK-DAG: OpDecorate %[[#]] SpecId 1
9 ; CHECK-DAG: OpDecorate %[[#]] SpecId 2
10 ; CHECK-DAG: OpDecorate %[[#A0:]] Alignment 4
11 ; CHECK-DAG: OpDecorate %[[#A1:]] Alignment 2
12 ; CHECK-DAG: OpDecorate %[[#A2:]] Alignment 16
13
14 ; CHECK: %[[#VOID_TY:]] = OpTypeVoid
15 ; CHECK: %[[#FUNC_TY:]] = OpTypeFunction %[[#VOID_TY]]
16 ; CHECK-DAG: %[[#I64:]] = OpTypeInt 64 0
17 ; CHECK-DAG: %[[#I32:]] = OpTypeInt 32 0
18 ; CHECK-DAG: %[[#I8:]] = OpTypeInt 8 0
19 ; CHECK-DAG: %[[#F64:]] = OpTypeFloat 64
20 ; CHECK-DAG: %[[#STRUCT_TY:]] = OpTypeStruct %[[#F64]] %[[#F64]]
21 ; CHECK-DAG: %[[#PTR_STRUCT:]] = OpTypePointer Function %[[#STRUCT_TY]]
22 ; CHECK-DAG: %[[#PTR_I8:]] = OpTypePointer Function %[[#I8]]
23 ; CHECK-DAG: %[[#F32:]] = OpTypeFloat 32
24 ; CHECK-DAG: %[[#PTR_F32:]] = OpTypePointer Function %[[#F32]]
25
26 ; CHECK-DAG: %[[#SC0:]] = OpSpecConstant %[[#I64]] 1
27 ; CHECK-DAG: %[[#SC1:]] = OpSpecConstant %[[#I32]] 2
28 ; CHECK-DAG: %[[#SC2:]] = OpSpecConstant %[[#I8]] 4
29
30 ; CHECK: %[[#]] = OpFunction %[[#VOID_TY]] None %[[#FUNC_TY]]
31 ; CHECK: %[[#LABEL:]] = OpLabel
32
33 ; CHECK: %[[#A0]] = OpVariableLengthArrayINTEL %[[#PTR_F32]] %[[#SC0]]
34 ; CHECK: %[[#A1]] = OpVariableLengthArrayINTEL %[[#PTR_I8]] %[[#SC1]]
35 ; CHECK: %[[#A2]] = OpVariableLengthArrayINTEL %[[#PTR_STRUCT]] %[[#SC2]]
36
37 %struct_type = type { double, double }
38
39 define spir_kernel void @test() {
40 entry:
41 %length0 = call i64 @_Z20__spirv_SpecConstantix(i32 0, i64 1), !SYCL_SPEC_CONST_SYM_ID !0
42 %length1 = call i32 @_Z20__spirv_SpecConstantii(i32 1, i32 2), !SYCL_SPEC_CONST_SYM_ID !1
43 %length2 = call i8 @_Z20__spirv_SpecConstantic(i32 2, i8 4), !SYCL_SPEC_CONST_SYM_ID !2
44 %scla0 = alloca float, i64 %length0, align 4
45 %scla1 = alloca i8, i32 %length1, align 2
46 %scla2 = alloca %struct_type, i8 %length2, align 16
47 ret void
48 }
49
50 declare i8 @_Z20__spirv_SpecConstantic(i32, i8)
51 declare i32 @_Z20__spirv_SpecConstantii(i32, i32)
52 declare i64 @_Z20__spirv_SpecConstantix(i32, i64)
53
54 !0 = !{!"i64_spec_const", i32 0}
55 !1 = !{!"i32_spec_const", i32 1}
56 !2 = !{!"i8_spec_const", i32 2}