Build: Detect whether compiler supports DSPr2
This is basically the same test that was performed in acinclude.m4 in the old autotools-based build system. It was not ported to the CMake-based build system because I previously had no way of testing a non-DSPr2 build environment. Fixes #248
This commit is contained in:
@@ -44,6 +44,9 @@ subsampling (for instance, 4:2:0 or 4:4:0.)
|
|||||||
a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
|
a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
|
||||||
(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.)
|
(that is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.)
|
||||||
|
|
||||||
|
7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD
|
||||||
|
extensions if it detects that the compiler does not support DSPr2 instructions.
|
||||||
|
|
||||||
|
|
||||||
1.5.90 (2.0 beta1)
|
1.5.90 (2.0 beta1)
|
||||||
==================
|
==================
|
||||||
|
|||||||
@@ -270,6 +270,29 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
|
|||||||
set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
set(EFFECTIVE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
|
||||||
message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}")
|
message(STATUS "CMAKE_ASM_FLAGS = ${EFFECTIVE_ASM_FLAGS}")
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_FLAGS -mdspr2)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#if !(defined(__mips__) && __mips_isa_rev >= 2)
|
||||||
|
#error MIPS DSPr2 is currently only available on MIPS32r2 platforms.
|
||||||
|
#endif
|
||||||
|
int main(void) {
|
||||||
|
int c = 0, a = 0, b = 0;
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
\"precr.qb.ph %[c], %[a], %[b]\"
|
||||||
|
: [c] \"=r\" (c)
|
||||||
|
: [a] \"r\" (a), [b] \"r\" (b)
|
||||||
|
);
|
||||||
|
return c;
|
||||||
|
}" HAVE_DSPR2)
|
||||||
|
|
||||||
|
unset(CMAKE_REQUIRED_FLAGS)
|
||||||
|
|
||||||
|
if(NOT HAVE_DSPR2)
|
||||||
|
simd_fail("SIMD extensions not available for this CPU")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(simd OBJECT ${CPU_TYPE}/jsimd_dspr2.S ${CPU_TYPE}/jsimd.c)
|
add_library(simd OBJECT ${CPU_TYPE}/jsimd_dspr2.S ${CPU_TYPE}/jsimd.c)
|
||||||
|
|
||||||
if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)
|
if(CMAKE_POSITION_INDEPENDENT_CODE OR ENABLE_SHARED)
|
||||||
|
|||||||
Reference in New Issue
Block a user