mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 19:45:41 -04:00
[cmake] CPUInstructionSetFlags.cmake: Check for arm_neon.h when building for ARM.
[librpbyteswap,librptexture] If arm_neon.h isn't available, don't compile any NEON-optimized functions. Just in case someone wants to build rom-properties for an ancient ARM system that was introduced before NEON...
This commit is contained in:
parent
fd85248c27
commit
acbd20859b
@ -110,3 +110,10 @@ IF(CPU_i386 OR CPU_amd64)
|
|||||||
SET(SSE41_FLAG "-msse4.1")
|
SET(SSE41_FLAG "-msse4.1")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(CPU_i386 OR CPU_amd64)
|
ENDIF(CPU_i386 OR CPU_amd64)
|
||||||
|
|
||||||
|
IF(CPU_arm OR CPU_arm64 OR CPU_arm64ec)
|
||||||
|
# Check for arm_neon.h.
|
||||||
|
# NOTE: Should always be present for arm64, but check anyway.
|
||||||
|
INCLUDE(CheckIncludeFile)
|
||||||
|
CHECK_INCLUDE_FILE("arm_neon.h" HAVE_ARM_NEON_H)
|
||||||
|
ENDIF(CPU_arm OR CPU_arm64 OR CPU_arm64ec)
|
||||||
|
@ -48,8 +48,11 @@ IF(CPU_i386 OR CPU_amd64)
|
|||||||
|
|
||||||
SET(${PROJECT_NAME}_CPU_SRCS ${${PROJECT_NAME}_MMX_SRCS} ${${PROJECT_NAME}_SSE2_SRCS} ${${PROJECT_NAME}_SSSE3_SRCS})
|
SET(${PROJECT_NAME}_CPU_SRCS ${${PROJECT_NAME}_MMX_SRCS} ${${PROJECT_NAME}_SSE2_SRCS} ${${PROJECT_NAME}_SSSE3_SRCS})
|
||||||
ELSEIF(CPU_arm OR CPU_arm64)
|
ELSEIF(CPU_arm OR CPU_arm64)
|
||||||
SET(${PROJECT_NAME}_CPU_SRCS byteswap_neon.c)
|
IF(HAVE_ARM_NEON_H)
|
||||||
|
SET(${PROJECT_NAME}_CPU_SRCS byteswap_neon.c)
|
||||||
|
ENDIF(HAVE_ARM_NEON_H)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
UNSET(arch)
|
||||||
|
|
||||||
# gcc byteswapping intrinsics.
|
# gcc byteswapping intrinsics.
|
||||||
IF(NOT MSVC)
|
IF(NOT MSVC)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* ROM Properties Page shell extension. (librpbyteswap) *
|
* ROM Properties Page shell extension. (librpbyteswap) *
|
||||||
* byteswap_neon.c: Byteswapping functions. *
|
* byteswap_arm64.c: Byteswapping functions. *
|
||||||
* NEON-optimized version. *
|
* NEON-optimized version. *
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2008-2025 by David Korth *
|
* Copyright (c) 2008-2025 by David Korth *
|
||||||
|
@ -39,13 +39,15 @@
|
|||||||
#ifdef RP_CPU_AMD64
|
#ifdef RP_CPU_AMD64
|
||||||
# define BYTESWAP_ALWAYS_HAS_SSE2 1
|
# define BYTESWAP_ALWAYS_HAS_SSE2 1
|
||||||
#endif /* RP_CPU_AMD64 */
|
#endif /* RP_CPU_AMD64 */
|
||||||
#if defined(RP_CPU_ARM) || defined(RP_CPU_ARM64)
|
#ifdef HAVE_ARM_NEON_H
|
||||||
# include "librpcpuid/cpuflags_arm.h"
|
# if defined(RP_CPU_ARM) || defined(RP_CPU_ARM64)
|
||||||
# define BYTESWAP_HAS_NEON 1
|
# include "librpcpuid/cpuflags_arm.h"
|
||||||
#endif
|
# define BYTESWAP_HAS_NEON 1
|
||||||
#ifdef RP_CPU_ARM64
|
# endif
|
||||||
# define BYTESWAP_ALWAYS_HAS_NEON 1
|
# ifdef RP_CPU_ARM64
|
||||||
#endif /* RP_CPU_ARM64 */
|
# define BYTESWAP_ALWAYS_HAS_NEON 1
|
||||||
|
# endif /* RP_CPU_ARM64 */
|
||||||
|
#endif /* HAVE_ARM_NEON_H */
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
@ -296,12 +298,12 @@ static FORCEINLINE void rp_byte_swap_16_array(uint16_t *ptr, size_t n)
|
|||||||
if (RP_CPU_arm_HasNEON()) {
|
if (RP_CPU_arm_HasNEON()) {
|
||||||
rp_byte_swap_16_array_neon(ptr, n);
|
rp_byte_swap_16_array_neon(ptr, n);
|
||||||
} else
|
} else
|
||||||
# endif /* BYTESWAP_HAS_NEON */
|
# endif /* BYTESWAP_HAS_SSE2 */
|
||||||
// TODO: MMX-optimized version?
|
// TODO: MMX-optimized version?
|
||||||
{
|
{
|
||||||
rp_byte_swap_16_array_c(ptr, n);
|
rp_byte_swap_16_array_c(ptr, n);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* BYTESWAP_ALWAYS_HAS_SSE2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,11 +346,11 @@ static FORCEINLINE void rp_byte_swap_32_array(uint32_t *ptr, size_t n)
|
|||||||
if (RP_CPU_arm_HasNEON()) {
|
if (RP_CPU_arm_HasNEON()) {
|
||||||
rp_byte_swap_32_array_neon(ptr, n);
|
rp_byte_swap_32_array_neon(ptr, n);
|
||||||
} else
|
} else
|
||||||
# endif /* BYTESWAP_HAS_NEON */
|
# endif /* BYTESWAP_HAS_SSE2 */
|
||||||
{
|
{
|
||||||
rp_byte_swap_32_array_c(ptr, n);
|
rp_byte_swap_32_array_c(ptr, n);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* !BYTESWAP_ALWAYS_HAS_SSE2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* ROM Properties Page shell extension. (librpbyteswap) *
|
* ROM Properties Page shell extension. (librpbyteswap) *
|
||||||
* config.byteswap.h.in: Byteswap intrinsics configuration. (source file) *
|
* config.byteswap.h.in: Byteswap intrinsics configuration. (source file) *
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2016-2024 by David Korth. *
|
* Copyright (c) 2016-2025 by David Korth. *
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -11,6 +11,9 @@
|
|||||||
/* Define to 1 if you have the <features.h> header file. */
|
/* Define to 1 if you have the <features.h> header file. */
|
||||||
#cmakedefine HAVE_FEATURES_H 1
|
#cmakedefine HAVE_FEATURES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <arm_neon.h> header file. */
|
||||||
|
#cmakedefine HAVE_ARM_NEON_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have __builtin_bswap16(). */
|
/* Define to 1 if you have __builtin_bswap16(). */
|
||||||
#cmakedefine HAVE___BUILTIN_BSWAP16 1
|
#cmakedefine HAVE___BUILTIN_BSWAP16 1
|
||||||
|
|
||||||
|
@ -199,7 +199,9 @@ IF(CPU_i386 OR CPU_amd64)
|
|||||||
${${PROJECT_NAME}_SSE41_SRCS}
|
${${PROJECT_NAME}_SSE41_SRCS}
|
||||||
)
|
)
|
||||||
ELSEIF(CPU_arm OR CPU_arm64)
|
ELSEIF(CPU_arm OR CPU_arm64)
|
||||||
SET(${PROJECT_NAME}_CPU_SRCS decoder/ImageDecoder_Linear_neon.cpp)
|
IF(HAVE_ARM_NEON_H)
|
||||||
|
SET(${PROJECT_NAME}_CPU_SRCS decoder/ImageDecoder_Linear_neon.cpp)
|
||||||
|
ENDIF(HAVE_ARM_NEON_H)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
UNSET(arch)
|
UNSET(arch)
|
||||||
|
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
* ROM Properties Page shell extension. (librptexture) *
|
* ROM Properties Page shell extension. (librptexture) *
|
||||||
* config.librptexture.h.in: LibRpTexture configuration. (source file) *
|
* config.librptexture.h.in: LibRpTexture configuration. (source file) *
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2016-2023 by David Korth. *
|
* Copyright (c) 2016-2025 by David Korth. *
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later *
|
* SPDX-License-Identifier: GPL-2.0-or-later *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <arm_neon.h> header file. */
|
||||||
|
#cmakedefine HAVE_ARM_NEON_H 1
|
||||||
|
|
||||||
/* Define to 1 if librpbase RomFields support should be enabled. */
|
/* Define to 1 if librpbase RomFields support should be enabled. */
|
||||||
#define ENABLE_LIBRPBASE_ROMFIELDS 1
|
#define ENABLE_LIBRPBASE_ROMFIELDS 1
|
||||||
|
|
||||||
|
@ -26,15 +26,19 @@
|
|||||||
# include "librpcpuid/cpuflags_x86.h"
|
# include "librpcpuid/cpuflags_x86.h"
|
||||||
# define IMAGEDECODER_HAS_SSE2 1
|
# define IMAGEDECODER_HAS_SSE2 1
|
||||||
# define IMAGEDECODER_HAS_SSSE3 1
|
# define IMAGEDECODER_HAS_SSSE3 1
|
||||||
#elif defined(RP_CPU_ARM) || defined(RP_CPU_ARM64)
|
#elif defined(HAVE_ARM_NEON_H)
|
||||||
# include "librpcpuid/cpuflags_arm.h"
|
# if defined(RP_CPU_ARM) || defined(RP_CPU_ARM64)
|
||||||
# define IMAGEDECODER_HAS_NEON 1
|
# include "librpcpuid/cpuflags_arm.h"
|
||||||
|
# define IMAGEDECODER_HAS_NEON 1
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef RP_CPU_AMD64
|
#ifdef RP_CPU_AMD64
|
||||||
# define IMAGEDECODER_ALWAYS_HAS_SSE2 1
|
# define IMAGEDECODER_ALWAYS_HAS_SSE2 1
|
||||||
#endif
|
#endif
|
||||||
#ifdef RP_CPU_ARM64
|
#ifdef HAVE_ARM_NEON_H
|
||||||
# define IMAGEDECODER_ALWAYS_HAS_NEON 1
|
# ifdef RP_CPU_ARM64
|
||||||
|
# define IMAGEDECODER_ALWAYS_HAS_NEON 1
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace LibRpTexture {
|
namespace LibRpTexture {
|
||||||
|
Loading…
Reference in New Issue
Block a user