Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/AMDGPU/nullptr-in-different-address-spaces.cpp
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

57 lines
2.8 KiB
C++

// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx900 -O1 -emit-llvm -o - %s | FileCheck %s
// REQUIRES: amdgpu-registered-target
extern __attribute__((address_space(3))) unsigned char * ptr_as3; // local address space
extern __attribute__((address_space(5))) unsigned char * ptr_as5; // private address space
// CHECK-LABEL: define dso_local noundef ptr @_Z11get_ptr_as3b(
// CHECK-SAME: i1 noundef zeroext [[V:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(3), ptr addrspace(1) @ptr_as3, align 4
// CHECK-NEXT: [[TMP1:%.*]] = select i1 [[V]], ptr addrspace(3) [[TMP0]], ptr addrspace(3) addrspacecast (ptr null to ptr addrspace(3))
// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(3) [[TMP1]] to ptr
// CHECK-NEXT: ret ptr [[TMP2]]
//
unsigned char *get_ptr_as3(bool v) {
return v ? ptr_as3 : nullptr;
}
// CHECK-LABEL: define dso_local noundef ptr @_Z20get_ptr_as3_with_tmpb(
// CHECK-SAME: i1 noundef zeroext [[V:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(3), ptr addrspace(1) @ptr_as3, align 4
// CHECK-NEXT: [[TMP1:%.*]] = select i1 [[V]], ptr addrspace(3) [[TMP0]], ptr addrspace(3) addrspacecast (ptr null to ptr addrspace(3))
// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(3) [[TMP1]] to ptr
// CHECK-NEXT: ret ptr [[TMP2]]
//
unsigned char *get_ptr_as3_with_tmp(bool v) {
unsigned char *tmp = nullptr;
return v ? ptr_as3 : tmp;
}
// CHECK-LABEL: define dso_local noundef ptr @_Z11get_ptr_as5b(
// CHECK-SAME: i1 noundef zeroext [[V:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(5), ptr addrspace(1) @ptr_as5, align 4
// CHECK-NEXT: [[TMP1:%.*]] = select i1 [[V]], ptr addrspace(5) [[TMP0]], ptr addrspace(5) addrspacecast (ptr null to ptr addrspace(5))
// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(5) [[TMP1]] to ptr
// CHECK-NEXT: ret ptr [[TMP2]]
//
unsigned char *get_ptr_as5(bool v) {
return v ? ptr_as5 : nullptr;
}
// CHECK-LABEL: define dso_local noundef ptr @_Z20get_ptr_as5_with_tmpb(
// CHECK-SAME: i1 noundef zeroext [[V:%.*]]) local_unnamed_addr #[[ATTR1]] {
// CHECK-NEXT: [[ENTRY:.*:]]
// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(5), ptr addrspace(1) @ptr_as5, align 4
// CHECK-NEXT: [[TMP1:%.*]] = select i1 [[V]], ptr addrspace(5) [[TMP0]], ptr addrspace(5) addrspacecast (ptr null to ptr addrspace(5))
// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(5) [[TMP1]] to ptr
// CHECK-NEXT: ret ptr [[TMP2]]
//
unsigned char *get_ptr_as5_with_tmp(bool v) {
unsigned char *tmp = nullptr;
return v ? ptr_as5 : tmp;
}