├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── appveyor.yml ├── cmake ├── arch_detect.c ├── auto_detect_cpu.cmake ├── cpuid_arm.c ├── cpuid_x86.c └── detect_32or64bit.cmake ├── config └── arm.cmake ├── driver ├── CMakeLists.txt ├── openvml_server.c └── openvml_util.c ├── include ├── openvml.h ├── openvml_common.h ├── openvml_config.h.in ├── openvml_driver.h ├── openvml_kernel.h ├── openvml_macros.h └── openvml_reference.h ├── interface ├── CMakeLists.txt ├── acos.c ├── add.c ├── asin.c ├── atan.c ├── atan2.c ├── cos.c ├── exp.c ├── expm1.c ├── floor.c ├── ln.c ├── log10.c ├── log1p.c ├── pow.c ├── pow2o3.c ├── pow3o2.c ├── powx.c ├── sin.c ├── sinCos.c ├── sqr.c ├── sub.c ├── tan.c └── tanh.c ├── kernel ├── CMakeLists.txt ├── aarch64 │ └── Kernel_generic.txt ├── arm │ ├── Kernel_armv7a.txt │ ├── Kernel_cortexa15.txt │ ├── Kernel_cortexa9.txt │ ├── Kernel_generic.txt │ ├── sexp_kernel_neon.c │ ├── sfloor_kernel_neon.c │ ├── simd_const.h │ ├── simd_exps_neon.h │ ├── simd_lns_neon.h │ ├── simd_map.h │ ├── simd_pows_neon.h │ ├── simd_tanhs_neon.h │ ├── sln_kernel_neon.c │ ├── spow_kernel_neon.c │ └── stanh_kernel_neon.c ├── generic │ ├── Kernel_generic.txt │ ├── acos_kernel.c │ ├── add_kernel.c │ ├── asin_kernel.c │ ├── atan2_kernel.c │ ├── atan_kernel.c │ ├── cos_kernel.c │ ├── exp_kernel.c │ ├── expm1_kernel.c │ ├── floor_kernel.c │ ├── ln_kernel.c │ ├── log10_kernel.c │ ├── log1p_kernel.c │ ├── pow_kernel.c │ ├── powx_kernel.c │ ├── sin_kernel.c │ ├── sincos_kernel.c │ ├── sqr_kernel.c │ ├── sub_kernel.c │ ├── tan_kernel.c │ └── tanh_kernel.c └── x86_64 │ ├── Kernel_generic.txt │ ├── Kernel_haswell.txt │ ├── Kernel_sandybridge.txt │ ├── dadd_kernel_avx.c │ ├── dexp_kernel_avx.c │ ├── dln_kernel_avx.c │ ├── dlog10_kernel_avx.c │ ├── dlog1p_kernel_avx.c │ ├── dpow_kernel_avx.c │ ├── dpowx_kernel_avx.c │ ├── dsqr_kernel_avx.c │ ├── dsub_kernel_avx.c │ ├── dtanh_kernel_avx.c │ ├── sadd_kernel_avx.c │ ├── scos_kernel_avx.c │ ├── sexp_kernel_avx.c │ ├── simd_const.h │ ├── simd_coss_avx.h │ ├── simd_expd_avx.h │ ├── simd_exps_avx.h │ ├── simd_frexpd.h │ ├── simd_lnd_avx.h │ ├── simd_lns_avx.h │ ├── simd_map.h │ ├── simd_polevld.h │ ├── simd_powd_avx.h │ ├── simd_pows_avx.h │ ├── simd_sins_avx.h │ ├── simd_tanhd_avx.h │ ├── simd_tanhs_avx.h │ ├── sln_kernel_avx.c │ ├── slog10_kernel_avx.c │ ├── slog1p_kernel_avx.c │ ├── spow_kernel_avx.c │ ├── spowx_kernel_avx.c │ ├── sqr_kernel.c │ ├── ssin_kernel_avx.c │ ├── ssqr_kernel_avx.c │ ├── ssub_kernel_avx.c │ └── stanh_kernel_avx.c ├── reference ├── CMakeLists.txt ├── vacos.c ├── vadd.c ├── vasin.c ├── vatan.c ├── vatan2.c ├── vcos.c ├── vexp.c ├── vexpm1.c ├── vfloor.c ├── vln.c ├── vlog10.c ├── vlog1p.c ├── vpow.c ├── vpow2o3.c ├── vpow3o2.c ├── vpowx.c ├── vsin.c ├── vsincos.c ├── vsqr.c ├── vsub.c ├── vtan.c └── vtanh.c └── test ├── CMakeLists.txt ├── ctest.h ├── cycle.c ├── cycle.h ├── openvml_timer.c ├── openvml_timer.h ├── test_acos.c ├── test_add.c ├── test_asin.c ├── test_atan.c ├── test_atan2.c ├── test_cos.c ├── test_exp.c ├── test_expm1.c ├── test_floor.c ├── test_ln.c ├── test_log10.c ├── test_log1p.c ├── test_pow.c ├── test_pow2o3.c ├── test_pow3o2.c ├── test_powx.c ├── test_sin.c ├── test_sincos.c ├── test_sqr.c ├── test_sub.c ├── test_tan.c ├── test_tanh.c ├── timer.c ├── vml_misc_test.c ├── vml_test.c ├── vml_test.h └── vml_util.c /.gitignore: -------------------------------------------------------------------------------- 1 | *.obj 2 | *.lib 3 | *.dll 4 | *.dylib 5 | *.def 6 | *.o 7 | *.out 8 | *.so 9 | *.a 10 | .svn 11 | *~ 12 | lib.grd 13 | nohup.out 14 | build/ 15 | 32_64_bit.c 16 | openvml_export.h 17 | openvml_config.h 18 | CMakeFiles/ 19 | Makefile 20 | CTestTestfile.cmake 21 | cmake_install.cmake 22 | CMakeCache.txt -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: required 3 | dist: trusty 4 | 5 | notifications: 6 | webhooks: 7 | urls: 8 | - https://webhooks.gitter.im/e/f6341f97901850a796ee 9 | on_success: change # options: [always|never|change] default: always 10 | on_failure: always # options: [always|never|change] default: always 11 | on_start: never # options: [always|never|change] default: always 12 | 13 | compiler: 14 | - gcc 15 | - clang 16 | 17 | env: 18 | - RUN_TEST=1 BUILD_CONFIG="" 19 | - RUN_TEST=1 BUILD_CONFIG="-DOpenVML_ARCH=generic -DOpenVML_CPU_CORENAME=generic -DAUTO_DETECT_CPU=OFF" 20 | - RUN_TEST=0 BUILD_CONFIG="-DOpenVML_ARCH=x86_64 -DOpenVML_CPU_CORENAME=sandybridge -DAUTO_DETECT_CPU=OFF" 21 | - RUN_TEST=0 BUILD_CONFIG="-DOpenVML_ARCH=x86_64 -DOpenVML_CPU_CORENAME=haswell -DAUTO_DETECT_CPU=OFF" 22 | 23 | 24 | before_install: 25 | - sudo apt-get update -qq 26 | - sudo apt-get install -qq -y cmake 27 | 28 | install: 29 | - if [ "$CC" = "gcc" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi 30 | addons: 31 | apt: 32 | sources: 33 | - ubuntu-toolchain-r-test 34 | packages: 35 | - gcc-4.8 36 | - g++-4.8 37 | - clang 38 | 39 | script: 40 | - mkdir ./build_test 41 | - cd ./build_test 42 | - cmake --version 43 | - cmake $BUILD_CONFIG .. 44 | - make 45 | - cd ./test/ 46 | - if [ $RUN_TEST -eq 1 ]; then ./run_vml_test; fi 47 | - if [ $RUN_TEST -eq 1 ]; then ./misc_test; fi 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Zhang Xianyi 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenVML 2 | 3 | [![Join the chat at https://gitter.im/xianyi/OpenVML](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/xianyi/OpenVML?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | Travis CI:[![Build Status](https://travis-ci.org/xianyi/OpenVML.svg?branch=master)](https://travis-ci.org/xianyi/OpenVML) 5 | AppVeyor:[![Build Status](https://ci.appveyor.com/api/projects/status/github/xianyi/openvml?branch=master&svg=true)](https://ci.appveyor.com/project/xianyi/openvml) 6 | 7 | OpenVML is an open soruce vector math library. 8 | 9 | ## Support Processors and OS 10 | 11 | * Generic platform 12 | * C and unoptimized codes 13 | 14 | * OS 15 | * Linux 16 | * Mac OSX 17 | * Windows (Visual Studio or MinGW) 18 | 19 | * x86_64 20 | * Intel Sandy Bridge 21 | * Intel Haswell 22 | 23 | * ARM 24 | * ARMv7 (Cortex-A9, Cortex-A15) 25 | 26 | ## Compile 27 | 28 | You need (CMake)[www.cmake.org] on your platform. 29 | 30 | * Linux or Mac OSX: 31 | 32 | ``` 33 | mkdir /your/build 34 | cd /your/build 35 | cmake /path/to/OpenVML 36 | make 37 | make install 38 | ``` 39 | 40 | * Visual Studio 41 | * Need MS Visual Studio 2013 and above. 42 | * Use cmake or cmake-gui to generate Visual Studio solution files. 43 | * Use Visual Studio to open the solution and build. 44 | 45 | ## Test 46 | 47 | * Check the result and Performance 48 | 49 | Run `/your/build/test/run_vml_test`. 50 | For exmaple, 51 | ``` 52 | ./run_vml_test # Run all test 53 | ./run_vml_test -r check_result_s # Only run single precision functions. 54 | ./run_vml_test -r check_result_s add # Only run single precision add function (vsAdd). 55 | ./run_vml_test -n 1 10 2 # The input sizes are from 1 to 10, step 2. 56 | ``` 57 | 58 | * Misc test 59 | 60 | Run `/your/build/test/misc_test`. 61 | 62 | ## Status 63 | 64 | Ongoing work 65 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.0.1.{build} 2 | 3 | #environment: 4 | 5 | platform: x64 6 | configuration: Release 7 | 8 | clone_folder: c:\projects\OpenVML 9 | 10 | init: 11 | - git config --global core.autocrlf input 12 | 13 | build: 14 | project: OpenVML.sln 15 | 16 | clone_depth: 5 17 | 18 | matrix: 19 | fast_finish: true 20 | 21 | skip_commits: 22 | # Add [av skip] to commit messages 23 | message: /\[av skip\]/ 24 | 25 | before_build: 26 | - echo Running cmake... 27 | - cd c:\projects\OpenVML 28 | - cmake -G "Visual Studio 12 Win64" . 29 | 30 | test_script: 31 | - echo Running Test 32 | - cd c:\projects\OpenVML\lib\Release 33 | - run_vml_test 34 | - misc_test 35 | -------------------------------------------------------------------------------- /cmake/arch_detect.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | 28 | int main() 29 | { 30 | #if defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) 31 | printf("x86_64"); 32 | return 0; 33 | #endif 34 | 35 | #if defined(__arm__) || defined(_M_ARM) || (__TARGET_ARCH_ARM) 36 | printf("arm"); 37 | return 0; 38 | #endif 39 | 40 | #if defined(__aarch64__) 41 | printf("aarch64"); 42 | return 0; 43 | #endif 44 | 45 | //default 46 | printf("generic"); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /cmake/auto_detect_cpu.cmake: -------------------------------------------------------------------------------- 1 | set (OpenVML_ARCH "generic") 2 | set (OpenVML_CPU_CORENAME "generic") 3 | 4 | try_run(arch_detect_result arch_detect_compile_result 5 | ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/arch_detect.c 6 | RUN_OUTPUT_VARIABLE arch_detect_output 7 | ) 8 | 9 | if(arch_detect_compile_result) 10 | if(arch_detect_result EQUAL 0) 11 | set (OpenVML_ARCH ${arch_detect_output}) 12 | endif() 13 | endif() 14 | 15 | #For x86_64 16 | if(OpenVML_ARCH STREQUAL "x86_64") 17 | 18 | if(MSVC) 19 | set(OpenVML_CPU_DETECT_FLAGS 20 | ${OpenVML_CPU_DETECT_FLAGS} -DCOMPILER_MSVC) 21 | endif() 22 | 23 | try_run(cpu_detect_result cpu_detect_compile_result 24 | ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/cpuid_x86.c 25 | COMPILE_DEFINITIONS ${OpenVML_CPU_DETECT_FLAGS} 26 | RUN_OUTPUT_VARIABLE cpu_detect_output 27 | COMPILE_OUTPUT_VARIABLE cpu_detect_compile_output 28 | ) 29 | #if(MSVC) 30 | # set(cpu_detect_output "generic") 31 | #endif() 32 | endif() 33 | 34 | 35 | #For ARM 32-bit 36 | if(OpenVML_ARCH STREQUAL "arm") 37 | try_run(cpu_detect_result cpu_detect_compile_result 38 | ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/cpuid_arm.c 39 | COMPILE_DEFINITIONS ${OpenVML_CPU_DETECT_FLAGS} 40 | RUN_OUTPUT_VARIABLE cpu_detect_output 41 | COMPILE_OUTPUT_VARIABLE cpu_detect_compile_output 42 | ) 43 | endif() 44 | 45 | if(cpu_detect_compile_result) 46 | if(cpu_detect_result EQUAL 0) 47 | set (OpenVML_CPU_CORENAME ${cpu_detect_output}) 48 | else() 49 | message("${cpu_detect_output}") 50 | endif() 51 | else() 52 | #message("detect compile error") 53 | #message("${cpu_detect_compile_output}") 54 | endif() 55 | 56 | 57 | message(STATUS "Detect Arch:" ${OpenVML_ARCH} "\tCPU:" ${OpenVML_CPU_CORENAME}) -------------------------------------------------------------------------------- /cmake/detect_32or64bit.cmake: -------------------------------------------------------------------------------- 1 | #https://github.com/petroules/solar-cmake/blob/master/TargetArch.cmake 2 | 3 | set(detect_32_64_code " 4 | #include 5 | #if INTPTR_MAX == INT32_MAX 6 | #error cmake_BINARY 32 7 | #elif INTPTR_MAX == INT64_MAX 8 | #error cmake_BINARY 64 9 | #else 10 | #error cmake_BINARY unknown 11 | #endif 12 | ") 13 | 14 | function(detect_32_64_bit output_var) 15 | file(WRITE "${CMAKE_BINARY_DIR}/32_64_bit.c" "${detect_32_64_code}") 16 | 17 | enable_language(C) 18 | 19 | try_run( 20 | run_result_unused 21 | compile_result_unused 22 | "${CMAKE_BINARY_DIR}" 23 | "${CMAKE_BINARY_DIR}/32_64_bit.c" 24 | COMPILE_OUTPUT_VARIABLE BINARY 25 | ) 26 | 27 | string(REGEX MATCH "cmake_BINARY ([a-zA-Z0-9_]+)" BINARY "${BINARY}") 28 | 29 | string(REPLACE "cmake_BINARY " "" BINARY "${BINARY}") 30 | 31 | if (NOT BINARY) 32 | set(BINARY unknown) 33 | endif() 34 | set(${output_var} "${BINARY}" PARENT_SCOPE) 35 | endfunction() -------------------------------------------------------------------------------- /config/arm.cmake: -------------------------------------------------------------------------------- 1 | #Use hard float-abi and ARMV7-A 2 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard") 3 | 4 | #ARMV7-A 5 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a") 6 | -------------------------------------------------------------------------------- /driver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(OpenVML_LIBSRC_OTHER "") 2 | 3 | set(OpenVML_LIBSRC_OTHER 4 | ${OpenVML_LIBSRC_OTHER} 5 | openvml_util.c 6 | ) 7 | 8 | if(NOT BUILD_SINGLE_THREAD) 9 | set(OpenVML_LIBSRC_OTHER 10 | ${OpenVML_LIBSRC_OTHER} 11 | openvml_server.c 12 | ) 13 | endif() 14 | 15 | add_library(openvml_driver_core OBJECT ${OpenVML_LIBSRC_OTHER}) 16 | 17 | target_compile_definitions(openvml_driver_core PUBLIC openvml_EXPORTS) -------------------------------------------------------------------------------- /driver/openvml_server.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | 28 | void OpenVML_FUNCNAME(openvml_exec)(int mode, void * func, VMLLONG n, void * a, void *b, void *y, void *z, void * other_params) { 29 | printf("ok!\n"); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /driver/openvml_util.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #define STR(s) STR_1(s) 30 | #define STR_1(s) #s 31 | 32 | static char openvml_config_str[256]= 33 | #ifdef USE64BITINT 34 | "USE64BITINT " 35 | #endif 36 | STR(OPENVML_ARCH)" " 37 | STR(OPENVML_CPU_CORENAME)" " 38 | ; 39 | 40 | char * OpenVML_FUNCNAME(openvml_get_config)() 41 | { 42 | return openvml_config_str; 43 | } 44 | -------------------------------------------------------------------------------- /include/openvml_common.h: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef _OPENVML_COMMON_H_ 27 | #define _OPENVML_COMMON_H_ 28 | 29 | #include "openvml_config.h" 30 | 31 | #ifdef DOUBLE 32 | typedef double VML_FLOAT; 33 | #else 34 | typedef float VML_FLOAT; 35 | #endif 36 | 37 | #if defined(OS_WINDOWS) && defined(__64BIT__) 38 | typedef long long VMLLONG; 39 | typedef unsigned long long VMLULONG; 40 | #else 41 | typedef long VMLLONG; 42 | typedef unsigned long VMLULONG; 43 | #endif 44 | 45 | #ifdef USE64BITINT 46 | typedef VMLLONG VML_INT; 47 | #else 48 | typedef int VML_INT; 49 | #endif 50 | 51 | #define OpenVML_FUNCNAME_3(pre,x,suf) pre##x##suf 52 | #define OpenVML_FUNCNAME_2(pre,x,suf) OpenVML_FUNCNAME_3(pre, x, suf) 53 | #define OpenVML_FUNCNAME_1(x) OpenVML_FUNCNAME_2(OPENVML_FUNC_PREFIX, x, OPENVML_FUNC_SUFFIX) 54 | #define OpenVML_FUNCNAME(x) OpenVML_FUNCNAME_1(x) 55 | 56 | #endif -------------------------------------------------------------------------------- /include/openvml_config.h.in: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #define OPENVML_VERSION_MAJOR @OpenVML_VERSION_MAJOR@ 27 | #define OPENVML_VERSION_MINOR @OpenVML_VERSION_MINOR@ 28 | #define OPENVML_VERSION_PATCH @OpenVML_VERSION_PATCH@ 29 | 30 | #define OPENVML_FUNC_PREFIX @OpenVML_FUNC_PREFIX@ 31 | #define OPENVML_FUNC_SUFFIX @OpenVML_FUNC_SUFFIX@ 32 | 33 | #define OPENVML_ARCH @OpenVML_ARCH@ 34 | #define OPENVML_CPU_CORENAME @OpenVML_CPU_CORENAME@ 35 | #define OPENVML_BINARY @OpenVML_BINARY@ 36 | 37 | #cmakedefine OPENVML_SINGLE_THREAD 38 | #cmakedefine USE64BITINT 39 | #cmakedefine __64BIT__ 40 | #cmakedefine __32BIT__ 41 | #cmakedefine OS_WINDOWS 42 | #cmakedefine OS_DARWIN 43 | #cmakedefine OS_LINUX 44 | 45 | #cmakedefine COMPILER_MSVC 46 | 47 | #ifdef COMPILER_MSVC 48 | #define inline __inline 49 | #endif -------------------------------------------------------------------------------- /include/openvml_driver.h: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef _OPENVML_DRIVER_H_ 27 | #define _OPENVML_DRIVER_H_ 28 | 29 | #include "openvml_common.h" 30 | #include "openvml_macros.h" 31 | 32 | 33 | //size n 34 | //vector a, b, y, z 35 | //workspace other_params 36 | #ifdef OPENVML_SINGLE_THREAD 37 | #define EXEC_VML(mode, kernel, n, a, b, y, z, other_params) \ 38 | kernel(n, a, b, y, z, other_params) 39 | #else 40 | #define EXEC_VML(mode, kernel, n, a, b, y, z, other_params) \ 41 | OpenVML_FUNCNAME(openvml_exec)(mode, (void*)kernel, n, (void*)a, (void*)b, (void*)y, (void*)z, (void*)other_params) 42 | #endif 43 | 44 | void OpenVML_FUNCNAME(openvml_exec)(int mode, void * func, VMLLONG n, void * a, void *b, void *y, void *z, void * other_params); 45 | 46 | #endif -------------------------------------------------------------------------------- /interface/acos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, ACOS_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/add.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, const VML_FLOAT * b, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || b==NULL || y==NULL) return; 35 | 36 | //ADD_K(n, (VML_FLOAT*)a, (VML_FLOAT*)b, y); 37 | 38 | EXEC_VML(0, ADD_K, n, (VML_FLOAT*)a, (VML_FLOAT*)b, y, NULL, NULL); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /interface/asin.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, ASIN_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/atan.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, ATAN_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/atan2.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, const VML_FLOAT * b, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || b==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, ATAN2_K, n, (VML_FLOAT*)a, (VML_FLOAT*)b, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/cos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, COS_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/exp.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, EXP_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/expm1.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, EXPM1_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/floor.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, FLOOR_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/ln.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, LN_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/log10.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, LOG10_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/log1p.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, LOG1P_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/pow.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, const VML_FLOAT * b, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || b==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, POW_K, n, (VML_FLOAT*)a, (VML_FLOAT*)b, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/pow2o3.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | VML_FLOAT b=2.0/3.0; 37 | 38 | EXEC_VML(0, POWX_K, n, (VML_FLOAT*)a, &b, y, NULL, NULL); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /interface/pow3o2.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | VML_FLOAT b=3.0/2.0; 37 | 38 | EXEC_VML(0, POWX_K, n, (VML_FLOAT*)a, &b, y, NULL, NULL); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /interface/powx.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, const VML_FLOAT * b, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || b==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, POWX_K, n, (VML_FLOAT*)a, (VML_FLOAT*)b, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/sin.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, SIN_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/sinCos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y, VML_FLOAT * z) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL || z==NULL) return; 35 | 36 | 37 | EXEC_VML(0, SINCOS_K, n, (VML_FLOAT*)a, NULL, y, z, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/sqr.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, SQR_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/sub.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | void CNAME(const VML_INT n, const VML_FLOAT * a, const VML_FLOAT * b, VML_FLOAT * y) { 31 | 32 | if(n<=0) return; 33 | if (a==NULL || b==NULL || y==NULL) return; 34 | 35 | //SUB_K(n, (VML_FLOAT*)a, (VML_FLOAT *)b, y); 36 | 37 | EXEC_VML(0, SUB_K, n, (VML_FLOAT*)a, (VML_FLOAT*)b, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/tan.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, TAN_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /interface/tanh.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | void CNAME(const VML_INT n, const VML_FLOAT * a, VML_FLOAT * y) { 32 | 33 | if (n<=0) return; 34 | if (a==NULL || y==NULL) return; 35 | 36 | 37 | EXEC_VML(0, TANH_K, n, (VML_FLOAT*)a, NULL, y, NULL, NULL); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /kernel/arm/Kernel_armv7a.txt: -------------------------------------------------------------------------------- 1 | include(${OpenVML_ARCH}/Kernel_generic.txt) 2 | -------------------------------------------------------------------------------- /kernel/arm/Kernel_cortexa15.txt: -------------------------------------------------------------------------------- 1 | include(${OpenVML_ARCH}/Kernel_generic.txt) 2 | 3 | set(OpenVML_KERNEL_COMPILE_FLAGS -mfpu=neon -std=c99 -mtune=cortex-a15) 4 | 5 | set(exp_S_KERNEL_SOURCE ${OpenVML_ARCH}/sexp_kernel_neon.c) 6 | 7 | set(pow_S_KERNEL_SOURCE ${OpenVML_ARCH}/spow_kernel_neon.c) 8 | 9 | set(tanh_S_KERNEL_SOURCE ${OpenVML_ARCH}/stanh_kernel_neon.c) 10 | 11 | set(ln_S_KERNEL_SOURCE ${OpenVML_ARCH}/sln_kernel_neon.c) 12 | 13 | set(floor_S_KERNEL_SOURCE ${OpenVML_ARCH}/sfloor_kernel_neon.c) 14 | -------------------------------------------------------------------------------- /kernel/arm/Kernel_cortexa9.txt: -------------------------------------------------------------------------------- 1 | include(${OpenVML_ARCH}/Kernel_generic.txt) 2 | 3 | set(OpenVML_KERNEL_COMPILE_FLAGS -mtune=cortex-a9) 4 | 5 | -------------------------------------------------------------------------------- /kernel/arm/sexp_kernel_neon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_exps_neon.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) 6 | { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sf src = vld1q_f32(a + 4 * j); 13 | v4sf tem = simd_exp4f(src); 14 | vst1q_f32(y + 4 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = expf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/arm/sfloor_kernel_neon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_const.h" 4 | #include "simd_map.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) 7 | { 8 | unsigned int m = n >> 2; 9 | unsigned int k = n & 3; 10 | unsigned int l = n & (~3); 11 | unsigned int j; 12 | 13 | for (j = 0; j < m; j++) { 14 | v4sf src = vld1q_f32(&a[4*j]); 15 | v4sf tem = simd_floors(src); 16 | vst1q_f32(&y[4*j], tem); 17 | } 18 | 19 | for (j = 0; j < k; j++) { 20 | y[j + l] = floorf(a[j + l]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /kernel/arm/simd_const.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIMD_CONST_H__ 2 | #define __SIMD_CONST_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #ifndef ALIGN16_BEG 9 | #define ALIGN16_BEG 10 | #endif 11 | 12 | #ifndef ALIGN16_END 13 | #define ALIGN16_END __attribute__((aligned(16))) 14 | #endif 15 | 16 | #define _PS128_CONST(Name, val) \ 17 | static const ALIGN16_BEG float _ps128_##Name[4] ALIGN16_END = {val,val,val,val} 18 | 19 | #define _PS128_CONST_TYPE(Name, Type, val) \ 20 | static const ALIGN16_BEG Type _ps128_##Name[4] ALIGN16_END = {val,val,val,val} 21 | 22 | #define _PI32_CONST128(Name, val) \ 23 | static const ALIGN16_BEG int _pi32_128_##Name[4] ALIGN16_END = {val,val,val,val} 24 | 25 | typedef float32x4_t v4sf; 26 | typedef int32x4_t v4si; 27 | 28 | // default is big-endian which is different with x86 29 | _PS128_CONST_TYPE(sign_mask, int, 0x80000000); 30 | _PS128_CONST(0p5, 0.5f); 31 | _PS128_CONST(1, 1.0f); 32 | _PS128_CONST(2, 2.0f); 33 | 34 | #endif /* __SIMD_CONST_H__ */ 35 | -------------------------------------------------------------------------------- /kernel/arm/simd_pows_neon.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIMD_POWS_KERNEL_H_ 2 | #define _SIMD_POWS_KERNEL_H_ 3 | 4 | #include "simd_const.h" 5 | #include "simd_map.h" 6 | #include "simd_exps_neon.h" 7 | #include "simd_lns_neon.h" 8 | 9 | _PI32_CONST128(pow_uint_1, 1); 10 | _PI32_CONST128(pow_uint_0, 0); 11 | _PS128_CONST_TYPE(pow_nan, int, 0xffffffff); 12 | 13 | static inline v4sf simd_pow4f(const v4sf aa, const v4sf bb) 14 | { 15 | v4sf tem0, tem1, tem2, man; 16 | v4sf abs_a, abs_b, floor_b; 17 | v4sf out1, sign; 18 | v4sf out2, odd; 19 | 20 | const v4sf zero = simd_zeros; 21 | const v4sf mask = *(v4sf *) _ps128_sign_mask; 22 | const v4sf two = *(v4sf *) _ps128_2; 23 | const v4sf sone = *(v4sf *) _ps128_1; 24 | const v4sf nan = *(v4sf *) _ps128_pow_nan; 25 | 26 | const v4si uint_1 = *(v4si *) _pi32_128_pow_uint_1; 27 | const v4si uint_0 = *(v4si *) _pi32_128_pow_uint_0; 28 | v4si exp; 29 | v4sf cc; 30 | 31 | { 32 | sign = simd_ands(mask, aa); 33 | abs_a = simd_fabs(aa); //|a| 34 | abs_b = simd_fabs(bb); //|b| 35 | 36 | /* using ln fuction */ 37 | tem0 = simd_ln4f(abs_a); 38 | tem1 = simd_muls(tem0, bb); 39 | 40 | /* using exp fuction */ 41 | cc = simd_exp4f(tem1); 42 | 43 | exp = simd_cvts_w(bb); 44 | 45 | man = simd_castu_s(simd_cmpeqw(simd_andw(exp, uint_1), uint_0)); //even or odd 46 | 47 | odd = simd_ors(sign, cc); 48 | out1 = simd_adds(simd_ands(man, cc), simd_andnots(man, odd)); 49 | 50 | floor_b = simd_floors(bb); 51 | 52 | /* x<0 and y != N, then -NAN */ 53 | man = simd_andnots(simd_cmpeqs(bb, floor_b), simd_cmplts(aa, zero)); 54 | out2 = simd_adds(simd_ands(man, nan), simd_andnots(man, out1)); 55 | 56 | /* y = 0 then 1 */ 57 | man = simd_cmpeqs(abs_b, zero); 58 | cc = simd_adds(simd_ands(man, sone), simd_andnots(man, out2)); 59 | return cc; 60 | } 61 | } 62 | 63 | #endif /* _SIMD_POWS_KERNEL_H_ */ 64 | -------------------------------------------------------------------------------- /kernel/arm/sln_kernel_neon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_lns_neon.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) 6 | { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sf src = vld1q_f32(a + 4 * j); 13 | v4sf tem = simd_ln4f(src); 14 | vst1q_f32(y + 4 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = logf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/arm/spow_kernel_neon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_pows_neon.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) 6 | { 7 | unsigned int m = n >> 2; 8 | unsigned int i, j; 9 | 10 | unsigned int k = n & 3; 11 | unsigned int l = n & (~3); 12 | 13 | for (j = 0; j < m; j++) { 14 | v4sf aa = vld1q_f32(a + 4 * j); 15 | v4sf bb = vld1q_f32(b + 4 * j); 16 | v4sf tem = simd_pow4f(aa, bb); 17 | vst1q_f32(y + 4 * j, tem); 18 | } 19 | for (j = 0; j < k; j++) { 20 | y[l + j] = powf(a[l + j], b[l + j]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /kernel/arm/stanh_kernel_neon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_tanhs_neon.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) 6 | { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3,j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sf src = vld1q_f32(a + j * 4); 13 | v4sf tem = simd_tanh4f(src); 14 | vst1q_f32(y + j * 4, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = tanhf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/generic/acos_kernel.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define ACOS acosf 31 | #else 32 | #define ACOS acos 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define ASIN asinf 31 | #else 32 | #define ASIN asin 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define ATAN2 atan2f 31 | #else 32 | #define ATAN2 atan2 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define ATAN atanf 31 | #else 32 | #define ATAN atan 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define COS cosf 31 | #else 32 | #define COS cos 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define EXP expf 31 | #else 32 | #define EXP exp 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define EXPM1 expm1f 31 | #else 32 | #define EXPM1 expm1 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define FLOOR floorf 31 | #else 32 | #define FLOOR floor 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define LN logf 31 | #else 32 | #define LN log 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define LOG10 log10f 31 | #else 32 | #define LOG10 log10 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define LOG1P log1pf 31 | #else 32 | #define LOG1P log1p 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define POW powf 31 | #else 32 | #define POW pow 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define POW powf 31 | #else 32 | #define POW pow 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | VML_FLOAT b0=b[0]; 38 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define SIN sinf 31 | #else 32 | #define SIN sin 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define SINCOS sincosf 31 | #define SIN sinf 32 | #define COS cosf 33 | #else 34 | #define SINCOS sincos 35 | #define SIN sin 36 | #define COS cos 37 | #endif 38 | 39 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 40 | VMLLONG i=0; 41 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define TAN tanf 31 | #else 32 | #define TAN tan 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 27 | #include "openvml_kernel.h" 28 | 29 | #ifndef DOUBLE 30 | #define TANH tanhf 31 | #else 32 | #define TANH tanh 33 | #endif 34 | 35 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 36 | VMLLONG i=0; 37 | for(i=0; i 2 | #include "openvml_kernel.h" 3 | #include "simd_expd_avx.h" 4 | //#include "simd_function.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sd src = _mm256_loadu_pd(a + 4 * j); 13 | v4sd tem = simd_exp4d(src); 14 | _mm256_storeu_pd(y + 4 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = exp(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/dln_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_lnd_avx.h" 4 | //#include "simd_function.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sd src = _mm256_loadu_pd(a + 4 * j); 13 | v4sd tem = simd_ln4d(src); 14 | _mm256_storeu_pd(y + 4 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = log(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/dpow_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_powd_avx.h" 4 | //#include "simd_function.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | for (j = 0; j < m; j++) { 12 | v4sd aa = _mm256_loadu_pd(a + 4 * j); 13 | v4sd bb = _mm256_loadu_pd(b + 4 * j); 14 | v4sd tem = simd_pow4d(aa, bb); 15 | _mm256_storeu_pd(y + 4 * j, tem); 16 | } 17 | 18 | for (j = 0; j < k; j++) { 19 | y[j + l] = pow(a[j + l], b[j + l]); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /kernel/x86_64/dpowx_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_powd_avx.h" 4 | //#include "simd_function.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 7 | unsigned int m = n >> 2; 8 | unsigned int k = n & 3, j; 9 | unsigned int l = n & (~3); 10 | 11 | v4sd bb = _mm256_broadcast_sd(b); 12 | for (j = 0; j < m; j++) { 13 | v4sd aa = _mm256_loadu_pd(a + 4 * j); 14 | v4sd tem = simd_pow4d(aa, bb); 15 | _mm256_storeu_pd(y + 4 * j, tem); 16 | } 17 | 18 | for (j = 0; j < k; j++) { 19 | y[j + l] = pow(a[j + l], *b); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /kernel/x86_64/dtanh_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_tanhd_avx.h" 4 | //#include "simd_function.h" 5 | 6 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 7 | unsigned int m = n >> 2; 8 | unsigned int j; 9 | unsigned int k = n & 3; 10 | unsigned int l = n & (~3); 11 | 12 | for (j = 0; j < m; j++) { 13 | v4sd src = _mm256_loadu_pd(a + 4 * j); 14 | v4sd tem = simd_tanh4d(src); 15 | _mm256_storeu_pd(y + 4 * j, tem); 16 | } 17 | 18 | for (j = 0; j < k; j++) { 19 | y[j + l] = tanh(a[j + l]); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /kernel/x86_64/scos_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "simd_coss_avx.h" 3 | #include "openvml_kernel.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int j; 8 | unsigned int k = n & 7; 9 | unsigned int l = n & (~7); 10 | 11 | for (j = 0; j < m; j++) { 12 | v8sf src = _mm256_loadu_ps(a + 8 * j); 13 | v8sf tem = simd_cos8f(src); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = cosf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/sexp_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "simd_exps_avx.h" 3 | #include "openvml_kernel.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int j; 8 | unsigned int k = n & 7; 9 | unsigned int l = n & (~7); 10 | 11 | for (j = 0; j < m; j++) { 12 | v8sf src = _mm256_loadu_ps(a + 8 * j); 13 | v8sf tem = simd_exp8f(src); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = expf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/simd_const.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIMD_CONST_H__ 2 | #define __SIMD_CONST_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #ifndef ALIGN32_BEG 12 | #define ALIGN32_BEG 13 | #endif 14 | 15 | #ifndef ALIGN32_END 16 | #define ALIGN32_END __attribute__((aligned(32))) 17 | #endif 18 | 19 | #ifdef COMPILER_MSVC 20 | #undef ALIGN32_BEG 21 | #define ALIGN32_BEG __declspec(align(32)) 22 | #undef ALIGN32_END 23 | #define ALIGN32_END 24 | #endif 25 | 26 | #define _PS256_CONST(Name, val) \ 27 | static const ALIGN32_BEG float _ps256_##Name[8] ALIGN32_END = {val,val,val,val,val,val,val,val} 28 | 29 | #define _PS256_CONST_TYPE(Name, Type, val) \ 30 | static const ALIGN32_BEG Type _ps256_##Name[8] ALIGN32_END = {val,val,val,val,val,val,val,val} 31 | 32 | #define _PI32_CONST256(Name, val) \ 33 | static const ALIGN32_BEG int _pi32_256_##Name[8] ALIGN32_END = {val,val,val,val,val,val,val,val} 34 | 35 | typedef __m256 v8sf; 36 | typedef __m256d v4sd; 37 | typedef __m256i v8si; 38 | 39 | typedef __m128i v4si; 40 | typedef __m128 v4sf; 41 | 42 | // default is big-endian which is different with x86 43 | _PS256_CONST_TYPE(sign_mask, int, 0x80000000); 44 | _PS256_CONST(0p5, 0.5f); 45 | _PS256_CONST(1, 1.0f); 46 | _PS256_CONST(2, 2.0f); 47 | 48 | #endif /* __SIMD_CONST_H__ */ 49 | -------------------------------------------------------------------------------- /kernel/x86_64/simd_polevld.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIMD_POLEVLD_H_ 2 | #define _SIMD_POLEVLD_H_ 3 | 4 | #include "simd_map.h" 5 | #include "simd_const.h" 6 | 7 | static inline v4sd simd_polevld(v4sd x, v4sd * coef, int N) 8 | { 9 | int i; 10 | v4sd s256d; 11 | v4sd *p = coef; 12 | s256d = *p++; 13 | i = N; 14 | do { 15 | s256d = simd_addd(simd_muld(s256d, x), *p); 16 | p++; 17 | } while (--i); 18 | 19 | return s256d; 20 | } 21 | 22 | static inline v4sd simd_p1evld(v4sd x, v4sd * coef, int N) 23 | { 24 | int i; 25 | v4sd s256d; 26 | v4sd *p; 27 | 28 | p = coef; 29 | s256d = simd_addd(x, *p); 30 | p++; 31 | i = N - 1; 32 | 33 | do { 34 | s256d = simd_addd(simd_muld(s256d, x), *p); 35 | p++; 36 | } while (--i); 37 | return s256d; 38 | } 39 | 40 | #endif /* _SIMD_POLEVLD_H_ */ 41 | -------------------------------------------------------------------------------- /kernel/x86_64/simd_pows_avx.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIMD_POW_KERNEL_H_ 2 | #define _SIMD_POW_KERNEL_H_ 3 | 4 | #include "simd_const.h" 5 | #include "simd_map.h" 6 | #include "simd_exps_avx.h" 7 | #include "simd_lns_avx.h" 8 | 9 | _PI32_CONST256(pow_uint_1, 1); 10 | _PI32_CONST256(pow_uint_0, 0); 11 | _PS256_CONST_TYPE(pow_nan, int, 0xffffffff); 12 | _PS256_CONST_TYPE(pow_fabs_mask, int, ~0x80000000); 13 | 14 | static inline v8sf simd_pow8f(const v8sf aa, const v8sf bb) 15 | { 16 | v8sf tem0, tem1, tem2, man; 17 | v8sf abs_a, abs_b, floor_b; 18 | v8sf out1, sign; 19 | v8sf out2, odd; 20 | 21 | const v8sf zero = simd_zeros; 22 | const v8sf mask = *(v8sf *) _ps256_sign_mask; 23 | const v8sf two = *(v8sf *) _ps256_2; 24 | const v8sf sone = *(v8sf *) _ps256_1; 25 | const v8sf nan = *(v8sf *) _ps256_pow_nan; 26 | 27 | const v8si uint_1 = *(v8si *) _pi32_256_pow_uint_1; 28 | const v8si uint_0 = *(v8si *) _pi32_256_pow_uint_0; 29 | v8si exp; 30 | v8sf cc; 31 | 32 | sign = simd_ands(mask, aa); 33 | // |a| 34 | abs_a = simd_ands(aa, *(v8sf *) _ps256_pow_fabs_mask); 35 | // |b| 36 | abs_b = simd_ands(bb, *(v8sf *) _ps256_pow_fabs_mask); 37 | 38 | /* using ln fuction */ 39 | tem0 = simd_ln8f(abs_a); 40 | tem1 = simd_muls(tem0, bb); 41 | 42 | /* using exp fuction */ 43 | cc = simd_exp8f(tem1); 44 | 45 | exp = simd_cvts_w(bb); 46 | 47 | man = simd_castw_s(simd_cmpeqw(simd_andw(exp, uint_1), uint_0)); //even or odd 48 | 49 | odd = simd_ors(sign, cc); 50 | out1 = simd_adds(simd_ands(man, cc), simd_andnots(man, odd)); 51 | 52 | floor_b = simd_floors(bb); 53 | 54 | /* x<0 and y != N, then NAN */ 55 | man = simd_andnots(simd_cmpeqs(bb, floor_b), simd_cmplts(aa, zero)); 56 | out2 = simd_adds(simd_ands(man, nan), simd_andnots(man, out1)); 57 | 58 | /* y = 0 then 1 */ 59 | man = simd_cmpeqs(abs_b, zero); 60 | cc = simd_adds(simd_ands(man, sone), simd_andnots(man, out2)); 61 | return cc; 62 | } 63 | 64 | #endif /* _SIMD_POW_KERNEL_H_ */ 65 | -------------------------------------------------------------------------------- /kernel/x86_64/sln_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_lns_avx.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int k = n & 7, j; 8 | unsigned int l = n & (~7); 9 | 10 | for (j = 0; j < m; j++) { 11 | v8sf src = _mm256_loadu_ps(a + 8 * j); 12 | v8sf tem = simd_ln8f(src); 13 | _mm256_storeu_ps(y + 8 * j, tem); 14 | } 15 | 16 | for (j = 0; j < k; j++) { 17 | y[j + l] = logf(a[j + l]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kernel/x86_64/spow_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_pows_avx.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int k = n & 7, j; 8 | unsigned int l = n & (~7); 9 | 10 | for (j = 0; j < m; j++) { 11 | v8sf aa = _mm256_loadu_ps(a + 8 * j); 12 | v8sf bb = _mm256_loadu_ps(b + 8 * j); 13 | v8sf tem = simd_pow8f(aa, bb); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = powf(a[j + l], b[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/spowx_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_pows_avx.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int k = n & 7, j; 8 | unsigned int l = n & (~7); 9 | 10 | v8sf bb = _mm256_broadcast_ss(b); 11 | for (j = 0; j < m; j++) { 12 | v8sf aa = _mm256_loadu_ps(a + 8 * j); 13 | v8sf tem = simd_pow8f(aa, bb); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = powf(a[j + l], *b); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/sqr_kernel.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "openvml_kernel.h" 27 | 28 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 29 | VMLLONG i=0; 30 | for(i=0; i 2 | #include "simd_sins_avx.h" 3 | #include "openvml_kernel.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int j; 8 | unsigned int k = n & 7; 9 | unsigned int l = n & (~7); 10 | 11 | for (j = 0; j < m; j++) { 12 | v8sf src = _mm256_loadu_ps(a + 8 * j); 13 | v8sf tem = simd_sin8f(src); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = sinf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/x86_64/stanh_kernel_avx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "openvml_kernel.h" 3 | #include "simd_tanhs_avx.h" 4 | 5 | void KERNEL_NAME(VMLLONG n, VML_FLOAT * a, VML_FLOAT * b, VML_FLOAT * y, VML_FLOAT * z, VML_FLOAT * other_params) { 6 | unsigned int m = n >> 3; 7 | unsigned int j; 8 | unsigned int k = n & 7; 9 | unsigned int l = n & (~7); 10 | 11 | for (j = 0; j < m; j++) { 12 | v8sf src = _mm256_loadu_ps(a + 8 * j); 13 | v8sf tem = simd_tanh8f(src); 14 | _mm256_storeu_ps(y + 8 * j, tem); 15 | } 16 | 17 | for (j = 0; j < k; j++) { 18 | y[j + l] = tanhf(a[j + l]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /reference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(OpenVML_REF_SRC 2 | vadd.c 3 | vsub.c 4 | vsqr.c 5 | vpow.c 6 | vpowx.c 7 | vpow2o3.c 8 | vpow3o2.c 9 | vexp.c 10 | vexpm1.c 11 | vtanh.c 12 | vlog10.c 13 | vln.c 14 | vlog1p.c 15 | vfloor.c 16 | vsin.c 17 | vcos.c 18 | vsincos.c 19 | vtan.c 20 | vasin.c 21 | vacos.c 22 | vatan.c 23 | vatan2.c 24 | ) 25 | 26 | add_library(${OpenVML_LIBNAME}_ref SHARED ${OpenVML_REF_SRC}) 27 | if(NOT MSVC) 28 | target_link_libraries(${OpenVML_LIBNAME}_ref m) 29 | endif() 30 | 31 | target_compile_definitions(${OpenVML_LIBNAME}_ref PUBLIC openvml_EXPORTS) 32 | -------------------------------------------------------------------------------- /reference/vacos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsAcos)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsAsin)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsAtan)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsAtan2)(const VML_INT n, const float * a, const float * b, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || b==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsCos)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsExp)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsExpm1)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsFloor)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsLn)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsLog10)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsLog1p)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsPow)(const VML_INT n, const float * a, const float * b, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || b==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsPow2o3)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsPow3o2)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsPowx)(const VML_INT n, const float * a, const float * b, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || b==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsSin)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsSinCos)(const VML_INT n, const float * a, float * y, float * z){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsSqr)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsTan)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 27 | #include 28 | #include 29 | 30 | void OpenVML_FUNCNAME_REF(vsTanh)(const VML_INT n, const float * a, float * y){ 31 | VML_INT i; 32 | if (n<=0) return; 33 | if (a==NULL || y==NULL) return; 34 | 35 | for(i=0; i 2 | #include 3 | #include "cycle.h" 4 | 5 | #ifdef COMPILER_MSVC 6 | 7 | #include 8 | #pragma intrinsic(__rdtsc) 9 | 10 | #endif 11 | 12 | /* 13 | * From the website 14 | * http://stackoverflow.com/questions/3247373/ 15 | * how-to-measure-program-execution-time-in-arm-cortex-a8-processor 16 | * */ 17 | 18 | #ifdef __arm__ 19 | 20 | static int flag = 0; 21 | 22 | static inline unsigned int get_cyclecount (void) 23 | { 24 | unsigned int value; 25 | // Read CCNT Register 26 | asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(value)); 27 | return value; 28 | } 29 | 30 | static inline void init_perfcounters (int32_t do_reset, int32_t enable_divider) 31 | { 32 | // in general enable all counters (including cycle counter) 33 | int32_t value = 1; 34 | 35 | // peform reset: 36 | if (do_reset) 37 | { 38 | value |= 2; // reset all counters to zero. 39 | value |= 4; // reset cycle counter to zero. 40 | } 41 | 42 | if (enable_divider) 43 | value |= 8; // enable "by 64" divider for CCNT. 44 | 45 | value |= 16; 46 | 47 | // program the performance-counter control-register: 48 | asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"(value)); 49 | 50 | // enable all counters: 51 | asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"(0x8000000f)); 52 | 53 | // clear overflows: 54 | asm volatile ("MCR p15, 0, %0, c9, c12, 3\t\n" :: "r"(0x8000000f)); 55 | } 56 | 57 | static inline unsigned int get_overhead() 58 | { 59 | unsigned int cost = get_cyclecount(); 60 | cost = get_cyclecount() - cost; 61 | return cost; 62 | } 63 | #endif 64 | 65 | unsigned long long get_cycles(void) 66 | { 67 | #ifdef COMPILER_MSVC 68 | return (unsigned long long) __rdtsc(); 69 | 70 | #elif (defined(__arm__)) 71 | if(flag == 0) 72 | init_perfcounters (1, 0); 73 | flag = 1; 74 | return (unsigned long long) get_cyclecount(); 75 | 76 | #elif (defined(__i386__) || defined(__x86_64__)) 77 | unsigned long long low, high; 78 | asm volatile("rdtsc" : "=a"(low), "=d"(high)); 79 | return (unsigned long long)(high << 32 | low); 80 | 81 | #else 82 | return 0; /* Failed */ 83 | 84 | #endif 85 | } 86 | 87 | -------------------------------------------------------------------------------- /test/cycle.h: -------------------------------------------------------------------------------- 1 | #ifdef _OPENVML_CYCLE_H_ 2 | #define _OPENVML_CYCLE_H_ 3 | 4 | unsigned long long get_cycles(void); 5 | 6 | #endif /* _OPENVML_CYCLE_H_ */ 7 | -------------------------------------------------------------------------------- /test/openvml_timer.h: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | #ifdef _OPENVML_TIMER_H_ 26 | #define _OPENVML_TIMER_H_ 27 | 28 | #include "cycle.h" 29 | 30 | double getRealTime(); 31 | 32 | #endif /* _OPENVML_TIMER_H_ */ 33 | -------------------------------------------------------------------------------- /test/test_acos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsAcos", "vdAcos", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vacos[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsAcos), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdAcos), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vacos[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsAcos), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdAcos), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, acos){ 50 | run_test_a_y(data->parameter, funcname, test_vacos, ref_vacos, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, acos){ 54 | run_test_a_y(data->parameter, funcname, test_vacos, ref_vacos, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_asin.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsAsin", "vdAsin", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vasin[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsAsin), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdAsin), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vasin[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsAsin), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdAsin), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, asin){ 50 | run_test_a_y(data->parameter, funcname, test_vasin, ref_vasin, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, asin){ 54 | run_test_a_y(data->parameter, funcname, test_vasin, ref_vasin, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_atan.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsAtan", "vdAtan", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vatan[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsAtan), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdAtan), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vatan[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsAtan), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdAtan), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, atan){ 50 | run_test_a_y(data->parameter, funcname, test_vatan, ref_vatan, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, atan){ 54 | run_test_a_y(data->parameter, funcname, test_vatan, ref_vatan, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_cos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsCos", "vdCos", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vcos[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsCos), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdCos), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vcos[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsCos), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdCos), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, cos){ 50 | run_test_a_y(data->parameter, funcname, test_vcos, ref_vcos, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, cos){ 54 | run_test_a_y(data->parameter, funcname, test_vcos, ref_vcos, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_exp.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsExp", "vdExp", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vexp[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsExp), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdExp), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vexp[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsExp), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdExp), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, exp){ 50 | run_test_a_y(data->parameter, funcname, test_vexp, ref_vexp, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, exp){ 54 | run_test_a_y(data->parameter, funcname, test_vexp, ref_vexp, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_expm1.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsExpm1", "vdExpm1", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vexpm1[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsExpm1), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdExpm1), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vexpm1[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsExpm1), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdExpm1), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, expm1){ 50 | run_test_a_y(data->parameter, funcname, test_vexpm1, ref_vexpm1, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, expm1){ 54 | run_test_a_y(data->parameter, funcname, test_vexpm1, ref_vexpm1, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_floor.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsFloor", "vdFloor", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vfloor[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsFloor), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdFloor), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vfloor[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsFloor), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdFloor), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, floor){ 50 | run_test_a_y(data->parameter, funcname, test_vfloor, ref_vfloor, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, floor){ 54 | run_test_a_y(data->parameter, funcname, test_vfloor, ref_vfloor, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_ln.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsLn", "vdLn", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vLn[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsLn), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdLn), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vLn[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsLn), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdLn), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, ln){ 50 | run_test_a_y(data->parameter, funcname, test_vLn, ref_vLn, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, ln){ 54 | run_test_a_y(data->parameter, funcname, test_vLn, ref_vLn, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_log10.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsLog10", "vdLog10", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vLog10[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsLog10), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdLog10), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vLog10[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsLog10), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdLog10), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, log10){ 50 | run_test_a_y(data->parameter, funcname, test_vLog10, ref_vLog10, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, log10){ 54 | run_test_a_y(data->parameter, funcname, test_vLog10, ref_vLog10, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_log1p.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsLog1p", "vdLog1p", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vLog1p[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsLog1p), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdLog1p), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vLog1p[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsLog1p), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdLog1p), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, log1p){ 50 | run_test_a_y(data->parameter, funcname, test_vLog1p, ref_vLog1p, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, log1p){ 54 | run_test_a_y(data->parameter, funcname, test_vLog1p, ref_vLog1p, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_pow.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsPow", "vdPow", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static ab_y_func_t ref_vPow[] = { 35 | (ab_y_func_t)OpenVML_FUNCNAME_REF(vsPow), 36 | (ab_y_func_t)OpenVML_FUNCNAME_REF(vdPow), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static ab_y_func_t test_vPow[] = { 42 | (ab_y_func_t)OpenVML_FUNCNAME(vsPow), 43 | (ab_y_func_t)OpenVML_FUNCNAME(vdPow), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, Pow){ 50 | run_test_ab_y(data->parameter, funcname, test_vPow, ref_vPow, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, Pow){ 54 | run_test_ab_y(data->parameter, funcname, test_vPow, ref_vPow, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_pow2o3.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsPow2o3", "vdPow2o3", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vpow2o3[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsPow2o3), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdPow2o3), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vpow2o3[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsPow2o3), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdPow2o3), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, pow2o3){ 50 | run_test_a_y(data->parameter, funcname, test_vpow2o3, ref_vpow2o3, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, pow2o3){ 54 | run_test_a_y(data->parameter, funcname, test_vpow2o3, ref_vpow2o3, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_pow3o2.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsPow3o2", "vdPow3o2", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vpow3o2[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsPow3o2), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdPow3o2), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vpow3o2[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsPow3o2), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdPow3o2), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, pow3o2){ 50 | run_test_a_y(data->parameter, funcname, test_vpow3o2, ref_vpow3o2, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, pow3o2){ 54 | run_test_a_y(data->parameter, funcname, test_vpow3o2, ref_vpow3o2, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_powx.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsPowx", "vdPowx", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static ab_y_func_t ref_vPowx[] = { 35 | (ab_y_func_t)OpenVML_FUNCNAME_REF(vsPowx), 36 | (ab_y_func_t)OpenVML_FUNCNAME_REF(vdPowx), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static ab_y_func_t test_vPowx[] = { 42 | (ab_y_func_t)OpenVML_FUNCNAME(vsPowx), 43 | (ab_y_func_t)OpenVML_FUNCNAME(vdPowx), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, Powx){ 50 | run_test_ab_y(data->parameter, funcname, test_vPowx, ref_vPowx, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, Powx){ 54 | run_test_ab_y(data->parameter, funcname, test_vPowx, ref_vPowx, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_sin.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsSin", "vdSin", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vsin[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsSin), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdSin), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vsin[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsSin), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdSin), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, sin){ 50 | run_test_a_y(data->parameter, funcname, test_vsin, ref_vsin, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, sin){ 54 | run_test_a_y(data->parameter, funcname, test_vsin, ref_vsin, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_sincos.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsSinCos", "vdSinCos", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_yz_func_t ref_vsincos[] = { 35 | (a_yz_func_t)OpenVML_FUNCNAME_REF(vsSinCos), 36 | (a_yz_func_t)OpenVML_FUNCNAME_REF(vdSinCos), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_yz_func_t test_vsincos[] = { 42 | (a_yz_func_t)OpenVML_FUNCNAME(vsSinCos), 43 | (a_yz_func_t)OpenVML_FUNCNAME(vdSinCos), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, sincos){ 50 | run_test_a_yz(data->parameter, funcname, test_vsincos, ref_vsincos, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, sincos){ 54 | run_test_a_yz(data->parameter, funcname, test_vsincos, ref_vsincos, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_sqr.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsSqr", "vdSqr", NULL, NULL}; 32 | static double flop_per_elem[4]={1.0, 1.0, 0, 0}; 33 | 34 | static a_y_func_t ref_vsqr[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsSqr), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdSqr), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vsqr[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsSqr), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdSqr), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, sqr){ 50 | run_test_a_y(data->parameter, funcname, test_vsqr, ref_vsqr, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, sqr){ 54 | run_test_a_y(data->parameter, funcname, test_vsqr, ref_vsqr, flop_per_elem); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /test/test_tan.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsTan", "vdTan", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vtan[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsTan), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdTan), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vtan[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsTan), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdTan), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, tan){ 50 | run_test_a_y(data->parameter, funcname, test_vtan, ref_vtan, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, tan){ 54 | run_test_a_y(data->parameter, funcname, test_vtan, ref_vtan, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/test_tanh.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "vml_test.h" 27 | #include 28 | #include 29 | #include 30 | 31 | static char* funcname[4]={"vsTanh", "vdTanh", NULL,NULL}; 32 | static double flop_per_elem[4]={0.0, 0.0, 0.0, 0.0}; 33 | 34 | static a_y_func_t ref_vtanh[] = { 35 | (a_y_func_t)OpenVML_FUNCNAME_REF(vsTanh), 36 | (a_y_func_t)OpenVML_FUNCNAME_REF(vdTanh), 37 | NULL, 38 | NULL, 39 | }; 40 | 41 | static a_y_func_t test_vtanh[] = { 42 | (a_y_func_t)OpenVML_FUNCNAME(vsTanh), 43 | (a_y_func_t)OpenVML_FUNCNAME(vdTanh), 44 | NULL, 45 | NULL, 46 | }; 47 | 48 | 49 | CTEST2(check_result_s, tanh){ 50 | run_test_a_y(data->parameter, funcname, test_vtanh, ref_vtanh, flop_per_elem); 51 | } 52 | 53 | CTEST2(check_result_d, tanh){ 54 | run_test_a_y(data->parameter, funcname, test_vtanh, ref_vtanh, flop_per_elem); 55 | } 56 | -------------------------------------------------------------------------------- /test/vml_misc_test.c: -------------------------------------------------------------------------------- 1 | /* * Copyright (c) 2014, 2015 Zhang Xianyi 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, 5 | * are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, this 11 | * list of conditions and the following disclaimer in the documentation and/or 12 | * other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #define CTEST_MAIN 29 | #include "ctest.h" 30 | 31 | 32 | CTEST(misc, openvml_get_config){ 33 | char * tmp; 34 | tmp=openvml_get_config(); 35 | printf("\n"); 36 | printf("OpenVML config: %s\n", tmp); 37 | } 38 | 39 | int main(int argc, const char ** argv){ 40 | 41 | int num_fail=0; 42 | 43 | num_fail=ctest_main(argc, argv); 44 | 45 | return num_fail; 46 | } 47 | --------------------------------------------------------------------------------