@@ -23,7 +23,9 @@ option(
2323)
2424
2525# List of all supported architectures.
26- set ( LIBCLC_ARCHS_ALL amdgpu amdgcn nvptx64 spirv spirv32 spirv64 )
26+ set ( LIBCLC_ARCHS_ALL amdgpu amdgcn nvptx64 )
27+ set ( LIBCLC_ARCHS_SPIRV spirv spirv32 spirv64)
28+ list ( APPEND LIBCLC_ARCHS_ALL ${LIBCLC_ARCHS_SPIRV} )
2729
2830set (LIBCLC_TARGET ${LLVM_DEFAULT_TARGET_TRIPLE} )
2931
@@ -100,7 +102,7 @@ string( REPLACE "-" ";" TRIPLE ${LIBCLC_TARGET} )
100102list (GET TRIPLE 0 ARCH)
101103list (GET TRIPLE 2 OS)
102104
103- if (ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64 )
105+ if (ARCH IN_LIST LIBCLC_ARCHS_SPIRV )
104106 if (NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND AND NOT llvm-spirv_exe)
105107 message (FATAL_ERROR "SPIR-V backend or llvm-spirv is required for libclc ${LIBCLC_TARGET} " )
106108 endif ()
@@ -138,7 +140,7 @@ add_dependencies( libclc libclc-opencl-builtins )
138140# Determine the clang target triple. Vulkan and SPIR-V backend targets use the
139141# triple directly; other SPIR-V targets fall back to the legacy SPIR target.
140142set (clang_triple ${LIBCLC_TARGET} )
141- if (ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64 )
143+ if (ARCH IN_LIST LIBCLC_ARCHS_SPIRV )
142144 if (NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND)
143145 if (ARCH STREQUAL spirv)
144146 set (clang_triple spir--)
@@ -154,7 +156,7 @@ set(generic_addrspace_val 0)
154156if (ARCH STREQUAL amdgcn)
155157 set (private_addrspace_val 5)
156158endif ()
157- if (( ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64) AND NOT OS STREQUAL vulkan)
159+ if (ARCH IN_LIST LIBCLC_ARCHS_SPIRV AND NOT OS STREQUAL vulkan)
158160 set (generic_addrspace_val 4)
159161endif ()
160162
@@ -163,7 +165,7 @@ set(target_compile_flags)
163165set (target_extra_defines)
164166set (opt_flags -O3)
165167
166- if (ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64 )
168+ if (ARCH IN_LIST LIBCLC_ARCHS_SPIRV )
167169 if (OS STREQUAL vulkan)
168170 list (APPEND target_compile_flags -Wno-unknown-assumption -U__opencl_c_int64)
169171 else ()
@@ -181,7 +183,7 @@ if(ARCH STREQUAL amdgcn)
181183 list (APPEND _clc_overrides ${CLC_AMDGPU_SOURCES} )
182184elseif (ARCH STREQUAL nvptx64 AND (OS STREQUAL nvidiacl OR OS STREQUAL cuda))
183185 list (APPEND _clc_overrides ${CLC_PTX_NVIDIACL_SOURCES} )
184- elseif (ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64 )
186+ elseif (ARCH IN_LIST LIBCLC_ARCHS_SPIRV )
185187 if (OS STREQUAL vulkan)
186188 list (APPEND _clc_overrides ${CLC_VULKAN_SOURCES} )
187189 else ()
@@ -192,7 +194,7 @@ libclc_merge_sources(clc_sources ${CLC_GENERIC_SOURCES} ${_clc_overrides})
192194
193195# Collect OpenCL sources. SPIR-V and Vulkan targets use self-contained
194196# subsets while others merge with target-specific overrides.
195- if (ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64 )
197+ if (ARCH IN_LIST LIBCLC_ARCHS_SPIRV )
196198 if (OS STREQUAL vulkan)
197199 set (opencl_sources ${OPENCL_VULKAN_SOURCES} )
198200 else ()
0 commit comments