[OpenMP][cmake] Add SPARC support (#142364)

This patch adds SPARC infrastructure to the `openmp` `cmake` files,
matching what is done for other architectures.

Tested on `sparc-sun-solaris2.11`, `sparcv9-sun-solaris2.11`,
`sparc-unknown-linux-gnu`, `sparc64-unknown-linux-gnu`,
`i386-pc-solaris2.11`, `amd64-pc-solaris2.11`, `i686-pc-linux-gnu`, and
`x86_64-pc-linux-gnu`.
This commit is contained in:
Rainer Orth 2025-06-07 09:55:05 +02:00 committed by GitHub
parent 692c5cdb56
commit 3f8827eaba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -190,6 +190,8 @@ set(VE FALSE)
set(S390X FALSE)
set(WASM FALSE)
set(PPC FALSE)
set(SPARC FALSE)
set(SPARCV9 FALSE)
if("${LIBOMP_ARCH}" STREQUAL "i386" OR "${LIBOMP_ARCH}" STREQUAL "32") # IA-32 architecture
set(IA32 TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "x86_64" OR "${LIBOMP_ARCH}" STREQUAL "32e") # Intel(R) 64 architecture
@ -226,6 +228,10 @@ elseif("${LIBOMP_ARCH}" STREQUAL "s390x") # S390x (Z) architecture
set(S390X TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "wasm32") # WebAssembly architecture
set(WASM TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "sparc") # SPARC architecture
set(SPARC TRUE)
elseif("${LIBOMP_ARCH}" STREQUAL "sparcv9") # SPARC V9 architecture
set(SPARCV9 TRUE)
endif()
# Set some flags based on build_type

View File

@ -117,6 +117,10 @@ function(libomp_get_legal_arch return_arch_string)
set(${return_arch_string} "VE" PARENT_SCOPE)
elseif(${S390X})
set(${return_arch_string} "S390X" PARENT_SCOPE)
elseif(${SPARC})
set(${return_arch_string} "SPARC" PARENT_SCOPE)
elseif(${SPARCV9})
set(${return_arch_string} "SPARCV9" PARENT_SCOPE)
else()
set(${return_arch_string} "${LIBOMP_ARCH}" PARENT_SCOPE)
libomp_warning_say("libomp_get_legal_arch(): Warning: Unknown architecture: Using ${LIBOMP_ARCH}")