115 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}3 4; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 05; CHECK-DAG: %[[#float:]] = OpTypeFloat 326; CHECK-DAG: %[[#float_fp:]] = OpTypePointer Function %[[#float]]7; CHECK-DAG: %[[#float_pp:]] = OpTypePointer Private %[[#float]]8; CHECK-DAG: %[[#uint_fp:]] = OpTypePointer Function %[[#uint]]9; CHECK-DAG: %[[#uint_0:]] = OpConstant %[[#uint]] 010; CHECK-DAG: %[[#uint_4:]] = OpConstant %[[#uint]] 411; CHECK-DAG: %[[#float_0:]] = OpConstant %[[#float]] 012; CHECK-DAG: %[[#sf:]] = OpTypeStruct %[[#float]]13; CHECK-DAG: %[[#su:]] = OpTypeStruct %[[#uint]]14; CHECK-DAG: %[[#ssu:]] = OpTypeStruct %[[#su]]15; CHECK-DAG: %[[#sfuf:]] = OpTypeStruct %[[#float]] %[[#uint]] %[[#float]]16; CHECK-DAG: %[[#uint4:]] = OpTypeVector %[[#uint]] 417; CHECK-DAG: %[[#sv:]] = OpTypeStruct %[[#uint4]]18; CHECK-DAG: %[[#ssv:]] = OpTypeStruct %[[#sv]]19; CHECK-DAG: %[[#assv:]] = OpTypeArray %[[#ssv]] %[[#uint_4]]20; CHECK-DAG: %[[#sassv:]] = OpTypeStruct %[[#assv]]21; CHECK-DAG: %[[#ssassv:]] = OpTypeStruct %[[#sassv]]22; CHECK-DAG: %[[#sf_fp:]] = OpTypePointer Function %[[#sf]]23; CHECK-DAG: %[[#su_fp:]] = OpTypePointer Function %[[#su]]24; CHECK-DAG: %[[#ssu_fp:]] = OpTypePointer Function %[[#ssu]]25; CHECK-DAG: %[[#ssv_fp:]] = OpTypePointer Function %[[#ssv]]26; CHECK-DAG: %[[#ssassv_fp:]] = OpTypePointer Function %[[#ssassv]]27; CHECK-DAG: %[[#sfuf_fp:]] = OpTypePointer Function %[[#sfuf]]28; CHECK-DAG: %[[#sfuf_pp:]] = OpTypePointer Private %[[#sfuf]]29 30%struct.SF = type { float }31%struct.SU = type { i32 }32%struct.SFUF = type { float, i32, float }33%struct.SSU = type { %struct.SU }34%struct.SV = type { <4 x i32> }35%struct.SSV = type { %struct.SV }36%struct.SASSV = type { [4 x %struct.SSV] }37%struct.SSASSV = type { %struct.SASSV }38 39@gsfuf = external addrspace(10) global %struct.SFUF40; CHECK-DAG: %[[#gsfuf:]] = OpVariable %[[#sfuf_pp]] Private41 42define internal spir_func void @foo() {43 %1 = alloca %struct.SF, align 444; CHECK: %[[#var:]] = OpVariable %[[#sf_fp]] Function45 46 store float 0.0, ptr %1, align 447; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#float_fp]] %[[#var]] %[[#uint_0]]48; CHECK: OpStore %[[#tmp]] %[[#float_0]] Aligned 449 50 ret void51}52 53define internal spir_func void @bar() {54 %1 = alloca %struct.SU, align 455; CHECK: %[[#var:]] = OpVariable %[[#su_fp]] Function56 57 store i32 0, ptr %1, align 458; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#uint_fp]] %[[#var]] %[[#uint_0]]59; CHECK: OpStore %[[#tmp]] %[[#uint_0]] Aligned 460 61 ret void62}63 64define internal spir_func void @baz() {65 %1 = alloca %struct.SFUF, align 466; CHECK: %[[#var:]] = OpVariable %[[#sfuf_fp]] Function67 68 store float 0.0, ptr %1, align 469; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#float_fp]] %[[#var]] %[[#uint_0]]70; CHECK: OpStore %[[#tmp]] %[[#float_0]] Aligned 471 72 ret void73}74 75define internal spir_func void @biz() {76 store float 0.0, ptr addrspace(10) @gsfuf, align 477; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#float_pp]] %[[#gsfuf]] %[[#uint_0]]78; CHECK: OpStore %[[#tmp]] %[[#float_0]] Aligned 479 80 ret void81}82 83define internal spir_func void @nested_store() {84 %1 = alloca %struct.SSU, align 485; CHECK: %[[#var:]] = OpVariable %[[#ssu_fp]] Function86 87 store i32 0, ptr %1, align 488; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#uint_fp]] %[[#var]] %[[#uint_0]] %[[#uint_0]]89; CHECK: OpStore %[[#tmp]] %[[#uint_0]] Aligned 490 91 ret void92}93 94define internal spir_func void @nested_store_vector() {95 %1 = alloca %struct.SSV, align 496; CHECK: %[[#var:]] = OpVariable %[[#ssv_fp]] Function97 98 store i32 0, ptr %1, align 499; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#uint_fp]] %[[#var]] %[[#uint_0]] %[[#uint_0]] %[[#uint_0]]100; CHECK: OpStore %[[#tmp]] %[[#uint_0]] Aligned 4101 102 ret void103}104 105define internal spir_func void @nested_array_vector() {106 %1 = alloca %struct.SSASSV, align 4107; CHECK: %[[#var:]] = OpVariable %[[#ssassv_fp]] Function108 109 store i32 0, ptr %1, align 4110; CHECK: %[[#tmp:]] = OpInBoundsAccessChain %[[#uint_fp]] %[[#var]] %[[#uint_0]] %[[#uint_0]] %[[#uint_0]] %[[#uint_0]] %[[#uint_0]] %[[#uint_0]]111; CHECK: OpStore %[[#tmp]] %[[#uint_0]] Aligned 4112 113 ret void114}115