From c9492a06427fe95147470cdb1336adda2ae0cda2 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 24 Sep 2025 13:11:38 -0700 Subject: [PATCH 1/2] [compiler-rt] Disable tests for unavailable builtins (#158664) The builtins `__fixunstfdi` and `__multc3` may be removed by the preprocessor depending on configuration flags. When this happens, the corresponding tests fail at link time due to missing definitions. Disable these tests when the builtins are not available. rdar://159705803 rdar://159705705 --- compiler-rt/test/builtins/Unit/fixunstfdi_test.c | 4 ++-- compiler-rt/test/builtins/Unit/multc3_test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index 14f0f7f1565a4..c340de173f990 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -4,7 +4,7 @@ #include -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if defined(CRT_HAS_TF_MODE) #define QUAD_PRECISION #include "fp_lib.h" @@ -38,7 +38,7 @@ char assumption_3[sizeof(fp_t)*CHAR_BIT == 128] = {0}; int main() { -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if defined(CRT_HAS_TF_MODE) if (test__fixunstfdi(0.0, 0)) return 1; diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index 5eec56dc43033..ed564a6fb714a 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -4,7 +4,7 @@ #include -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) #define QUAD_PRECISION #include "fp_lib.h" @@ -351,7 +351,7 @@ fp_t x[][2] = int main() { -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) const unsigned N = sizeof(x) / sizeof(x[0]); unsigned i, j; for (i = 0; i < N; ++i) From ad196655a9eff7c6b25e49d27bf11cc074758f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 26 Sep 2025 11:49:33 +0300 Subject: [PATCH 2/2] [compiler-rt] Fix test ifdefs and XFAILs (#160687) This fixes the ifdefs added in e9e166e54354330c474457711a8e7a7ca2efd731; we need to include int_lib.h first before we can expect these defines to be set. Also remove the XFAILs for aarch64 windows. As this test now became a no-op on platforms that lack CRT_HAS_128BIT or CRT_HAS_F128 (aarch64 windows lacks the latter), it no longer fails. --- compiler-rt/test/builtins/Unit/fixunstfdi_test.c | 4 +--- compiler-rt/test/builtins/Unit/multc3_test.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index c340de173f990..526ba5ca80cf6 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -1,16 +1,14 @@ -// XFAIL: target=aarch64-{{.*}}-windows-{{.*}} // RUN: %clang_builtins %s %librt -o %t && %run %t // REQUIRES: librt_has_fixunstfdi #include +#include "int_lib.h" #if defined(CRT_HAS_TF_MODE) #define QUAD_PRECISION #include "fp_lib.h" -#include "int_lib.h" - // Returns: convert a to a unsigned long long, rounding toward zero. // Negative values all become zero. diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index ed564a6fb714a..18561cc344437 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -1,15 +1,14 @@ -// XFAIL: target=aarch64-{{.*}}-windows-{{.*}} // RUN: %clang_builtins %s %librt -o %t && %run %t // REQUIRES: librt_has_multc3 #include +#include "int_lib.h" #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) #define QUAD_PRECISION #include "fp_lib.h" -#include "int_lib.h" #include #include