https://github.com/jhuber6 updated 
https://github.com/llvm/llvm-project/pull/182125

>From e205d5a53c7e0eb18eadb1b9b8caf4edd6836a66 Mon Sep 17 00:00:00 2001
From: Joseph Huber <[email protected]>
Date: Wed, 18 Feb 2026 20:21:02 -0600
Subject: [PATCH 1/2] [libclc] Remove subnormal support

Summary:
This isn't really used and this simplifies the code. I could go deeper
to remove this content entirely as they all return `false` but I figured
this was an easier change to do first.
---
 libclc/CMakeLists.txt                         | 21 -------------------
 libclc/opencl/lib/clspv/SOURCES               |  1 -
 libclc/opencl/lib/clspv/subnormal_config.cl   | 16 --------------
 libclc/opencl/lib/generic/SOURCES             |  1 -
 libclc/opencl/lib/generic/subnormal_config.cl |  6 +++++-
 .../opencl/lib/generic/subnormal_disable.ll   |  9 --------
 .../lib/generic/subnormal_helper_func.ll      | 16 --------------
 .../lib/generic/subnormal_use_default.ll      |  9 --------
 libclc/opencl/lib/spirv/SOURCES               |  1 -
 libclc/opencl/lib/spirv/subnormal_config.cl   | 16 --------------
 10 files changed, 5 insertions(+), 91 deletions(-)
 delete mode 100644 libclc/opencl/lib/clspv/subnormal_config.cl
 delete mode 100644 libclc/opencl/lib/generic/subnormal_disable.ll
 delete mode 100644 libclc/opencl/lib/generic/subnormal_helper_func.ll
 delete mode 100644 libclc/opencl/lib/generic/subnormal_use_default.ll
 delete mode 100644 libclc/opencl/lib/spirv/subnormal_config.cl

diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 77c3dca51d3d5..8146526c701d6 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -42,8 +42,6 @@ endif()
 set( LIBCLC_TARGETS_TO_BUILD ${LIBCLC_DEFAULT_TARGET}
     CACHE STRING "Semicolon-separated list of libclc targets to build, or 
'all'." )
 
-option( ENABLE_RUNTIME_SUBNORMAL "Enable runtime linking of subnormal 
support." OFF )
-
 option(
   LIBCLC_USE_SPIRV_BACKEND "Build SPIR-V targets with the SPIR-V backend." OFF
 )
@@ -216,19 +214,6 @@ set( cayman_aliases aruba )
 configure_file( libclc.pc.in libclc.pc @ONLY )
 install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION 
"${CMAKE_INSTALL_DATADIR}/pkgconfig" )
 
-if( ENABLE_RUNTIME_SUBNORMAL )
-  foreach( file IN ITEMS subnormal_use_default subnormal_disable )
-    link_bc(
-       TARGET ${file}
-       INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/${file}.ll
-    )
-    install(
-      FILES $<TARGET_PROPERTY:${file},TARGET_FILE>
-      DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
-    )
-  endforeach()
-endif()
-
 set_source_files_properties(
   # CLC builtins
   ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_cos.cl
@@ -326,12 +311,6 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
 
   set( opencl_lib_files )
 
-  if( NOT ARCH STREQUAL spirv AND NOT ARCH STREQUAL spirv64 AND
-      NOT ARCH STREQUAL clspv AND NOT ARCH STREQUAL clspv64 AND
-      NOT ENABLE_RUNTIME_SUBNORMAL )
-    list( APPEND opencl_lib_files opencl/lib/generic/subnormal_use_default.ll )
-  endif()
-
   libclc_configure_lib_source(
     opencl_lib_files
     LIB_ROOT_DIR opencl
diff --git a/libclc/opencl/lib/clspv/SOURCES b/libclc/opencl/lib/clspv/SOURCES
index 8537d7c2d6b42..ccfea5bd16ea4 100644
--- a/libclc/opencl/lib/clspv/SOURCES
+++ b/libclc/opencl/lib/clspv/SOURCES
@@ -4,7 +4,6 @@ conversion/convert_int2float.cl
 conversion/convert_integer.cl
 math/fma.cl
 shared/vstore_half.cl
-subnormal_config.cl
 ../generic/geometric/distance.cl
 ../generic/geometric/length.cl
 ../generic/math/acos.cl
diff --git a/libclc/opencl/lib/clspv/subnormal_config.cl 
b/libclc/opencl/lib/clspv/subnormal_config.cl
deleted file mode 100644
index 114aabb2e9435..0000000000000
--- a/libclc/opencl/lib/clspv/subnormal_config.cl
+++ /dev/null
@@ -1,16 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <clc/math/clc_subnormal_config.h>
-#include <clc/opencl/opencl-base.h>
-
-_CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
-
-_CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
-
-_CLC_DEF bool __clc_fp64_subnormals_supported() { return false; }
diff --git a/libclc/opencl/lib/generic/SOURCES 
b/libclc/opencl/lib/generic/SOURCES
index a2c6af8b9252c..c820c6c3c0c06 100644
--- a/libclc/opencl/lib/generic/SOURCES
+++ b/libclc/opencl/lib/generic/SOURCES
@@ -1,5 +1,4 @@
 subnormal_config.cl
-subnormal_helper_func.ll
 async/async_work_group_copy.cl
 async/async_work_group_strided_copy.cl
 async/prefetch.cl
diff --git a/libclc/opencl/lib/generic/subnormal_config.cl 
b/libclc/opencl/lib/generic/subnormal_config.cl
index aa2e30935e5f0..3b2dda952af07 100644
--- a/libclc/opencl/lib/generic/subnormal_config.cl
+++ b/libclc/opencl/lib/generic/subnormal_config.cl
@@ -14,5 +14,9 @@ _CLC_DEF bool __clc_fp16_subnormals_supported() { return 
false; }
 _CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
 
 _CLC_DEF bool __clc_fp64_subnormals_supported() {
-  return !__clc_subnormals_disabled();
+#if defined(__SPIRV__) || defined(__SPIR32__)
+  return false;
+#else
+  return true;
+#endif
 }
diff --git a/libclc/opencl/lib/generic/subnormal_disable.ll 
b/libclc/opencl/lib/generic/subnormal_disable.ll
deleted file mode 100644
index 732d09ff09ab4..0000000000000
--- a/libclc/opencl/lib/generic/subnormal_disable.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-;;===----------------------------------------------------------------------===;;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;;===----------------------------------------------------------------------===;;
-
-@__CLC_SUBNORMAL_DISABLE = unnamed_addr constant i1 true
diff --git a/libclc/opencl/lib/generic/subnormal_helper_func.ll 
b/libclc/opencl/lib/generic/subnormal_helper_func.ll
deleted file mode 100644
index 03beecf979260..0000000000000
--- a/libclc/opencl/lib/generic/subnormal_helper_func.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-;;===----------------------------------------------------------------------===;;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;;===----------------------------------------------------------------------===;;
-
-@__CLC_SUBNORMAL_DISABLE = external global i1
-
-define i1 @__clc_subnormals_disabled() #0 {
-  %disable = load i1, i1* @__CLC_SUBNORMAL_DISABLE
-  ret i1 %disable
-}
-
-attributes #0 = { alwaysinline }
diff --git a/libclc/opencl/lib/generic/subnormal_use_default.ll 
b/libclc/opencl/lib/generic/subnormal_use_default.ll
deleted file mode 100644
index c648cc0a8aded..0000000000000
--- a/libclc/opencl/lib/generic/subnormal_use_default.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-;;===----------------------------------------------------------------------===;;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;;===----------------------------------------------------------------------===;;
-
-@__CLC_SUBNORMAL_DISABLE = unnamed_addr constant i1 false
diff --git a/libclc/opencl/lib/spirv/SOURCES b/libclc/opencl/lib/spirv/SOURCES
index 6b7fa8261f6d9..ea5f9dee9f64d 100644
--- a/libclc/opencl/lib/spirv/SOURCES
+++ b/libclc/opencl/lib/spirv/SOURCES
@@ -1,4 +1,3 @@
-subnormal_config.cl
 ../generic/async/async_work_group_strided_copy.cl
 ../generic/async/wait_group_events.cl
 ../generic/common/degrees.cl
diff --git a/libclc/opencl/lib/spirv/subnormal_config.cl 
b/libclc/opencl/lib/spirv/subnormal_config.cl
deleted file mode 100644
index 114aabb2e9435..0000000000000
--- a/libclc/opencl/lib/spirv/subnormal_config.cl
+++ /dev/null
@@ -1,16 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <clc/math/clc_subnormal_config.h>
-#include <clc/opencl/opencl-base.h>
-
-_CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
-
-_CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
-
-_CLC_DEF bool __clc_fp64_subnormals_supported() { return false; }

>From b4e3d6f24fd4ac70f4cd62448021036a3fc805d3 Mon Sep 17 00:00:00 2001
From: Joseph Huber <[email protected]>
Date: Wed, 18 Feb 2026 23:01:17 -0600
Subject: [PATCH 2/2] Update libclc/opencl/lib/generic/subnormal_config.cl

Co-authored-by: Wenju He <[email protected]>
---
 libclc/opencl/lib/generic/subnormal_config.cl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libclc/opencl/lib/generic/subnormal_config.cl 
b/libclc/opencl/lib/generic/subnormal_config.cl
index 3b2dda952af07..799acc063d350 100644
--- a/libclc/opencl/lib/generic/subnormal_config.cl
+++ b/libclc/opencl/lib/generic/subnormal_config.cl
@@ -14,7 +14,7 @@ _CLC_DEF bool __clc_fp16_subnormals_supported() { return 
false; }
 _CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
 
 _CLC_DEF bool __clc_fp64_subnormals_supported() {
-#if defined(__SPIRV__) || defined(__SPIR32__)
+#if defined(CLC_SPIRV) || defined(CLC_CLSPV)
   return false;
 #else
   return true;

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to