mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Add optimized RISC-V Vector functions
Largely based off of the ARM NEON implementation. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
committed by
Cosmin Truta
parent
b4800bae33
commit
cc5ee6b213
@@ -312,6 +312,31 @@ if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set definitions and sources for RISC-V.
|
||||
if(TARGET_ARCH MATCHES "riscv*")
|
||||
set(PNG_RISCV_VECTOR_POSSIBLE_VALUES check on off)
|
||||
set(PNG_RISCV_VECTOR "off"
|
||||
CACHE STRING "Enable RISC-V Vector optimizations: check|on|off; off is default")
|
||||
set_property(CACHE PNG_RISCV_VECTOR
|
||||
PROPERTY STRINGS ${PNG_RISCV_VECTOR_POSSIBLE_VALUES})
|
||||
list(FIND PNG_RISCV_VECTOR_POSSIBLE_VALUES ${PNG_RISCV_VECTOR} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR "PNG_RISCV_VECTOR must be one of [${PNG_RISCV_VECTOR_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_RISCV_VECTOR} STREQUAL "off")
|
||||
set(libpng_riscv_sources
|
||||
riscv/filter_vector_intrinsics.c
|
||||
riscv/palette_vector_intrinsics.c
|
||||
riscv/riscv_init.c)
|
||||
if(${PNG_RISCV_VECTOR} STREQUAL "on")
|
||||
add_definitions(-DPNG_RISCV_VECTOR_OPT=2)
|
||||
elseif(${PNG_RISCV_VECTOR} STREQUAL "check")
|
||||
add_definitions(-DPNG_RISCV_VECTOR_CHECK_SUPPORTED)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_RISCV_VECTOR_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
# Set definitions and sources for ARM.
|
||||
@@ -339,6 +364,11 @@ else(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
add_definitions(-DPNG_LOONGARCH_LSX_OPT=0)
|
||||
endif()
|
||||
|
||||
# Set definitions and sources for RISC-V.
|
||||
if(TARGET_ARCH MATCHES "^riscv")
|
||||
add_definitions(-DPNG_RISCV_VECTOR_OPT=0)
|
||||
endif()
|
||||
|
||||
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
option(ld-version-script "Enable linker version script" ON)
|
||||
@@ -613,7 +643,9 @@ set(libpng_sources
|
||||
${libpng_mips_sources}
|
||||
${libpng_powerpc_sources}
|
||||
${libpng_loongarch_sources}
|
||||
${libpng_riscv_sources}
|
||||
)
|
||||
|
||||
set(pngtest_sources
|
||||
pngtest.c
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user