Permalink
Browse files

Add libpgmath support for new elemental functions AINT(), CEIL(), and…

… FLOOR().
  • Loading branch information...
gklimowicz committed Nov 16, 2018
1 parent b19632a commit 640ea018b117cc4b657ccb868cbb87e047301616
@@ -273,7 +273,7 @@ libmath_add_object_library("${MTH_CMPLX_SRCS}" "${FLAGS}" "${DEFINITIONS_CMPLX}"
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_128mask.c
set(TARGET_NAME "mth_128mask")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -286,7 +286,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_128generic.c
set(TARGET_NAME "mth_128generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -299,7 +299,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_256mask.c
set(TARGET_NAME "mth_256mask")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -312,7 +312,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_256generic.c
set(TARGET_NAME "mth_256generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -325,7 +325,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_512mask.c
set(TARGET_NAME "mth_512mask")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "")
@@ -339,7 +339,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_512generic.c
set(TARGET_NAME "mth_512generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -352,7 +352,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
# Generate mth_z2yy.c
set(TARGET_NAME "mth_z2yy")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -365,47 +365,47 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
# Generate mth_128mask.c
set(TARGET_NAME "mth_128mask")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME})
# Generate mth_128generic.c
set(TARGET_NAME "mth_128generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME})
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
# Generate mth_128mask.cpp
set(TARGET_NAME "mth_128mask")
add_custom_command(OUTPUT ${TARGET_NAME}.cpp PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.cpp DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.cpp")
libmath_add_object_library("${TARGET_NAME}.cpp" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME})
# Generate mth_128generic.c
set(TARGET_NAME "mth_128generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME})
else()
# Generate mth_128mask.c
set(TARGET_NAME "mth_128mask")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME})
# Generate mth_128generic.c
set(TARGET_NAME "mth_128generic")
add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD
COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build")
@@ -217,6 +217,9 @@ static char *cfunc[] = {
[func_div] = "div",
[func_sqrt] = "sqrt",
[func_mod] = "mod",
[func_aint] = "aint",
[func_ceil] = "ceil",
[func_floor] = "floor",
};
#undef SLEEF
@@ -239,6 +242,9 @@ static char *cfunc[] = {
#include "math_tables/mth_divdefs.h"
#include "math_tables/mth_sqrtdefs.h"
#include "math_tables/mth_moddefs.h"
#include "math_tables/mth_aintdefs.h"
#include "math_tables/mth_ceildefs.h"
#include "math_tables/mth_floordefs.h"
#ifdef SLEEF
#include "math_tables/mth_sleef.h"
#endif
@@ -278,6 +284,9 @@ static mth_intrins_defs_t mth_intrins_defs[] = {
#include "math_tables/mth_divdefs.h"
#include "math_tables/mth_sqrtdefs.h"
#include "math_tables/mth_moddefs.h"
#include "math_tables/mth_aintdefs.h"
#include "math_tables/mth_ceildefs.h"
#include "math_tables/mth_floordefs.h"
#else
#include "math_tables/mth_sleef.h"
#endif
Oops, something went wrong.

0 comments on commit 640ea01

Please sign in to comment.