Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/SPIRV/logical-struct-access.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

120 lines
3.9 KiB
LLVM

; RUN: llc -O0 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan1.3-compute %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}
; CHECK-DAG: [[uint:%[0-9]+]] = OpTypeInt 32 0
%A = type {
i32,
i32
}
; CHECK-DAG: [[A:%[0-9]+]] = OpTypeStruct [[uint]] [[uint]]
%B = type {
%A,
i32,
%A
}
; CHECK-DAG: [[B:%[0-9]+]] = OpTypeStruct [[A]] [[uint]] [[A]]
; CHECK-DAG: [[uint_0:%[0-9]+]] = OpConstant [[uint]] 0
; CHECK-DAG: [[uint_1:%[0-9]+]] = OpConstant [[uint]] 1
; CHECK-DAG: [[uint_2:%[0-9]+]] = OpConstant [[uint]] 2
; CHECK-DAG: [[ptr_uint:%[0-9]+]] = OpTypePointer Function [[uint]]
; CHECK-DAG: [[ptr_A:%[0-9]+]] = OpTypePointer Function [[A]]
; CHECK-DAG: [[ptr_B:%[0-9]+]] = OpTypePointer Function [[B]]
define internal i32 @load_B_0(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_A]] [[tmp]] [[uint_0]]
%res = getelementptr %B, ptr %base, i32 0, i32 0
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_inbounds_B_0(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpInBoundsAccessChain [[ptr_A]] [[tmp]] [[uint_0]]
%res = getelementptr inbounds %B, ptr %base, i32 0, i32 0
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_B_1(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_uint]] [[tmp]] [[uint_1]]
%res = getelementptr %B, ptr %base, i32 0, i32 1
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_inbounds_B_1(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpInBoundsAccessChain [[ptr_uint]] [[tmp]] [[uint_1]]
%res = getelementptr inbounds %B, ptr %base, i32 0, i32 1
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_B_2(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_A]] [[tmp]] [[uint_2]]
%res = getelementptr %B, ptr %base, i32 0, i32 2
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_inbounds_B_2(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpInBoundsAccessChain [[ptr_A]] [[tmp]] [[uint_2]]
%res = getelementptr inbounds %B, ptr %base, i32 0, i32 2
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_B_2_1(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_uint]] [[tmp]] [[uint_2]] [[uint_1]]
%res = getelementptr %B, ptr %base, i32 0, i32 2, i32 1
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_inbounds_B_2_1(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: {{%[0-9]+}} = OpInBoundsAccessChain [[ptr_uint]] [[tmp]] [[uint_2]] [[uint_1]]
%res = getelementptr inbounds %B, ptr %base, i32 0, i32 2, i32 1
%val = load i32, ptr %res
ret i32 %val
}
define internal i32 @load_B_2_A_1(ptr %base) {
; CHECK: [[tmp:%[0-9]+]] = OpFunctionParameter [[ptr_B]]
; CHECK: [[x:%[0-9]+]] = OpAccessChain [[ptr_A]] [[tmp]] [[uint_2]]
; CHECK: {{%[0-9]+}} = OpAccessChain [[ptr_uint]] [[x]] [[uint_1]]
%x = getelementptr %B, ptr %base, i32 0, i32 2
%res = getelementptr %A, ptr %x, i32 0, i32 1
%val = load i32, ptr %res
ret i32 %val
}
define void @main() #1 {
entry:
%0 = alloca %B, align 4
; CHECK: [[tmp:%[0-9]+]] = OpVariable [[ptr_B]] Function
%1 = call i32 @load_B_0(ptr %0)
%2 = call i32 @load_inbounds_B_0(ptr %0)
%3 = call i32 @load_B_1(ptr %0)
%4 = call i32 @load_inbounds_B_1(ptr %0)
%5 = call i32 @load_B_2(ptr %0)
%6 = call i32 @load_inbounds_B_2(ptr %0)
%7 = call i32 @load_B_2_1(ptr %0)
%8 = call i32 @load_inbounds_B_2_1(ptr %0)
%10 = call i32 @load_B_2_A_1(ptr %0)
ret void
}
attributes #1 = { "hlsl.numthreads"="4,8,16" "hlsl.shader"="compute" }