Files
TheRock/compiler/amd-llvm/clang/test/AST/ast-print-amdgcn-predicate.c
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

89 lines
3.6 KiB
C

// REQUIRES: amdgpu-registered-target
// Regression test for issue #199563: -ast-print on
// __builtin_amdgcn_is_invocable / __builtin_amdgcn_processor_is used to
// crash because the expansion produced an IntegerLiteral typed _Bool/bool.
// C (C11 and C23): IntegerLiteral 'int' implicit-cast to _Bool.
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -std=c11 \
// RUN: -ast-print %s | FileCheck --check-prefix=INT-TRUE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx900 -std=c11 \
// RUN: -ast-print %s | FileCheck --check-prefix=INT-FALSE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -std=c11 \
// RUN: -ast-dump %s | FileCheck --check-prefix=INT-DUMP %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -std=c23 \
// RUN: -ast-print %s | FileCheck --check-prefix=INT-TRUE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx900 -std=c23 \
// RUN: -ast-print %s | FileCheck --check-prefix=INT-FALSE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -std=c23 \
// RUN: -ast-dump %s | FileCheck --check-prefix=INT-DUMP %s
// C++ / HIP device: CXXBoolLiteralExpr 'bool'.
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -x c++ \
// RUN: -std=c++17 -ast-print %s | FileCheck --check-prefix=BOOL-TRUE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx900 -x c++ \
// RUN: -std=c++17 -ast-print %s | FileCheck --check-prefix=BOOL-FALSE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -x c++ \
// RUN: -std=c++17 -ast-dump %s | FileCheck --check-prefix=BOOL-DUMP %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -x hip \
// RUN: -fcuda-is-device -ast-print %s \
// RUN: | FileCheck --check-prefix=BOOL-TRUE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx900 -x hip \
// RUN: -fcuda-is-device -ast-print %s \
// RUN: | FileCheck --check-prefix=BOOL-FALSE %s
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx942 -x hip \
// RUN: -fcuda-is-device -ast-dump %s \
// RUN: | FileCheck --check-prefix=BOOL-DUMP %s
#if defined(__HIP__) || defined(__CUDA__)
#define __device__ __attribute__((device))
#else
#define __device__
#endif
__device__ void use_is_invocable(void) {
if (__builtin_amdgcn_is_invocable(__builtin_amdgcn_flat_atomic_fadd_f32))
(void)0;
}
__device__ void use_processor_is(void) {
if (__builtin_amdgcn_processor_is("gfx942"))
(void)0;
}
// INT-TRUE-LABEL: use_is_invocable
// INT-TRUE: if (1)
// INT-TRUE-LABEL: use_processor_is
// INT-TRUE: if (1)
// INT-FALSE-LABEL: use_is_invocable
// INT-FALSE: if (0)
// INT-FALSE-LABEL: use_processor_is
// INT-FALSE: if (0)
// BOOL-TRUE-LABEL: use_is_invocable
// BOOL-TRUE: if (true)
// BOOL-TRUE-LABEL: use_processor_is
// BOOL-TRUE: if (true)
// BOOL-FALSE-LABEL: use_is_invocable
// BOOL-FALSE: if (false)
// BOOL-FALSE-LABEL: use_processor_is
// BOOL-FALSE: if (false)
// INT-DUMP-LABEL: FunctionDecl {{.*}} use_is_invocable
// INT-DUMP: IfStmt
// INT-DUMP-NEXT: ImplicitCastExpr {{.*}} {{'_Bool'|'bool'}} <IntegralToBoolean>
// INT-DUMP-NEXT: IntegerLiteral {{.*}} 'int' 1
// INT-DUMP-LABEL: FunctionDecl {{.*}} use_processor_is
// INT-DUMP: IfStmt
// INT-DUMP-NEXT: ImplicitCastExpr {{.*}} {{'_Bool'|'bool'}} <IntegralToBoolean>
// INT-DUMP-NEXT: IntegerLiteral {{.*}} 'int' 1
// BOOL-DUMP-LABEL: FunctionDecl {{.*}} use_is_invocable
// BOOL-DUMP: IfStmt
// BOOL-DUMP-NEXT: CXXBoolLiteralExpr {{.*}} 'bool' true
// BOOL-DUMP-LABEL: FunctionDecl {{.*}} use_processor_is
// BOOL-DUMP: IfStmt
// BOOL-DUMP-NEXT: CXXBoolLiteralExpr {{.*}} 'bool' true