[compiler-rt] [compiler-rt] Disable tests for unavailable builtins (PR #161275)

Akira Hatanaka via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 14:02:57 PDT 2025


Martin =?utf-8?q?Storsjö?= <martin at martin.st>
Message-ID: <llvm.org/llvm/llvm-project/pull/161275 at github.com>
In-Reply-To:


https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/161275

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.

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.

This reapplies e9e166e54354330c474457711a8e7a7ca2efd731 and 656707086e5f6fccd2eb57f5aaf987c328c0f4f1 after fixing declarations of
the builtins in the tests in b54250940c2cd70f911386b02239b50c165e5354.

rdar://159705803
rdar://159705705

Co-authored-by: Martin Storsjö <martin at martin.st>

>From c9492a06427fe95147470cdb1336adda2ae0cda2 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka <ahatanak at gmail.com>
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 <stdio.h>
 
-#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 <stdio.h>
 
-#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?= <martin at martin.st>
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 <stdio.h>
+#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 <stdio.h>
+#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 <math.h>
 #include <complex.h>
 



More information about the llvm-commits mailing list