From f540525b91a1030dcec670e7318432e9c12034cc Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Tue, 29 Jul 2025 20:00:38 +0000 Subject: [PATCH] [clang][X86] Update __cpuidex_conflict.c test post #126324 It does not look like __cpuidex builtins are being incorrectly included in compilations for offload targets anymore, so change up the test to assume that we are defining __cpuidex as static in cpuid.h now that \#126324 updates the behavior of __has_builtin on offload compilations. This ensures we are still testing that we are avoiding the conflicts around offloading that were first pointed out in https://reviews.llvm.org/D150646. --- clang/test/Headers/__cpuidex_conflict.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/clang/test/Headers/__cpuidex_conflict.c b/clang/test/Headers/__cpuidex_conflict.c index 49795c447f6e0..74f45327de2bb 100644 --- a/clang/test/Headers/__cpuidex_conflict.c +++ b/clang/test/Headers/__cpuidex_conflict.c @@ -1,19 +1,17 @@ // Make sure that __cpuidex in cpuid.h doesn't conflict with the MS // extensions built in by ensuring compilation succeeds: -// RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \ -// RUN: -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o - -// %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o - -// -// FIXME: See https://github.com/llvm/llvm-project/pull/121839 and -// FIXME: https://github.com/llvm/llvm-project/pull/126324 -// RUN: not %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu +// RUN: %clang_cc1 %s -DIS_STATIC="" -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o - +// RUN: %clang_cc1 %s -DIS_STATIC="" -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o - + +// Ensure that we do not run into conflicts when offloading. +// RUN: %clang_cc1 %s -DIS_STATIC=static -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu typedef __SIZE_TYPE__ size_t; // We declare __cpuidex here as where the buitlin should be exposed (MSVC), the // declaration is in , but is not available from all the // targets that are being tested here. -void __cpuidex (int[4], int, int); +IS_STATIC void __cpuidex (int[4], int, int); #include @@ -22,4 +20,3 @@ int cpuid_info[4]; void test_cpuidex(unsigned level, unsigned count) { __cpuidex(cpuid_info, level, count); } -