Files
TheRock/compiler/amd-llvm/clang/test/CIR/Lowering/address-space.cir
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

46 lines
2.1 KiB
Plaintext

// RUN: cir-translate %s -cir-to-llvmir --target spirv64-unknown-unknown -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
!s32i = !cir.int<s, 32>
module {
cir.global external target_address_space(7) @addrspace3 = #cir.int<3> : !s32i
// LLVM: @addrspace3 = addrspace(7) global i32
// Test GlobalViewAttr with address space cast.
cir.global external target_address_space(1) @global_in_as1 = #cir.int<42> : !s32i
// LLVM: @global_in_as1 = addrspace(1) global i32 42
// Reference to @global_in_as1 with a pointer in default address space (0).
// Both the base type (void vs i32) and address space (1 vs 0) differ.
cir.global external @ref_with_addrspacecast = #cir.const_array<[#cir.global_view<@global_in_as1> : !cir.ptr<!cir.void>]> : !cir.array<!cir.ptr<!cir.void> x 1>
// LLVM: @ref_with_addrspacecast = global [1 x ptr] [ptr addrspacecast (ptr addrspace(1) @global_in_as1 to ptr)]
// Same base type but different address space.
cir.global external target_address_space(1) @counter = #cir.int<42> : !s32i
// LLVM: @counter = addrspace(1) global i32 42
cir.global external @slot = #cir.const_array<[#cir.global_view<@counter> : !cir.ptr<!s32i>]> : !cir.array<!cir.ptr<!s32i> x 1>
// LLVM: @slot = global [1 x ptr] [ptr addrspacecast (ptr addrspace(1) @counter to ptr)]
// LLVM: define void @foo(ptr %0)
cir.func @foo(%arg0: !cir.ptr<!s32i>) {
// LLVM-NEXT: alloca ptr,
%0 = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["arg", init] {alignment = 8 : i64}
cir.return
}
// LLVM: define void @bar(ptr addrspace(1) %0)
cir.func @bar(%arg0: !cir.ptr<!s32i, target_address_space(1)>) {
// LLVM-NEXT: alloca ptr addrspace(1)
%0 = cir.alloca !cir.ptr<!s32i, target_address_space(1)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(1)>>, ["arg", init] {alignment = 8 : i64}
cir.return
}
// LLVM: define void @baz(ptr %0)
cir.func @baz(%arg0: !cir.ptr<!s32i, target_address_space(0)>) {
// LLVM-NEXT: alloca ptr,
%0 = cir.alloca !cir.ptr<!s32i, target_address_space(0)>, !cir.ptr<!cir.ptr<!s32i, target_address_space(0)>>, ["arg", init] {alignment = 8 : i64}
cir.return
}
}