[compiler-rt] [compiler-rt] Partially enable building compiler-rt unit tests for spirv64 target (PR #215717)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 20:36:35 PDT 2026
https://github.com/jinge90 updated https://github.com/llvm/llvm-project/pull/215717
>From c314f63e1f301445a20cf0997174ad517da9b1cb Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Wed, 12 Aug 2026 12:39:42 +0800
Subject: [PATCH 1/4] [compiler-rt] Partially enable building compiler-rt unit
tests for SPIRV64
Signed-off-by: jinge90 <ge.jin at intel.com>
---
compiler-rt/test/builtins/CMakeLists.txt | 3 +++
compiler-rt/test/builtins/Unit/lit.cfg.py | 11 ++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/test/builtins/CMakeLists.txt b/compiler-rt/test/builtins/CMakeLists.txt
index 6e6fabd3e2c15..729348c5a1978 100644
--- a/compiler-rt/test/builtins/CMakeLists.txt
+++ b/compiler-rt/test/builtins/CMakeLists.txt
@@ -73,6 +73,9 @@ foreach(arch ${BUILTIN_TEST_ARCH})
elseif("${arch}" MATCHES "nvptx")
list(APPEND BUILTINS_TEST_TARGET_CFLAGS
-Wno-multi-gpu -flto -march=native -nogpulib -startfiles -stdlib)
+ elseif("${arch}" MATCHES "spirv64")
+ list(APPEND BUILTINS_TEST_TARGET_CFLAGS
+ -Wno-multi-gpu -nogpulib -mllvm -spirv-ext=+SPV_EXT_relaxed_printf_string_address_space)
endif()
list(APPEND BUILTINS_TEST_TARGET_CFLAGS --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
string(REPLACE ";" " " BUILTINS_TEST_TARGET_CFLAGS "${BUILTINS_TEST_TARGET_CFLAGS}")
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f1ebd61438bd9..0f43fefdecaa1 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -85,7 +85,16 @@ def get_libgcc_file_name():
)
# Check if the linker supports --start-group and --end-group
# For nvptx64 target, it falls back to the default.
- if linker_supports_start_group and "nvptx" not in config.target_arch:
+ if "spirv" in config.target_arch:
+ builtins_bitcode_library = os.path.join(
+ config.compiler_rt_libdir, "libclang_rt.builtins%s.bc" % config.target_suffix)
+ librt_flags = "-Xclang -mlink-builtin-bitcode -Xclang " + builtins_bitcode_library + " "
+ libc_bitcode_library = os.path.join(
+ config.llvm_shlib_dir, config.target_triple, "libcbitcode.bc")
+ if (os.path.exists(libc_bitcode_library)):
+ librt_flags += "-Xclang -mlink-builtin-bitcode -Xclang " + libc_bitcode_library + " "
+ config.substitutions.append(("%librt ", librt_flags))
+ elif linker_supports_start_group and "nvptx" not in config.target_arch:
config.substitutions.append(
(
"%librt ",
>From 0e3a001e03442dc1440dffe74a65b7dbc9557c50 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Wed, 12 Aug 2026 13:34:39 +0800
Subject: [PATCH 2/4] fix clang format
Signed-off-by: jinge90 <ge.jin at intel.com>
---
compiler-rt/test/builtins/Unit/lit.cfg.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index 0f43fefdecaa1..37ecddffca5cd 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -87,12 +87,23 @@ def get_libgcc_file_name():
# For nvptx64 target, it falls back to the default.
if "spirv" in config.target_arch:
builtins_bitcode_library = os.path.join(
- config.compiler_rt_libdir, "libclang_rt.builtins%s.bc" % config.target_suffix)
- librt_flags = "-Xclang -mlink-builtin-bitcode -Xclang " + builtins_bitcode_library + " "
+ config.compiler_rt_libdir,
+ "libclang_rt.builtins%s.bc" % config.target_suffix
+ )
+ librt_flags = (
+ "-Xclang -mlink-builtin-bitcode -Xclang "
+ + builtins_bitcode_library
+ + " "
+ )
libc_bitcode_library = os.path.join(
- config.llvm_shlib_dir, config.target_triple, "libcbitcode.bc")
+ config.llvm_shlib_dir, config.target_triple, "libcbitcode.bc"
+ )
if (os.path.exists(libc_bitcode_library)):
- librt_flags += "-Xclang -mlink-builtin-bitcode -Xclang " + libc_bitcode_library + " "
+ librt_flags += (
+ "-Xclang -mlink-builtin-bitcode -Xclang "
+ + libc_bitcode_library
+ + " "
+ )
config.substitutions.append(("%librt ", librt_flags))
elif linker_supports_start_group and "nvptx" not in config.target_arch:
config.substitutions.append(
>From d8099f8891e4eb82e1410d98f67b296a29623446 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Wed, 12 Aug 2026 13:53:07 +0800
Subject: [PATCH 3/4] fix clang format
Signed-off-by: jinge90 <ge.jin at intel.com>
---
compiler-rt/test/builtins/Unit/lit.cfg.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index 37ecddffca5cd..c0b97f8360f15 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -88,7 +88,7 @@ def get_libgcc_file_name():
if "spirv" in config.target_arch:
builtins_bitcode_library = os.path.join(
config.compiler_rt_libdir,
- "libclang_rt.builtins%s.bc" % config.target_suffix
+ "libclang_rt.builtins%s.bc" % config.target_suffix,
)
librt_flags = (
"-Xclang -mlink-builtin-bitcode -Xclang "
@@ -98,7 +98,7 @@ def get_libgcc_file_name():
libc_bitcode_library = os.path.join(
config.llvm_shlib_dir, config.target_triple, "libcbitcode.bc"
)
- if (os.path.exists(libc_bitcode_library)):
+ if os.path.exists(libc_bitcode_library):
librt_flags += (
"-Xclang -mlink-builtin-bitcode -Xclang "
+ libc_bitcode_library
>From 5cef8d8156b56a5c9493943ce9a814dff15d7376 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Thu, 13 Aug 2026 11:33:39 +0800
Subject: [PATCH 4/4] address review comments
Signed-off-by: jinge90 <ge.jin at intel.com>
---
compiler-rt/test/builtins/Unit/lit.cfg.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index c0b97f8360f15..05f97844f5470 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -83,8 +83,6 @@ def get_libgcc_file_name():
linker_supports_start_group = get_required_attr(
config, "linker_supports_start_group"
)
- # Check if the linker supports --start-group and --end-group
- # For nvptx64 target, it falls back to the default.
if "spirv" in config.target_arch:
builtins_bitcode_library = os.path.join(
config.compiler_rt_libdir,
@@ -105,6 +103,8 @@ def get_libgcc_file_name():
+ " "
)
config.substitutions.append(("%librt ", librt_flags))
+ # Check if the linker supports --start-group and --end-group
+ # For nvptx64 target, it falls back to the default.
elif linker_supports_start_group and "nvptx" not in config.target_arch:
config.substitutions.append(
(
More information about the llvm-commits
mailing list