pax_global_header00006660000000000000000000000064132515544540014522gustar00rootroot0000000000000052 comment=00236279a293b3737dee08c14f25923a889d2795 libclc-0.2.0+git20180312/000077500000000000000000000000001325155445400143515ustar00rootroot00000000000000libclc-0.2.0+git20180312/.gitignore000066400000000000000000000003531325155445400163420ustar00rootroot00000000000000Makefile amdgcn-- amdgcn--amdhsa amdgcn-mesa-mesa3d build/*.pyc built_libs/ generic-- generic/lib/convert.cl libclc.pc nvptx--nvidiacl nvptx64--nvidiacl r600-- utils/prepare-builtins utils/prepare-builtins.o utils/prepare-builtins.o.d libclc-0.2.0+git20180312/.travis.yml000066400000000000000000000052671325155445400164740ustar00rootroot00000000000000language: cpp sudo: false dist: trusty cache: apt: true matrix: include: - env: - LABEL="make gcc LLVM-3.9" - LLVM_VERSION=3.9 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}" - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc" addons: apt: sources: - llvm-toolchain-trusty-3.9 packages: - libedit-dev - g++-4.8 # From sources above - llvm-3.9-dev - clang-3.9 - env: - LABEL="make gcc LLVM-4.0" - LLVM_VERSION=4.0 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}" - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc" addons: apt: sources: - llvm-toolchain-trusty-4.0 packages: - libedit-dev - g++-4.8 # From sources above - llvm-4.0-dev - clang-4.0 - env: - LABEL="make gcc LLVM-5.0" - LLVM_VERSION=5.0 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}" - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc" addons: apt: sources: - llvm-toolchain-trusty-5.0 packages: - libedit-dev - g++-4.8 # From sources above - llvm-5.0-dev - clang-5.0 - env: - LABEL="make gcc LLVM-6.0" - LLVM_VERSION=6.0 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}" - CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc" # llvm passes -Werror=date-time which is only supported in gcc-4.9+ - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" addons: apt: sources: - sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main' - ubuntu-toolchain-r-test packages: - libedit-dev # LLVM-6 needs libstdc++4.9 - g++-4.9 # From sources above - llvm-6.0-dev - clang-6.0 before_install: - eval "${MATRIX_EVAL}" script: - $PYTHON ./configure.py --with-llvm-config=$LLVM_CONFIG --with-cxx-compiler=$CXX && make -j4 - ret=0; for f in $CHECK_FILES; do ./check_external_calls.sh built_libs/$f || ret=1; done; test $ret -eq 0 libclc-0.2.0+git20180312/CREDITS.TXT000066400000000000000000000000521325155445400160440ustar00rootroot00000000000000N: Peter Collingbourne E: peter@pcc.me.uk libclc-0.2.0+git20180312/LICENSE.TXT000066400000000000000000000062731325155445400160440ustar00rootroot00000000000000============================================================================== libclc License ============================================================================== The libclc library is dual licensed under both the University of Illinois "BSD-Like" license and the MIT license. As a user of this code you may choose to use it under either license. As a contributor, you agree to allow your code to be used under both. Full text of the relevant licenses is included below. ============================================================================== Copyright (c) 2011-2016 by the contributors listed in CREDITS.TXT All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. ============================================================================== Copyright (c) 2011-2014 by the contributors listed in CREDITS.TXT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. libclc-0.2.0+git20180312/README.TXT000066400000000000000000000031271325155445400157120ustar00rootroot00000000000000libclc ------ libclc is an open source, BSD licensed implementation of the library requirements of the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. The following sections of the specification impose library requirements: * 6.1: Supported Data Types * 6.2.3: Explicit Conversions * 6.2.4.2: Reinterpreting Types Using as_type() and as_typen() * 6.9: Preprocessor Directives and Macros * 6.11: Built-in Functions * 9.3: Double Precision Floating-Point * 9.4: 64-bit Atomics * 9.5: Writing to 3D image memory objects * 9.6: Half Precision Floating-Point libclc is intended to be used with the Clang compiler's OpenCL frontend. libclc is designed to be portable and extensible. To this end, it provides generic implementations of most library requirements, allowing the target to override the generic implementation at the granularity of individual functions. libclc currently only supports the PTX target, but support for more targets is welcome. Compiling and installing with Make ---------------------------------- $ ./configure.py --with-llvm-config=/path/to/llvm-config && make $ make install Note you can use the DESTDIR Makefile variable to do staged installs. $ make install DESTDIR=/path/for/staged/install Compiling and installing with Ninja ----------------------------------- $ ./configure.py -g ninja --with-llvm-config=/path/to/llvm-config && ninja $ ninja install Note you can use the DESTDIR environment variable to do staged installs. $ DESTDIR=/path/for/staged/install ninja install Website ------- http://www.pcc.me.uk/~peter/libclc/ libclc-0.2.0+git20180312/amdgcn-amdhsa/000077500000000000000000000000001325155445400170355ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/000077500000000000000000000000001325155445400176035ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/OVERRIDES000066400000000000000000000002551325155445400210720ustar00rootroot00000000000000workitem/get_num_groups.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.40.ll workitem/get_global_size.40.ll workitem/get_local_size.40.ll libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/OVERRIDES_3.9000066400000000000000000000001251325155445400214570ustar00rootroot00000000000000workitem/get_global_size.cl workitem/get_local_size.cl workitem/get_num_groups.39.ll libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/OVERRIDES_4.0000066400000000000000000000000671325155445400214540ustar00rootroot00000000000000workitem/get_global_size.cl workitem/get_local_size.cl libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/OVERRIDES_5.0000066400000000000000000000000671325155445400214550ustar00rootroot00000000000000workitem/get_global_size.cl workitem/get_local_size.cl libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/SOURCES000066400000000000000000000001221325155445400206440ustar00rootroot00000000000000workitem/get_global_size.cl workitem/get_local_size.cl workitem/get_num_groups.cl libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/SOURCES_3.9000066400000000000000000000000751325155445400212440ustar00rootroot00000000000000workitem/get_global_size.39.ll workitem/get_local_size.39.ll libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/SOURCES_4.0000066400000000000000000000000751325155445400212340ustar00rootroot00000000000000workitem/get_global_size.50.ll workitem/get_local_size.50.ll libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/SOURCES_5.0000066400000000000000000000000751325155445400212350ustar00rootroot00000000000000workitem/get_global_size.50.ll workitem/get_local_size.50.ll libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/000077500000000000000000000000001325155445400214445ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll000066400000000000000000000021751325155445400253650ustar00rootroot00000000000000declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0 define i32 @get_global_size(i32 %dim) #1 { %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() switch i32 %dim, label %default [ i32 0, label %x i32 1, label %y i32 2, label %z ] x: %ptr_x = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 12 %ptr_x32 = bitcast i8 addrspace(2)* %ptr_x to i32 addrspace(2)* %x32 = load i32, i32 addrspace(2)* %ptr_x32, align 4, !invariant.load !0 ret i32 %x32 y: %ptr_y = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 16 %ptr_y32 = bitcast i8 addrspace(2)* %ptr_y to i32 addrspace(2)* %y32 = load i32, i32 addrspace(2)* %ptr_y32, align 4, !invariant.load !0 ret i32 %y32 z: %ptr_z = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 20 %ptr_z32 = bitcast i8 addrspace(2)* %ptr_z to i32 addrspace(2)* %z32 = load i32, i32 addrspace(2)* %ptr_z32, align 4, !invariant.load !0 ret i32 %z32 default: ret i32 1 } attributes #0 = { nounwind readnone } attributes #1 = { alwaysinline norecurse nounwind readonly } !0 = !{} libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_global_size.50.ll000066400000000000000000000023511325155445400253520ustar00rootroot00000000000000declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0 define i64 @get_global_size(i32 %dim) #1 { %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() switch i32 %dim, label %default [ i32 0, label %x i32 1, label %y i32 2, label %z ] x: %ptr_x = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i64 12 %ptr_x32 = bitcast i8 addrspace(2)* %ptr_x to i32 addrspace(2)* %x32 = load i32, i32 addrspace(2)* %ptr_x32, align 4, !invariant.load !0 %size_x = zext i32 %x32 to i64 ret i64 %size_x y: %ptr_y = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i64 16 %ptr_y32 = bitcast i8 addrspace(2)* %ptr_y to i32 addrspace(2)* %y32 = load i32, i32 addrspace(2)* %ptr_y32, align 4, !invariant.load !0 %size_y = zext i32 %y32 to i64 ret i64 %size_y z: %ptr_z = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i64 20 %ptr_z32 = bitcast i8 addrspace(2)* %ptr_z to i32 addrspace(2)* %z32 = load i32, i32 addrspace(2)* %ptr_z32, align 4, !invariant.load !0 %size_z = zext i32 %z32 to i64 ret i64 %size_z default: ret i64 1 } attributes #0 = { nounwind readnone } attributes #1 = { alwaysinline norecurse nounwind readonly } !0 = !{} libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_global_size.cl000066400000000000000000000005151325155445400251160ustar00rootroot00000000000000#include #if __clang_major__ >= 7 #define CONST_AS __attribute__((address_space(4))) #else #define CONST_AS __attribute__((address_space(2))) #endif _CLC_DEF size_t get_global_size(uint dim) { CONST_AS uint * ptr = (CONST_AS uint *) __builtin_amdgcn_dispatch_ptr(); if (dim < 3) return ptr[3 + dim]; return 1; } libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll000066400000000000000000000020361325155445400252130ustar00rootroot00000000000000declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0 define i32 @get_local_size(i32 %dim) #1 { %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() %dispatch_ptr_i32 = bitcast i8 addrspace(2)* %dispatch_ptr to i32 addrspace(2)* %xy_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i32 1 %xy_size = load i32, i32 addrspace(2)* %xy_size_ptr, align 4, !invariant.load !0 switch i32 %dim, label %default [ i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim ] x_dim: %x_size = and i32 %xy_size, 65535 ret i32 %x_size y_dim: %y_size = lshr i32 %xy_size, 16 ret i32 %y_size z_dim: %z_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i32 2 %z_size = load i32, i32 addrspace(2)* %z_size_ptr, align 4, !invariant.load !0, !range !1 ret i32 %z_size default: ret i32 1 } attributes #0 = { nounwind readnone } attributes #1 = { alwaysinline norecurse nounwind readonly } !0 = !{} !1 = !{ i32 0, i32 257 } libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_local_size.50.ll000066400000000000000000000022421325155445400252030ustar00rootroot00000000000000declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0 define i64 @get_local_size(i32 %dim) #1 { %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() %dispatch_ptr_i32 = bitcast i8 addrspace(2)* %dispatch_ptr to i32 addrspace(2)* %xy_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i64 1 %xy_size = load i32, i32 addrspace(2)* %xy_size_ptr, align 4, !invariant.load !0 switch i32 %dim, label %default [ i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim ] x_dim: %x_size = and i32 %xy_size, 65535 %x_size.ext = zext i32 %x_size to i64 ret i64 %x_size.ext y_dim: %y_size = lshr i32 %xy_size, 16 %y_size.ext = zext i32 %y_size to i64 ret i64 %y_size.ext z_dim: %z_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i64 2 %z_size = load i32, i32 addrspace(2)* %z_size_ptr, align 4, !invariant.load !0, !range !1 %z_size.ext = zext i32 %z_size to i64 ret i64 %z_size.ext default: ret i64 1 } attributes #0 = { nounwind readnone } attributes #1 = { alwaysinline norecurse nounwind readonly } !0 = !{} !1 = !{ i32 0, i32 257 } libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_local_size.cl000066400000000000000000000006421325155445400247510ustar00rootroot00000000000000#include #if __clang_major__ >= 7 #define CONST_AS __attribute__((address_space(4))) #else #define CONST_AS __attribute__((address_space(2))) #endif _CLC_DEF size_t get_local_size(uint dim) { CONST_AS uint * ptr = (CONST_AS uint *) __builtin_amdgcn_dispatch_ptr(); switch (dim) { case 0: return ptr[1] & 0xffffu; case 1: return ptr[1] >> 16; case 2: return ptr[2] & 0xffffu; } return 1; } libclc-0.2.0+git20180312/amdgcn-amdhsa/lib/workitem/get_num_groups.cl000066400000000000000000000004361325155445400250240ustar00rootroot00000000000000 #include _CLC_DEF size_t get_num_groups(uint dim) { size_t global_size = get_global_size(dim); size_t local_size = get_local_size(dim); size_t num_groups = global_size / local_size; if (global_size % local_size != 0) { num_groups++; } return num_groups; } libclc-0.2.0+git20180312/amdgcn/000077500000000000000000000000001325155445400156025ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/000077500000000000000000000000001325155445400163505ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/OVERRIDES000066400000000000000000000000001325155445400176230ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/OVERRIDES_3.9000066400000000000000000000002021325155445400202200ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll libclc-0.2.0+git20180312/amdgcn/lib/OVERRIDES_4.0000066400000000000000000000002021325155445400202100ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll libclc-0.2.0+git20180312/amdgcn/lib/OVERRIDES_5.0000066400000000000000000000002021325155445400202110ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll libclc-0.2.0+git20180312/amdgcn/lib/OVERRIDES_6.0000066400000000000000000000002021325155445400202120ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll libclc-0.2.0+git20180312/amdgcn/lib/SOURCES000066400000000000000000000005251325155445400174200ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.ll integer/popcount.cl math/fmax.cl math/fmin.cl math/ldexp.cl mem_fence/fence.cl synchronization/barrier.cl workitem/get_global_offset.cl workitem/get_group_id.cl workitem/get_global_size.ll workitem/get_local_id.cl workitem/get_local_size.ll workitem/get_num_groups.ll workitem/get_work_dim.cl libclc-0.2.0+git20180312/amdgcn/lib/SOURCES_3.9000066400000000000000000000002431325155445400200060ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.39.ll mem_fence/waitcnt.ll workitem/get_global_size.39.ll workitem/get_local_size.39.ll workitem/get_num_groups.39.ll libclc-0.2.0+git20180312/amdgcn/lib/SOURCES_4.0000066400000000000000000000002431325155445400177760ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.39.ll mem_fence/waitcnt.ll workitem/get_global_size.40.ll workitem/get_local_size.40.ll workitem/get_num_groups.40.ll libclc-0.2.0+git20180312/amdgcn/lib/SOURCES_5.0000066400000000000000000000002161325155445400177770ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.39.ll workitem/get_global_size.40.ll workitem/get_local_size.40.ll workitem/get_num_groups.40.ll libclc-0.2.0+git20180312/amdgcn/lib/SOURCES_6.0000066400000000000000000000002161325155445400200000ustar00rootroot00000000000000cl_khr_int64_extended_atomics/minmax_helpers.39.ll workitem/get_global_size.40.ll workitem/get_local_size.40.ll workitem/get_num_groups.40.ll libclc-0.2.0+git20180312/amdgcn/lib/cl_khr_int64_extended_atomics/000077500000000000000000000000001325155445400242355ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/cl_khr_int64_extended_atomics/minmax_helpers.39.ll000066400000000000000000000035341325155445400300400ustar00rootroot00000000000000target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i64 @__clc__sync_fetch_and_min_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile min i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umin_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umin i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_min_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile min i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umin_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umin i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_max_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile max i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umax_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umax i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_max_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile max i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umax_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umax i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } libclc-0.2.0+git20180312/amdgcn/lib/cl_khr_int64_extended_atomics/minmax_helpers.ll000066400000000000000000000035501325155445400276040ustar00rootroot00000000000000target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i64 @__clc__sync_fetch_and_min_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile min i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umin_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umin i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_min_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile min i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umin_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umin i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_max_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile max i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umax_global_8(i64 addrspace(1)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umax i64 addrspace(1)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_max_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile max i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } define i64 @__clc__sync_fetch_and_umax_local_8(i64 addrspace(3)* nocapture %ptr, i64 %value) nounwind alwaysinline { entry: %0 = atomicrmw volatile umax i64 addrspace(3)* %ptr, i64 %value seq_cst ret i64 %0 } libclc-0.2.0+git20180312/amdgcn/lib/integer/000077500000000000000000000000001325155445400200055ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/integer/popcount.cl000066400000000000000000000002141325155445400221710ustar00rootroot00000000000000#include #include #include #define __CLC_BODY "popcount.inc" #include libclc-0.2.0+git20180312/amdgcn/lib/integer/popcount.inc000066400000000000000000000014371325155445400223540ustar00rootroot00000000000000_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE popcount(__CLC_GENTYPE x) { /* LLVM-4+ implements i16 ops for VI+ ASICs. However, ctpop implementation * is missing until r326535. Therefore we have to convert sub i32 types to uint * as a workaround. */ #if __clang_major__ < 7 && __clang_major__ > 3 && __CLC_GENSIZE < 32 /* Prevent sign extension on uint conversion */ const __CLC_U_GENTYPE y = __CLC_XCONCAT(as_, __CLC_U_GENTYPE)(x); /* Convert to uintX */ const __CLC_XCONCAT(uint, __CLC_VECSIZE) z = __CLC_XCONCAT(convert_uint, __CLC_VECSIZE)(y); /* Call popcount on uintX type */ const __CLC_XCONCAT(uint, __CLC_VECSIZE) res = __clc_native_popcount(z); /* Convert the result back to gentype. */ return __CLC_XCONCAT(convert_, __CLC_GENTYPE)(res); #else return __clc_native_popcount(x); #endif } libclc-0.2.0+git20180312/amdgcn/lib/math/000077500000000000000000000000001325155445400173015ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/math/fmax.cl000066400000000000000000000015551325155445400205620ustar00rootroot00000000000000#include #include "../../../generic/lib/clcmacro.h" _CLC_DEF _CLC_OVERLOAD float fmax(float x, float y) { /* fcanonicalize removes sNaNs and flushes denormals if not enabled. * Otherwise fmax instruction flushes the values for comparison, * but outputs original denormal */ x = __builtin_canonicalizef(x); y = __builtin_canonicalizef(y); return __builtin_fmaxf(x, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, fmax, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEF _CLC_OVERLOAD double fmax(double x, double y) { x = __builtin_canonicalize(x); y = __builtin_canonicalize(y); return __builtin_fmax(x, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, fmax, double, double) #endif #define __CLC_BODY <../../../generic/lib/math/fmax.inc> #include libclc-0.2.0+git20180312/amdgcn/lib/math/fmin.cl000066400000000000000000000015601325155445400205540ustar00rootroot00000000000000#include #include "../../../generic/lib/clcmacro.h" _CLC_DEF _CLC_OVERLOAD float fmin(float x, float y) { /* fcanonicalize removes sNaNs and flushes denormals if not enabled. * Otherwise fmin instruction flushes the values for comparison, * but outputs original denormal */ x = __builtin_canonicalizef(x); y = __builtin_canonicalizef(y); return __builtin_fminf(x, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, fmin, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEF _CLC_OVERLOAD double fmin(double x, double y) { x = __builtin_canonicalizef(x); y = __builtin_canonicalizef(y); return __builtin_fminf(x, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, fmin, double, double) #endif #define __CLC_BODY <../../../generic/lib/math/fmin.inc> #include libclc-0.2.0+git20180312/amdgcn/lib/math/ldexp.cl000066400000000000000000000034341325155445400207410ustar00rootroot00000000000000/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../../../generic/lib/clcmacro.h" #ifdef __HAS_LDEXPF__ #define BUILTINF __builtin_amdgcn_ldexpf #else #include "math/clc_ldexp.h" #define BUILTINF __clc_ldexp #endif // This defines all the ldexp(floatN, intN) variants. _CLC_DEFINE_BINARY_BUILTIN(float, ldexp, BUILTINF, float, int); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // This defines all the ldexp(doubleN, intN) variants. _CLC_DEFINE_BINARY_BUILTIN(double, ldexp, __builtin_amdgcn_ldexp, double, int); #endif // This defines all the ldexp(GENTYPE, int); #define __CLC_BODY <../../../generic/lib/math/ldexp.inc> #include #undef BUILTINF libclc-0.2.0+git20180312/amdgcn/lib/mem_fence/000077500000000000000000000000001325155445400202665ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/mem_fence/fence.cl000066400000000000000000000020251325155445400216650ustar00rootroot00000000000000#include void __clc_amdgcn_s_waitcnt(unsigned flags); // s_waitcnt takes 16bit argument with a combined number of maximum allowed // pending operations: // [12:8] LGKM -- LDS, GDS, Konstant (SMRD), Messages // [7] -- undefined // [6:4] -- exports, GDS, and mem write // [3:0] -- vector memory operations // Newer clang supports __builtin_amdgcn_s_waitcnt #if __clang_major__ >= 5 # define __waitcnt(x) __builtin_amdgcn_s_waitcnt(x) #else # define __waitcnt(x) __clc_amdgcn_s_waitcnt(x) #endif _CLC_DEF void mem_fence(cl_mem_fence_flags flags) { if (flags & CLK_GLOBAL_MEM_FENCE) { // scalar loads are counted with LGKM but we don't know whether // the compiler turned any loads to scalar __waitcnt(0); } else if (flags & CLK_LOCAL_MEM_FENCE) __waitcnt(0xff); // LGKM is [12:8] } #undef __waitcnt // We don't have separate mechanism for read and write fences _CLC_DEF void read_mem_fence(cl_mem_fence_flags flags) { mem_fence(flags); } _CLC_DEF void write_mem_fence(cl_mem_fence_flags flags) { mem_fence(flags); } libclc-0.2.0+git20180312/amdgcn/lib/mem_fence/waitcnt.ll000066400000000000000000000007141325155445400222720ustar00rootroot00000000000000declare void @llvm.amdgcn.s.waitcnt(i32) #0 target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" ; Export waitcnt intrinsic for clang < 5 define void @__clc_amdgcn_s_waitcnt(i32 %flags) #1 { entry: tail call void @llvm.amdgcn.s.waitcnt(i32 %flags) ret void } attributes #0 = { nounwind } attributes #1 = { nounwind alwaysinline } libclc-0.2.0+git20180312/amdgcn/lib/synchronization/000077500000000000000000000000001325155445400216115ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/synchronization/barrier.cl000066400000000000000000000001741325155445400235610ustar00rootroot00000000000000#include _CLC_DEF void barrier(cl_mem_fence_flags flags) { mem_fence(flags); __builtin_amdgcn_s_barrier(); } libclc-0.2.0+git20180312/amdgcn/lib/workitem/000077500000000000000000000000001325155445400202115ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_global_offset.cl000066400000000000000000000005221325155445400241750ustar00rootroot00000000000000#include #if __clang_major__ >= 7 #define CONST_AS __attribute__((address_space(4))) #else #define CONST_AS __attribute__((address_space(2))) #endif _CLC_DEF size_t get_global_offset(uint dim) { CONST_AS uint * ptr = (CONST_AS uint *) __builtin_amdgcn_implicitarg_ptr(); if (dim < 3) return ptr[dim + 1]; return 0; } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_global_size.39.ll000066400000000000000000000013661325155445400241330ustar00rootroot00000000000000declare i32 @llvm.r600.read.global.size.x() nounwind readnone declare i32 @llvm.r600.read.global.size.y() nounwind readnone declare i32 @llvm.r600.read.global.size.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.global.size.x() ret i32 %x y_dim: %y = call i32 @llvm.r600.read.global.size.y() ret i32 %y z_dim: %z = call i32 @llvm.r600.read.global.size.z() ret i32 %z default: ret i32 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_global_size.40.ll000066400000000000000000000015341325155445400241200ustar00rootroot00000000000000declare i32 @llvm.r600.read.global.size.x() nounwind readnone declare i32 @llvm.r600.read.global.size.y() nounwind readnone declare i32 @llvm.r600.read.global.size.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i64 @get_global_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.global.size.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.global.size.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.global.size.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_global_size.ll000066400000000000000000000015501325155445400236740ustar00rootroot00000000000000declare i32 @llvm.r600.read.global.size.x() nounwind readnone declare i32 @llvm.r600.read.global.size.y() nounwind readnone declare i32 @llvm.r600.read.global.size.z() nounwind readnone target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i64 @get_global_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.global.size.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.global.size.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.global.size.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_group_id.cl000066400000000000000000000004001325155445400231720ustar00rootroot00000000000000#include _CLC_DEF size_t get_group_id(uint dim) { switch(dim) { case 0: return __builtin_amdgcn_workgroup_id_x(); case 1: return __builtin_amdgcn_workgroup_id_y(); case 2: return __builtin_amdgcn_workgroup_id_z(); default: return 1; } } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_local_id.cl000066400000000000000000000003751325155445400231430ustar00rootroot00000000000000#include _CLC_DEF size_t get_local_id(uint dim) { switch(dim) { case 0: return __builtin_amdgcn_workitem_id_x(); case 1: return __builtin_amdgcn_workitem_id_y(); case 2: return __builtin_amdgcn_workitem_id_z(); default: return 1; } } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_local_size.39.ll000066400000000000000000000013571325155445400237650ustar00rootroot00000000000000declare i32 @llvm.r600.read.local.size.x() nounwind readnone declare i32 @llvm.r600.read.local.size.y() nounwind readnone declare i32 @llvm.r600.read.local.size.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_local_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.local.size.x() ret i32 %x y_dim: %y = call i32 @llvm.r600.read.local.size.y() ret i32 %y z_dim: %z = call i32 @llvm.r600.read.local.size.z() ret i32 %z default: ret i32 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_local_size.40.ll000066400000000000000000000015251325155445400237520ustar00rootroot00000000000000declare i32 @llvm.r600.read.local.size.x() nounwind readnone declare i32 @llvm.r600.read.local.size.y() nounwind readnone declare i32 @llvm.r600.read.local.size.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i64 @get_local_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.local.size.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.local.size.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.local.size.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_local_size.ll000066400000000000000000000015411325155445400235260ustar00rootroot00000000000000declare i32 @llvm.r600.read.local.size.x() nounwind readnone declare i32 @llvm.r600.read.local.size.y() nounwind readnone declare i32 @llvm.r600.read.local.size.z() nounwind readnone target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i64 @get_local_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.local.size.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.local.size.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.local.size.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_num_groups.39.ll000066400000000000000000000013351325155445400240330ustar00rootroot00000000000000declare i32 @llvm.r600.read.ngroups.x() nounwind readnone declare i32 @llvm.r600.read.ngroups.y() nounwind readnone declare i32 @llvm.r600.read.ngroups.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_num_groups(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.ngroups.x() ret i32 %x y_dim: %y = call i32 @llvm.r600.read.ngroups.y() ret i32 %y z_dim: %z = call i32 @llvm.r600.read.ngroups.z() ret i32 %z default: ret i32 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_num_groups.40.ll000066400000000000000000000015031325155445400240200ustar00rootroot00000000000000declare i32 @llvm.r600.read.ngroups.x() nounwind readnone declare i32 @llvm.r600.read.ngroups.y() nounwind readnone declare i32 @llvm.r600.read.ngroups.z() nounwind readnone target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i64 @get_num_groups(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.ngroups.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.ngroups.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.ngroups.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_num_groups.ll000066400000000000000000000015171325155445400236030ustar00rootroot00000000000000declare i32 @llvm.r600.read.ngroups.x() nounwind readnone declare i32 @llvm.r600.read.ngroups.y() nounwind readnone declare i32 @llvm.r600.read.ngroups.z() nounwind readnone target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i64 @get_num_groups(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.ngroups.x() %x.ext = zext i32 %x to i64 ret i64 %x.ext y_dim: %y = call i32 @llvm.r600.read.ngroups.y() %y.ext = zext i32 %y to i64 ret i64 %y.ext z_dim: %z = call i32 @llvm.r600.read.ngroups.z() %z.ext = zext i32 %z to i64 ret i64 %z.ext default: ret i64 1 } libclc-0.2.0+git20180312/amdgcn/lib/workitem/get_work_dim.cl000066400000000000000000000004471325155445400232100ustar00rootroot00000000000000#include #if __clang_major__ >= 7 #define CONST_AS __attribute__((address_space(4))) #else #define CONST_AS __attribute__((address_space(2))) #endif _CLC_DEF uint get_work_dim(void) { CONST_AS uint * ptr = (CONST_AS uint *) __builtin_amdgcn_implicitarg_ptr(); return ptr[0]; } libclc-0.2.0+git20180312/amdgpu/000077500000000000000000000000001325155445400156265ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgpu/lib/000077500000000000000000000000001325155445400163745ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgpu/lib/OVERRIDES000066400000000000000000000000651325155445400176620ustar00rootroot00000000000000workitem/get_group_id.cl workitem/get_global_size.cl libclc-0.2.0+git20180312/amdgpu/lib/SOURCES000066400000000000000000000003761325155445400174500ustar00rootroot00000000000000math/native_exp.cl math/native_log.cl math/native_log10.cl math/half_exp.cl math/half_exp10.cl math/half_exp2.cl math/half_log.cl math/half_log10.cl math/half_log2.cl math/half_recip.cl math/half_rsqrt.cl math/half_sqrt.cl math/nextafter.cl math/sqrt.cl libclc-0.2.0+git20180312/amdgpu/lib/SOURCES_3.9000066400000000000000000000000731325155445400200330ustar00rootroot00000000000000shared/vload_half_helpers.ll shared/vstore_half_helpers.ll libclc-0.2.0+git20180312/amdgpu/lib/SOURCES_4.0000066400000000000000000000000731325155445400200230ustar00rootroot00000000000000shared/vload_half_helpers.ll shared/vstore_half_helpers.ll libclc-0.2.0+git20180312/amdgpu/lib/SOURCES_5.0000066400000000000000000000000731325155445400200240ustar00rootroot00000000000000shared/vload_half_helpers.ll shared/vstore_half_helpers.ll libclc-0.2.0+git20180312/amdgpu/lib/math/000077500000000000000000000000001325155445400173255ustar00rootroot00000000000000libclc-0.2.0+git20180312/amdgpu/lib/math/half_exp.cl000066400000000000000000000002161325155445400214320ustar00rootroot00000000000000#include #define __CLC_FUNC exp #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_exp10.cl000066400000000000000000000002201325155445400215660ustar00rootroot00000000000000#include #define __CLC_FUNC exp10 #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_exp2.cl000066400000000000000000000002171325155445400215150ustar00rootroot00000000000000#include #define __CLC_FUNC exp2 #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_log.cl000066400000000000000000000002161325155445400214170ustar00rootroot00000000000000#include #define __CLC_FUNC log #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_log10.cl000066400000000000000000000002201325155445400215530ustar00rootroot00000000000000#include #define __CLC_FUNC log10 #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_log2.cl000066400000000000000000000002171325155445400215020ustar00rootroot00000000000000#include #define __CLC_FUNC log2 #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_native_unary.inc000066400000000000000000000004621325155445400235200ustar00rootroot00000000000000#include #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) #define __CLC_NATIVE_FUNC(x) __CLC_CONCAT(native_, x) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE val) { return __CLC_NATIVE_FUNC(__CLC_FUNC)(val); } #undef __CLC_NATIVE_FUNC #undef __CLC_HALF_FUNC libclc-0.2.0+git20180312/amdgpu/lib/math/half_recip.cl000066400000000000000000000002201325155445400217330ustar00rootroot00000000000000#include #define __CLC_FUNC recip #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_rsqrt.cl000066400000000000000000000002201325155445400220040ustar00rootroot00000000000000#include #define __CLC_FUNC rsqrt #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/half_sqrt.cl000066400000000000000000000002171325155445400216300ustar00rootroot00000000000000#include #define __CLC_FUNC sqrt #define __FLOAT_ONLY #define __CLC_BODY #include libclc-0.2.0+git20180312/amdgpu/lib/math/native_exp.cl000066400000000000000000000001571325155445400220120ustar00rootroot00000000000000#include #define __CLC_BODY #define __FLOAT_ONLY #include libclc-0.2.0+git20180312/amdgpu/lib/math/native_exp.inc000066400000000000000000000001561325155445400221640ustar00rootroot00000000000000_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp(__CLC_GENTYPE val) { return native_exp2(val * M_LOG2E_F); } libclc-0.2.0+git20180312/amdgpu/lib/math/native_log.cl000066400000000000000000000001571325155445400217770ustar00rootroot00000000000000#include #define __CLC_BODY #define __FLOAT_ONLY #include libclc-0.2.0+git20180312/amdgpu/lib/math/native_log.inc000066400000000000000000000001671325155445400221530ustar00rootroot00000000000000_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log(__CLC_GENTYPE val) { return native_log2(val) * (1.0f / M_LOG2E_F); } libclc-0.2.0+git20180312/amdgpu/lib/math/native_log10.cl000066400000000000000000000001611325155445400221330ustar00rootroot00000000000000#include #define __CLC_BODY #define __FLOAT_ONLY #include libclc-0.2.0+git20180312/amdgpu/lib/math/native_log10.inc000066400000000000000000000001731325155445400223110ustar00rootroot00000000000000_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_log10(__CLC_GENTYPE val) { return native_log2(val) * (M_LN2_F / M_LN10_F); } libclc-0.2.0+git20180312/amdgpu/lib/math/nextafter.cl000066400000000000000000000004671325155445400216540ustar00rootroot00000000000000#include #include "../lib/clcmacro.h" #include _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, nextafter, __clc_nextafter, double, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/amdgpu/lib/math/sqrt.cl����������������������������������������������������0000664�0000000�0000000�00000004126�13251554454�0020641�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../../../generic/lib/clcmacro.h" #include "math/clc_sqrt.h" _CLC_DEFINE_UNARY_BUILTIN(float, sqrt, __clc_sqrt, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #ifdef __AMDGCN__ #define __clc_builtin_rsq __builtin_amdgcn_rsq #else #define __clc_builtin_rsq __builtin_r600_recipsqrt_ieee #endif _CLC_OVERLOAD _CLC_DEF double sqrt(double x) { uint vcc = x < 0x1p-767; uint exp0 = vcc ? 0x100 : 0; unsigned exp1 = vcc ? 0xffffff80 : 0; double v01 = ldexp(x, exp0); double v23 = __clc_builtin_rsq(v01); double v45 = v01 * v23; v23 = v23 * 0.5; double v67 = fma(-v23, v45, 0.5); v45 = fma(v45, v67, v45); double v89 = fma(-v45, v45, v01); v23 = fma(v23, v67, v23); v45 = fma(v89, v23, v45); v67 = fma(-v45, v45, v01); v23 = fma(v67, v23, v45); v23 = ldexp(v23, exp1); return ((x == __builtin_inf()) || (x == 0.0)) ? v01 : v23; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sqrt, double); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/amdgpu/lib/shared/���������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017642�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/amdgpu/lib/shared/vload_half_helpers.ll������������������������������������0000664�0000000�0000000�00000001515�13251554454�0024016�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������define float @__clc_vload_half_float_helper__private(half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(0)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__global(half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(1)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__local(half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(3)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__constant(half addrspace(2)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(2)* %ptr %res = fpext half %data to float ret float %res } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/amdgpu/lib/shared/vstore_half_helpers.ll�����������������������������������0000664�0000000�0000000�00000002444�13251554454�0024235�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������define void @__clc_vstore_half_float_helper__private(float %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(0)* %ptr ret void } define void @__clc_vstore_half_float_helper__global(float %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(1)* %ptr ret void } define void @__clc_vstore_half_float_helper__local(float %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(3)* %ptr ret void } define void @__clc_vstore_half_double_helper__private(double %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(0)* %ptr ret void } define void @__clc_vstore_half_double_helper__global(double %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(1)* %ptr ret void } define void @__clc_vstore_half_double_helper__local(double %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(3)* %ptr ret void } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/build/���������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015450�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/build/metabuild.py���������������������������������������������������������0000664�0000000�0000000�00000005364�13251554454�0020000�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import ninja_syntax import os # Simple meta-build system. class Make(object): def __init__(self): self.output = open(self.output_filename(), 'w') self.rules = {} self.rule_text = '' self.all_targets = [] self.default_targets = [] self.clean_files = [] self.distclean_files = [] self.output.write("""all:: ifndef VERBOSE Verb = @ endif """) def output_filename(self): return 'Makefile' def rule(self, name, command, description=None, depfile=None, generator=False): self.rules[name] = {'command': command, 'description': description, 'depfile': depfile, 'generator': generator} def build(self, output, rule, inputs=[], implicit=[], order_only=[]): inputs = self._as_list(inputs) implicit = self._as_list(implicit) order_only = self._as_list(order_only) output_dir = os.path.dirname(output) if output_dir != '' and not os.path.isdir(output_dir): os.makedirs(output_dir) dollar_in = ' '.join(inputs) subst = lambda text: text.replace('$in', dollar_in).replace('$out', output) deps = ' '.join(inputs + implicit) if order_only: deps += ' | ' deps += ' '.join(order_only) self.output.write('%s: %s\n' % (output, deps)) r = self.rules[rule] command = subst(r['command']) if r['description']: desc = subst(r['description']) self.output.write('\t@echo %s\n\t$(Verb) %s\n' % (desc, command)) else: self.output.write('\t%s\n' % command) if r['depfile']: depfile = subst(r['depfile']) self.output.write('-include '+depfile+'\n') self.output.write('\n') self.all_targets.append(output) if r['generator']: self.distclean_files.append(output) if r['depfile']: self.distclean_files.append(depfile) else: self.clean_files.append(output) if r['depfile']: self.distclean_files.append(depfile) def _as_list(self, input): if isinstance(input, list): return input return [input] def default(self, paths): self.default_targets += self._as_list(paths) def finish(self): self.output.write('all:: %s\n\n' % ' '.join(self.default_targets or self.all_targets)) self.output.write('clean: \n\trm -f %s\n\n' % ' '.join(self.clean_files)) self.output.write('distclean: clean\n\trm -f %s\n' % ' '.join(self.distclean_files)) class Ninja(ninja_syntax.Writer): def __init__(self): ninja_syntax.Writer.__init__(self, open(self.output_filename(), 'w')) def output_filename(self): return 'build.ninja' def finish(self): pass def from_name(name): if name == 'make': return Make() if name == 'ninja': return Ninja() raise LookupError('unknown generator: %s; supported generators are make and ninja' % name) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/build/ninja_syntax.py������������������������������������������������������0000664�0000000�0000000�00000007335�13251554454�0020537�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python """Python module for generating .ninja files. Note that this is emphatically not a required piece of Ninja; it's just a helpful utility for build-file-generation systems that already use Python. """ import textwrap import re class Writer(object): def __init__(self, output, width=78): self.output = output self.width = width def newline(self): self.output.write('\n') def comment(self, text): for line in textwrap.wrap(text, self.width - 2): self.output.write('# ' + line + '\n') def variable(self, key, value, indent=0): if value is None: return if isinstance(value, list): value = ' '.join(value) self._line('%s = %s' % (key, value), indent) def rule(self, name, command, description=None, depfile=None, generator=False): self._line('rule %s' % name) self.variable('command', escape(command), indent=1) if description: self.variable('description', description, indent=1) if depfile: self.variable('depfile', depfile, indent=1) if generator: self.variable('generator', '1', indent=1) def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None): outputs = self._as_list(outputs) all_inputs = self._as_list(inputs)[:] if implicit: all_inputs.append('|') all_inputs.extend(self._as_list(implicit)) if order_only: all_inputs.append('||') all_inputs.extend(self._as_list(order_only)) self._line('build %s: %s %s' % (' '.join(outputs), rule, ' '.join(all_inputs))) if variables: for key, val in variables: self.variable(key, val, indent=1) return outputs def include(self, path): self._line('include %s' % path) def subninja(self, path): self._line('subninja %s' % path) def default(self, paths): self._line('default %s' % ' '.join(self._as_list(paths))) def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width constraint. available_space = self.width - len(leading_space) - len(' $') space = text.rfind(' ', 0, available_space) if space < 0: # No such space; just use the first space we can find. space = text.find(' ', available_space) if space < 0: # Give up on breaking. break self.output.write(leading_space + text[0:space] + ' $\n') text = text[space+1:] # Subsequent lines are continuations, so indent them. leading_space = ' ' * (indent+2) self.output.write(leading_space + text + '\n') def _as_list(self, input): if input is None: return [] if isinstance(input, list): return input return [input] def escape(string): """Escape a string such that Makefile and shell variables are correctly escaped for use in a Ninja file. """ assert '\n' not in string, 'Ninja syntax does not allow newlines' # We only have one special metacharacter: '$'. # We should leave $in and $out untouched. # Just look for makefile/shell style substitutions return re.sub(r'(\$[{(][a-z_]+[})])', r'$\1', string, flags=re.IGNORECASE) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/check_external_calls.sh����������������������������������������������������0000775�0000000�0000000�00000001271�13251554454�0021046�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh FILE=$1 if [ ! -f $FILE ]; then echo "ERROR: Not a file: $FILE" exit 3 fi ret=0 if [ "x$LLVM_CONFIG" = "x" ]; then LLVM_CONFIG=llvm-config echo 'WARNING: $LLVM_CONFIG not set, falling back to $PATH llvm-config' ret=2 fi BIN_DIR=$($LLVM_CONFIG --bindir) DIS="$BIN_DIR/llvm-dis" if [ ! -x $DIS ]; then echo "ERROR: Disassembler '$DIS' is not executable" exit 3 fi TMP_FILE=$(mktemp) # Check for calls. Calls to llvm intrinsics are OK $DIS < $FILE | grep ' call ' | grep -v '@llvm' > "$TMP_FILE" COUNT=$(wc -l < "$TMP_FILE") if [ "$COUNT" -ne "0" ]; then echo "ERROR: $COUNT unresolved calls detected in $FILE" cat $TMP_FILE ret=1 else echo "File $FILE is OK" fi exit $ret ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/compile-test.sh������������������������������������������������������������0000775�0000000�0000000�00000000340�13251554454�0017312�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh clang -target nvptx--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers -Dcl_khr_fp64 "$@" ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/configure.py���������������������������������������������������������������0000775�0000000�0000000�00000030437�13251554454�0016716�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/python from __future__ import print_function def c_compiler_rule(b, name, description, compiler, flags): command = "%s -MMD -MF $out.d %s -c -o $out $in" % (compiler, flags) b.rule(name, command, description + " $out", depfile="$out.d") version_major = 0; version_minor = 2; version_patch = 0; from optparse import OptionParser import os import string from subprocess import * import sys srcdir = os.path.dirname(sys.argv[0]) sys.path.insert(0, os.path.join(srcdir, 'build')) import metabuild p = OptionParser() p.add_option('--with-llvm-config', metavar='PATH', help='use given llvm-config script') p.add_option('--with-cxx-compiler', metavar='PATH', help='use given C++ compiler') p.add_option('--prefix', metavar='PATH', help='install to given prefix') p.add_option('--libexecdir', metavar='PATH', help='install *.bc to given dir') p.add_option('--includedir', metavar='PATH', help='install include files to given dir') p.add_option('--pkgconfigdir', metavar='PATH', help='install clc.pc to given dir') p.add_option('-g', metavar='GENERATOR', default='make', help='use given generator (default: make)') p.add_option('--enable-runtime-subnormal', action="store_true", default=False, help='Allow runtimes to choose subnormal support') (options, args) = p.parse_args() llvm_config_exe = options.with_llvm_config or "llvm-config" prefix = options.prefix if not prefix: prefix = '/usr/local' libexecdir = options.libexecdir if not libexecdir: libexecdir = os.path.join(prefix, 'lib/clc') includedir = options.includedir if not includedir: includedir = os.path.join(prefix, 'include') pkgconfigdir = options.pkgconfigdir if not pkgconfigdir: pkgconfigdir = os.path.join(prefix, 'share/pkgconfig') def llvm_config(args): try: # Universal newlines translate different newline formats to '\n' # it also force the input to be string instead of bytes in python 3 proc = Popen([llvm_config_exe] + args, stdout=PIPE, universal_newlines=True) return proc.communicate()[0].rstrip().replace('\n', ' ') except OSError: print("Error executing llvm-config.") print("Please ensure that llvm-config is in your $PATH, or use --with-llvm-config.") sys.exit(1) llvm_version = llvm_config(['--version']).replace('svn', '').split('.') llvm_int_version = int(llvm_version[0]) * 100 + int(llvm_version[1]) * 10 llvm_string_version = llvm_version[0] + '.' + llvm_version[1] if llvm_int_version < 390: print("libclc requires LLVM >= 3.9") sys.exit(1) llvm_system_libs = llvm_config(['--system-libs']) llvm_bindir = llvm_config(['--bindir']) llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \ llvm_system_libs + ' ' + \ llvm_config(['--ldflags']) llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti ' + \ '-DHAVE_LLVM=0x{:0=4}'.format(llvm_int_version) llvm_libdir = llvm_config(['--libdir']) llvm_clang = os.path.join(llvm_bindir, 'clang') llvm_link = os.path.join(llvm_bindir, 'llvm-link') llvm_opt = os.path.join(llvm_bindir, 'opt') cxx_compiler = options.with_cxx_compiler if not cxx_compiler: cxx_compiler = os.path.join(llvm_bindir, 'clang++') available_targets = { 'r600--' : { 'devices' : [{'gpu' : 'cedar', 'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper']}, {'gpu' : 'cypress', 'aliases' : ['hemlock'] }, {'gpu' : 'barts', 'aliases' : ['turks', 'caicos'] }, {'gpu' : 'cayman', 'aliases' : ['aruba']} ]}, 'amdgcn--': { 'devices' : [{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 'hainan', 'bonaire', 'kabini', 'kaveri', 'hawaii', 'mullins', 'tonga', 'iceland', 'carrizo', 'fiji', 'stoney', 'polaris10', 'polaris11', 'gfx900']} ]}, 'amdgcn--amdhsa': { 'devices' : [{'gpu' : '', 'aliases' : ['bonaire', 'kabini', 'kaveri', 'hawaii', 'mullins', 'tonga', 'iceland', 'carrizo', 'fiji', 'stoney', 'polaris10', 'polaris11', 'gfx900']} ]}, 'nvptx--' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]}, 'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]}, 'nvptx--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]}, 'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []} ]}, } default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--', 'amdgcn--amdhsa'] #mesa is using amdgcn-mesa-mesa3d since llvm-4.0 if llvm_int_version > 390: available_targets['amdgcn-mesa-mesa3d'] = available_targets['amdgcn--'] default_targets.append('amdgcn-mesa-mesa3d') targets = args if not targets: targets = default_targets b = metabuild.from_name(options.g) b.rule("LLVM_AS", "%s -o $out $in" % os.path.join(llvm_bindir, "llvm-as"), 'LLVM-AS $out') b.rule("LLVM_LINK", command = llvm_link + " -o $out $in", description = 'LLVM-LINK $out') b.rule("OPT", command = llvm_opt + " -O3 -o $out $in", description = 'OPT $out') c_compiler_rule(b, "LLVM_TOOL_CXX", 'CXX', cxx_compiler, llvm_cxxflags) b.rule("LLVM_TOOL_LINK", cxx_compiler + " -o $out $in %s" % llvm_core_libs + " -Wl,-rpath %s" % llvm_libdir, 'LINK $out') prepare_builtins = os.path.join('utils', 'prepare-builtins') b.build(os.path.join('utils', 'prepare-builtins.o'), "LLVM_TOOL_CXX", os.path.join(srcdir, 'utils', 'prepare-builtins.cpp')) b.build(prepare_builtins, "LLVM_TOOL_LINK", os.path.join('utils', 'prepare-builtins.o')) b.rule("PREPARE_BUILTINS", "%s -o $out $in" % prepare_builtins, 'PREPARE-BUILTINS $out') b.rule("PYTHON_GEN", "python < $in > $out", "PYTHON_GEN $out") b.build('generic/lib/convert.cl', "PYTHON_GEN", ['generic/lib/gen_convert.py']) manifest_deps = set([sys.argv[0], os.path.join(srcdir, 'build', 'metabuild.py'), os.path.join(srcdir, 'build', 'ninja_syntax.py')]) install_files_bc = [] install_deps = [] # Create rules for subnormal helper objects for src in ['subnormal_disable.ll', 'subnormal_use_default.ll']: obj_name = src[:-2] + 'bc' obj = os.path.join('generic--', 'lib', obj_name) src_file = os.path.join('generic', 'lib', src) b.build(obj, 'LLVM_AS', src_file) b.default(obj) install_files_bc.append((obj, obj)) install_deps.append(obj) # Create libclc.pc clc = open('libclc.pc', 'w') clc.write('includedir=%(inc)s\nlibexecdir=%(lib)s\n\nName: libclc\nDescription: Library requirements of the OpenCL C programming language\nVersion: %(maj)s.%(min)s.%(pat)s\nCflags: -I${includedir}\nLibs: -L${libexecdir}' % {'inc': includedir, 'lib': libexecdir, 'maj': version_major, 'min': version_minor, 'pat': version_patch}) clc.close() for target in targets: (t_arch, t_vendor, t_os) = target.split('-') archs = [t_arch] if t_arch == 'nvptx' or t_arch == 'nvptx64': archs.append('ptx') archs.append('generic') subdirs = [] for arch in archs: subdirs.append("%s-%s-%s" % (arch, t_vendor, t_os)) subdirs.append("%s-%s" % (arch, t_os)) if t_os == 'mesa3d': subdirs.append('amdgcn-amdhsa') subdirs.append(arch) if arch == 'amdgcn' or arch == 'r600': subdirs.append('amdgpu') incdirs = filter(os.path.isdir, [os.path.join(srcdir, subdir, 'include') for subdir in subdirs]) libdirs = filter(lambda d: os.path.isfile(os.path.join(d, 'SOURCES')) or os.path.isfile(os.path.join(d, 'SOURCES_' + llvm_string_version)), [os.path.join(srcdir, subdir, 'lib') for subdir in subdirs]) # The above are iterables in python3 but we might use them multiple times # if more then one device is supported. incdirs = list(incdirs) libdirs = list(libdirs) clang_cl_includes = ' '.join(["-I%s" % incdir for incdir in incdirs]) for device in available_targets[target]['devices']: # The rule for building a .bc file for the specified architecture using clang. clang_bc_flags = "-target %s -I`dirname $in` %s " \ "-fno-builtin " \ "-D__CLC_INTERNAL " \ "-emit-llvm" % (target, clang_cl_includes) if device['gpu'] != '': clang_bc_flags += ' -mcpu=' + device['gpu'] clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu'] c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags) objects = [] sources_seen = set() compats = [] if device['gpu'] == '': full_target_name = target obj_suffix = '' else: full_target_name = device['gpu'] + '-' + target obj_suffix = '.' + device['gpu'] for libdir in libdirs: subdir_list_file = os.path.join(libdir, 'SOURCES') if os.path.exists(subdir_list_file): manifest_deps.add(subdir_list_file) override_list_file = os.path.join(libdir, 'OVERRIDES') compat_list_file = os.path.join(libdir, 'SOURCES_' + llvm_string_version) compat_list_override = os.path.join(libdir, 'OVERRIDES_' + llvm_string_version) # Build compat list if os.path.exists(compat_list_file): manifest_deps.add(compat_list_file) for compat in open(compat_list_file).readlines(): compat = compat.rstrip() compats.append(compat) # Add target compat overrides if os.path.exists(compat_list_override): for override in open(compat_list_override).readlines(): override = override.rstrip() sources_seen.add(override) # Add target overrides if os.path.exists(override_list_file): for override in open(override_list_file).readlines(): override = override.rstrip() sources_seen.add(override) files = open(subdir_list_file).readlines() if os.path.exists(subdir_list_file) else [] for src in files + compats: src = src.rstrip() if src not in sources_seen: sources_seen.add(src) obj = os.path.join(target, 'lib', src + obj_suffix + '.bc') objects.append(obj) src_path = libdir src_file = os.path.join(src_path, src) ext = os.path.splitext(src)[1] if ext == '.ll': b.build(obj, 'LLVM_AS', src_file) else: b.build(obj, clang_bc_rule, src_file) obj = os.path.join('generic--', 'lib', 'subnormal_use_default.bc') if not options.enable_runtime_subnormal: objects.append(obj) builtins_link_bc = os.path.join(target, 'lib', 'builtins.link' + obj_suffix + '.bc') builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt' + obj_suffix + '.bc') builtins_bc = os.path.join('built_libs', full_target_name + '.bc') b.build(builtins_link_bc, "LLVM_LINK", objects) b.build(builtins_opt_bc, "OPT", builtins_link_bc) b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins) install_files_bc.append((builtins_bc, builtins_bc)) install_deps.append(builtins_bc) for alias in device['aliases']: # Ninja cannot have multiple rules with same name so append suffix ruleName = "CREATE_ALIAS_{0}_for_{1}".format(alias, device['gpu']) b.rule(ruleName, "ln -fs %s $out" % os.path.basename(builtins_bc) ,"CREATE-ALIAS $out") alias_file = os.path.join('built_libs', alias + '-' + target + '.bc') b.build(alias_file, ruleName, builtins_bc) install_files_bc.append((alias_file, alias_file)) install_deps.append(alias_file) b.default(builtins_bc) install_cmd = ' && '.join(['mkdir -p ${DESTDIR}/%(dst)s && cp -r %(src)s ${DESTDIR}/%(dst)s' % {'src': file, 'dst': libexecdir} for (file, dest) in install_files_bc]) install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r %(srcdir)s/generic/include/clc ${DESTDIR}/%(dst)s' % {'old': install_cmd, 'dst': includedir, 'srcdir': srcdir}]) install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r libclc.pc ${DESTDIR}/%(dst)s' % {'old': install_cmd, 'dst': pkgconfigdir}]) b.rule('install', command = install_cmd, description = 'INSTALL') b.build('install', 'install', install_deps) b.rule("configure", command = ' '.join(sys.argv), description = 'CONFIGURE', generator = True) b.build(b.output_filename(), 'configure', list(manifest_deps)) b.finish() ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/�������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015765�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/�����������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017410�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/�������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020151�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/as_type.h����������������������������������������������0000664�0000000�0000000�00000005570�13251554454�0021775�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define as_char(x) __builtin_astype(x, char) #define as_uchar(x) __builtin_astype(x, uchar) #define as_short(x) __builtin_astype(x, short) #define as_ushort(x) __builtin_astype(x, ushort) #define as_int(x) __builtin_astype(x, int) #define as_uint(x) __builtin_astype(x, uint) #define as_long(x) __builtin_astype(x, long) #define as_ulong(x) __builtin_astype(x, ulong) #define as_float(x) __builtin_astype(x, float) #define as_char2(x) __builtin_astype(x, char2) #define as_uchar2(x) __builtin_astype(x, uchar2) #define as_short2(x) __builtin_astype(x, short2) #define as_ushort2(x) __builtin_astype(x, ushort2) #define as_int2(x) __builtin_astype(x, int2) #define as_uint2(x) __builtin_astype(x, uint2) #define as_long2(x) __builtin_astype(x, long2) #define as_ulong2(x) __builtin_astype(x, ulong2) #define as_float2(x) __builtin_astype(x, float2) #define as_char3(x) __builtin_astype(x, char3) #define as_uchar3(x) __builtin_astype(x, uchar3) #define as_short3(x) __builtin_astype(x, short3) #define as_ushort3(x) __builtin_astype(x, ushort3) #define as_int3(x) __builtin_astype(x, int3) #define as_uint3(x) __builtin_astype(x, uint3) #define as_long3(x) __builtin_astype(x, long3) #define as_ulong3(x) __builtin_astype(x, ulong3) #define as_float3(x) __builtin_astype(x, float3) #define as_char4(x) __builtin_astype(x, char4) #define as_uchar4(x) __builtin_astype(x, uchar4) #define as_short4(x) __builtin_astype(x, short4) #define as_ushort4(x) __builtin_astype(x, ushort4) #define as_int4(x) __builtin_astype(x, int4) #define as_uint4(x) __builtin_astype(x, uint4) #define as_long4(x) __builtin_astype(x, long4) #define as_ulong4(x) __builtin_astype(x, ulong4) #define as_float4(x) __builtin_astype(x, float4) #define as_char8(x) __builtin_astype(x, char8) #define as_uchar8(x) __builtin_astype(x, uchar8) #define as_short8(x) __builtin_astype(x, short8) #define as_ushort8(x) __builtin_astype(x, ushort8) #define as_int8(x) __builtin_astype(x, int8) #define as_uint8(x) __builtin_astype(x, uint8) #define as_long8(x) __builtin_astype(x, long8) #define as_ulong8(x) __builtin_astype(x, ulong8) #define as_float8(x) __builtin_astype(x, float8) #define as_char16(x) __builtin_astype(x, char16) #define as_uchar16(x) __builtin_astype(x, uchar16) #define as_short16(x) __builtin_astype(x, short16) #define as_ushort16(x) __builtin_astype(x, ushort16) #define as_int16(x) __builtin_astype(x, int16) #define as_uint16(x) __builtin_astype(x, uint16) #define as_long16(x) __builtin_astype(x, long16) #define as_ulong16(x) __builtin_astype(x, ulong16) #define as_float16(x) __builtin_astype(x, float16) #ifdef cl_khr_fp64 #define as_double(x) __builtin_astype(x, double) #define as_double2(x) __builtin_astype(x, double2) #define as_double3(x) __builtin_astype(x, double3) #define as_double4(x) __builtin_astype(x, double4) #define as_double8(x) __builtin_astype(x, double8) #define as_double16(x) __builtin_astype(x, double16) #endif ����������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/�������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021266�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/async_work_group_copy.h��������������������������0000664�0000000�0000000�00000000727�13251554454�0026072�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_DST_ADDR_SPACE local #define __CLC_SRC_ADDR_SPACE global #define __CLC_BODY #include #undef __CLC_DST_ADDR_SPACE #undef __CLC_SRC_ADDR_SPACE #undef __CLC_BODY #define __CLC_DST_ADDR_SPACE global #define __CLC_SRC_ADDR_SPACE local #define __CLC_BODY #include #undef __CLC_DST_ADDR_SPACE #undef __CLC_SRC_ADDR_SPACE #undef __CLC_BODY �����������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/async_work_group_copy.inc������������������������0000664�0000000�0000000�00000000274�13251554454�0026411�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL event_t async_work_group_copy( __CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst, const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src, size_t num_gentypes, event_t event); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/async_work_group_strided_copy.h������������������0000664�0000000�0000000�00000000747�13251554454�0027612�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_DST_ADDR_SPACE local #define __CLC_SRC_ADDR_SPACE global #define __CLC_BODY #include #undef __CLC_DST_ADDR_SPACE #undef __CLC_SRC_ADDR_SPACE #undef __CLC_BODY #define __CLC_DST_ADDR_SPACE global #define __CLC_SRC_ADDR_SPACE local #define __CLC_BODY #include #undef __CLC_DST_ADDR_SPACE #undef __CLC_SRC_ADDR_SPACE #undef __CLC_BODY �������������������������libclc-0.2.0+git20180312/generic/include/clc/async/async_work_group_strided_copy.inc����������������0000664�0000000�0000000�00000000325�13251554454�0030124�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL event_t async_work_group_strided_copy( __CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst, const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src, size_t num_gentypes, size_t stride, event_t event); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/gentype.inc��������������������������������������0000664�0000000�0000000�00000007054�13251554454�0023442�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define __CLC_GENTYPE char #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE char2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE char4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE char8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE char16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uchar #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uchar2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uchar4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uchar8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uchar16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE short #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE short2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE short4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE short8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE short16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ushort #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ushort2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ushort4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ushort8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ushort16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE float #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE float2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE float4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE float8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE float16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE long #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE long2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE long4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE long8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE long16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ulong #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ulong2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ulong4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ulong8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE ulong16 #include __CLC_BODY #undef __CLC_GENTYPE #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define __CLC_GENTYPE double #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE double2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE double4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE double8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE double16 #include __CLC_BODY #undef __CLC_GENTYPE #endif #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/prefetch.h���������������������������������������0000664�0000000�0000000�00000000137�13251554454�0023240�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/prefetch.inc�������������������������������������0000664�0000000�0000000�00000000133�13251554454�0023556�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL void prefetch(const global __CLC_GENTYPE *p, size_t num_gentypes); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/async/wait_group_events.h������������������������������0000664�0000000�0000000�00000000075�13251554454�0025205�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������void wait_group_events(int num_events, event_t *event_list); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021425�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_add.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023656�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_add #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_and.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023670�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_and #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_cmpxchg.h��������������������������������0000664�0000000�0000000�00000000775�13251554454�0024574�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_cmpxchg #define __CLC_DECLARE_ATOMIC_3_ARG(ADDRSPACE, TYPE) \ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE, TYPE); #define __CLC_DECLARE_ATOMIC_ADDRSPACE_3_ARG(TYPE) \ __CLC_DECLARE_ATOMIC_3_ARG(global, TYPE) \ __CLC_DECLARE_ATOMIC_3_ARG(local, TYPE) __CLC_DECLARE_ATOMIC_ADDRSPACE_3_ARG(int) __CLC_DECLARE_ATOMIC_ADDRSPACE_3_ARG(uint) #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC_3_ARG #undef __CLC_DECLARE_ATOMIC_ADDRESS_SPACE_3_ARG ���libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_dec.h������������������������������������0000664�0000000�0000000�00000000047�13251554454�0023666�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define atomic_dec(p) atomic_sub(p, 1) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_decl.inc���������������������������������0000664�0000000�0000000�00000000504�13251554454�0024362�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define __CLC_DECLARE_ATOMIC(ADDRSPACE, TYPE) \ _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE); #define __CLC_DECLARE_ATOMIC_ADDRSPACE(TYPE) \ __CLC_DECLARE_ATOMIC(global, TYPE) \ __CLC_DECLARE_ATOMIC(local, TYPE) __CLC_DECLARE_ATOMIC_ADDRSPACE(int) __CLC_DECLARE_ATOMIC_ADDRSPACE(uint) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_inc.h������������������������������������0000664�0000000�0000000�00000000047�13251554454�0023704�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define atomic_inc(p) atomic_add(p, 1) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_max.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023713�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_max #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_min.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023711�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_min #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_or.h�������������������������������������0000664�0000000�0000000�00000000237�13251554454�0023554�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_or #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_sub.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023717�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_sub #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_xchg.h�����������������������������������0000664�0000000�0000000�00000000310�13251554454�0024055�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_xchg #include __CLC_DECLARE_ATOMIC_ADDRSPACE(float); #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/atomic/atomic_xor.h������������������������������������0000664�0000000�0000000�00000000240�13251554454�0023736�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION atomic_xor #include #undef __CLC_FUNCTION #undef __CLC_DECLARE_ATOMIC #undef __CLC_DECLARE_ATOMIC_ADDRSPACE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/����������������������0000775�0000000�0000000�00000000000�13251554454�0026463�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_add.h������������0000664�0000000�0000000�00000000227�13251554454�0030405�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_add(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_add(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h��������0000664�0000000�0000000�00000000272�13251554454�0031306�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(global int *p, int cmp, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(global unsigned int *p, unsigned int cmp, unsigned int val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h������������0000664�0000000�0000000�00000000174�13251554454�0030411�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_dec(global int *p); _CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(global unsigned int *p); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h������������0000664�0000000�0000000�00000000174�13251554454�0030427�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_inc(global int *p); _CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(global unsigned int *p); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_sub.h������������0000664�0000000�0000000�00000000227�13251554454�0030446�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_sub(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_base_atomics/atom_xchg.h�����������0000664�0000000�0000000�00000000231�13251554454�0030601�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_xchg(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_xchg(global unsigned int *p, unsigned int val); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/������������������0000775�0000000�0000000�00000000000�13251554454�0027351�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_and.h��������0000664�0000000�0000000�00000000227�13251554454�0031305�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_and(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_and(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_max.h��������0000664�0000000�0000000�00000000227�13251554454�0031330�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_max(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_max(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_min.h��������0000664�0000000�0000000�00000000227�13251554454�0031326�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_min(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_min(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_or.h���������0000664�0000000�0000000�00000000225�13251554454�0031161�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_or(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_or(global unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_global_int32_extended_atomics/atom_xor.h��������0000664�0000000�0000000�00000000227�13251554454�0031353�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_xor(global int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_xor(global unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/�����������������������������0000775�0000000�0000000�00000000000�13251554454�0025150�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_add.h�������������������0000664�0000000�0000000�00000000534�13251554454�0027073�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_add(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_add(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_add(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_cmpxchg.h���������������0000664�0000000�0000000�00000000646�13251554454�0030000�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile global long *p, long cmp, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_cmpxchg(volatile global unsigned long *p, unsigned long cmp, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_cmpxchg(volatile local long *p, long cmp, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_cmpxchg(volatile local unsigned long *p, unsigned long cmp, unsigned long val); ������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_dec.h�������������������0000664�0000000�0000000�00000000442�13251554454�0027074�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_dec(volatile global long *p); _CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile global unsigned long *p); _CLC_OVERLOAD _CLC_DECL long atom_dec(volatile local long *p); _CLC_OVERLOAD _CLC_DECL unsigned long atom_dec(volatile local unsigned long *p); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_inc.h�������������������0000664�0000000�0000000�00000000442�13251554454�0027112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_inc(volatile global long *p); _CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile global unsigned long *p); _CLC_OVERLOAD _CLC_DECL long atom_inc(volatile local long *p); _CLC_OVERLOAD _CLC_DECL unsigned long atom_inc(volatile local unsigned long *p); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_sub.h�������������������0000664�0000000�0000000�00000000534�13251554454�0027134�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_sub(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_sub(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_sub(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_base_atomics/atom_xchg.h������������������0000664�0000000�0000000�00000000540�13251554454�0027271�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_xchg(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_xchg(volatile local unsigned long *p, unsigned long val); ����������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/�������������������������0000775�0000000�0000000�00000000000�13251554454�0026036�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/atom_and.h���������������0000664�0000000�0000000�00000000534�13251554454�0027773�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_and(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_and(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_and(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_and(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/atom_max.h���������������0000664�0000000�0000000�00000000534�13251554454�0030016�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_max(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_max(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_max(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_max(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/atom_min.h���������������0000664�0000000�0000000�00000000534�13251554454�0030014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_min(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_min(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_min(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_min(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/atom_or.h����������������0000664�0000000�0000000�00000000530�13251554454�0027645�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_or(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_or(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_or(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_or(volatile local unsigned long *p, unsigned long val); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_int64_extended_atomics/atom_xor.h���������������0000664�0000000�0000000�00000000534�13251554454�0030041�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL long atom_xor(volatile global long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_xor(volatile global unsigned long *p, unsigned long val); _CLC_OVERLOAD _CLC_DECL long atom_xor(volatile local long *p, long val); _CLC_OVERLOAD _CLC_DECL unsigned long atom_xor(volatile local unsigned long *p, unsigned long val); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/�����������������������0000775�0000000�0000000�00000000000�13251554454�0026315�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h�������������0000664�0000000�0000000�00000000225�13251554454�0030235�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_add(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_add(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h���������0000664�0000000�0000000�00000000270�13251554454�0031136�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(local int *p, int cmp, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(local unsigned int *p, unsigned int cmp, unsigned int val); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h�������������0000664�0000000�0000000�00000000172�13251554454�0030241�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_dec(local int *p); _CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(local unsigned int *p); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h�������������0000664�0000000�0000000�00000000172�13251554454�0030257�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_inc(local int *p); _CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(local unsigned int *p); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h�������������0000664�0000000�0000000�00000000225�13251554454�0030276�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_sub(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_base_atomics/atom_xchg.h������������0000664�0000000�0000000�00000000227�13251554454�0030440�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_xchg(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_xchg(local unsigned int *p, unsigned int val); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/�������������������0000775�0000000�0000000�00000000000�13251554454�0027203�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_and.h���������0000664�0000000�0000000�00000000225�13251554454�0031135�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_and(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_and(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_max.h���������0000664�0000000�0000000�00000000225�13251554454�0031160�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_max(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_max(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_min.h���������0000664�0000000�0000000�00000000225�13251554454�0031156�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_min(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_min(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_or.h����������0000664�0000000�0000000�00000000223�13251554454�0031011�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_or(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_or(local unsigned int *p, unsigned int val); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/cl_khr_local_int32_extended_atomics/atom_xor.h���������0000664�0000000�0000000�00000000225�13251554454�0031203�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int atom_xor(local int *p, int val); _CLC_OVERLOAD _CLC_DECL unsigned int atom_xor(local unsigned int *p, unsigned int val); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/clc.h��������������������������������������������������0000664�0000000�0000000�00000022252�13251554454�0021066�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef cl_clang_storage_class_specifiers #error Implementation requires cl_clang_storage_class_specifiers extension! #endif #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16 : enable #endif /* Function Attributes */ #include /* 6.1 Supported Data Types */ #include /* 6.2.3 Explicit Conversions */ #include /* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */ #include /* 6.9 Preprocessor Directives and Macros */ #include /* 6.11.1 Work-Item Functions */ #include #include #include #include #include #include #include #include /* 6.11.2 Math Functions */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* 6.11.2.1 Floating-point macros */ #include /* 6.11.3 Integer Functions */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* 6.11.3 Integer Definitions */ #include /* 6.11.2 and 6.11.3 Shared Integer/Math Functions */ #include #include #include #include #include /* 6.11.4 Common Functions */ #include #include #include #include #include #include /* 6.11.5 Geometric Functions */ #include #include #include #include #include #include #include #include /* 6.11.6 Relational Functions */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* 6.11.8 Synchronization Functions */ #include #include /* 6.11.9 Explicit Memory Fence Functions */ #include /* 6.11.10 Async Copy and Prefetch Functions */ #include #include #include #include /* 6.11.11 Atomic Functions */ #include #include #include #include #include #include #include #include #include #include #include /* cl_khr_global_int32_base_atomics Extension Functions */ #include #include #include #include #include #include /* cl_khr_global_int32_extended_atomics Extension Functions */ #include #include #include #include #include /* cl_khr_local_int32_base_atomics Extension Functions */ #include #include #include #include #include #include /* cl_khr_local_int32_extended_atomics Extension Functions */ #include #include #include #include #include /* cl_khr_int64_base_atomics Extension Functions */ #ifdef cl_khr_int64_base_atomics #include #include #include #include #include #include #endif /* cl_khr_int64_extended_atomics Extension Functions */ #ifdef cl_khr_int64_base_atomics #include #include #include #include #include #endif /* 6.12.12 Miscellaneous Vector Functions */ #include #include /* 6.11.13 Image Read and Write Functions */ #include #include #pragma OPENCL EXTENSION all : disable ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/clcfunc.h����������������������������������������������0000664�0000000�0000000�00000000260�13251554454�0021735�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_OVERLOAD __attribute__((overloadable)) #define _CLC_DECL #define _CLC_DEF __attribute__((always_inline)) #define _CLC_INLINE __attribute__((always_inline)) inline ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/clcmacros.h��������������������������������������������0000664�0000000�0000000�00000001031�13251554454�0022263�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* 6.9 Preprocessor Directives and Macros * Some of these are handled by clang or passed by clover */ #if __OPENCL_VERSION__ >= 110 #define CLC_VERSION_1_0 100 #define CLC_VERSION_1_1 110 #endif #if __OPENCL_VERSION__ >= 120 #define CLC_VERSION_1_2 120 #endif #define NULL ((void*)0) #define __kernel_exec(X, typen) __kernel \ __attribute__((work_group_size_hint(X, 1, 1))) \ __attribute__((vec_type_hint(typen))) #define kernel_exec(X, typen) __kernel_exec(X, typen) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/clctypes.h���������������������������������������������0000664�0000000�0000000�00000007417�13251554454�0022161�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* 6.1.1 Built-in Scalar Data Types */ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; typedef __SIZE_TYPE__ size_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; #define __stdint_join3(a,b,c) a ## b ## c #define __intn_t(n) __stdint_join3(__INT, n, _TYPE__) #define __uintn_t(n) __stdint_join3(unsigned __INT, n, _TYPE__) typedef __intn_t(__INTPTR_WIDTH__) intptr_t; typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t; #undef __uintn_t #undef __intn_t #undef __stdint_join3 /* 6.1.2 Built-in Vector Data Types */ typedef __attribute__((ext_vector_type(2))) char char2; typedef __attribute__((ext_vector_type(3))) char char3; typedef __attribute__((ext_vector_type(4))) char char4; typedef __attribute__((ext_vector_type(8))) char char8; typedef __attribute__((ext_vector_type(16))) char char16; typedef __attribute__((ext_vector_type(2))) uchar uchar2; typedef __attribute__((ext_vector_type(3))) uchar uchar3; typedef __attribute__((ext_vector_type(4))) uchar uchar4; typedef __attribute__((ext_vector_type(8))) uchar uchar8; typedef __attribute__((ext_vector_type(16))) uchar uchar16; typedef __attribute__((ext_vector_type(2))) short short2; typedef __attribute__((ext_vector_type(3))) short short3; typedef __attribute__((ext_vector_type(4))) short short4; typedef __attribute__((ext_vector_type(8))) short short8; typedef __attribute__((ext_vector_type(16))) short short16; typedef __attribute__((ext_vector_type(2))) ushort ushort2; typedef __attribute__((ext_vector_type(3))) ushort ushort3; typedef __attribute__((ext_vector_type(4))) ushort ushort4; typedef __attribute__((ext_vector_type(8))) ushort ushort8; typedef __attribute__((ext_vector_type(16))) ushort ushort16; typedef __attribute__((ext_vector_type(2))) int int2; typedef __attribute__((ext_vector_type(3))) int int3; typedef __attribute__((ext_vector_type(4))) int int4; typedef __attribute__((ext_vector_type(8))) int int8; typedef __attribute__((ext_vector_type(16))) int int16; typedef __attribute__((ext_vector_type(2))) uint uint2; typedef __attribute__((ext_vector_type(3))) uint uint3; typedef __attribute__((ext_vector_type(4))) uint uint4; typedef __attribute__((ext_vector_type(8))) uint uint8; typedef __attribute__((ext_vector_type(16))) uint uint16; typedef __attribute__((ext_vector_type(2))) long long2; typedef __attribute__((ext_vector_type(3))) long long3; typedef __attribute__((ext_vector_type(4))) long long4; typedef __attribute__((ext_vector_type(8))) long long8; typedef __attribute__((ext_vector_type(16))) long long16; typedef __attribute__((ext_vector_type(2))) ulong ulong2; typedef __attribute__((ext_vector_type(3))) ulong ulong3; typedef __attribute__((ext_vector_type(4))) ulong ulong4; typedef __attribute__((ext_vector_type(8))) ulong ulong8; typedef __attribute__((ext_vector_type(16))) ulong ulong16; typedef __attribute__((ext_vector_type(2))) float float2; typedef __attribute__((ext_vector_type(3))) float float3; typedef __attribute__((ext_vector_type(4))) float float4; typedef __attribute__((ext_vector_type(8))) float float8; typedef __attribute__((ext_vector_type(16))) float float16; /* 9.3 Double Precision Floating-Point */ #ifdef cl_khr_fp64 typedef __attribute__((ext_vector_type(2))) double double2; typedef __attribute__((ext_vector_type(3))) double double3; typedef __attribute__((ext_vector_type(4))) double double4; typedef __attribute__((ext_vector_type(8))) double double8; typedef __attribute__((ext_vector_type(16))) double double16; #endif #ifdef cl_khr_fp16 typedef __attribute__((ext_vector_type(2))) half half2; typedef __attribute__((ext_vector_type(3))) half half3; typedef __attribute__((ext_vector_type(4))) half half4; typedef __attribute__((ext_vector_type(8))) half half8; typedef __attribute__((ext_vector_type(16))) half half16; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021441�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/degrees.h���������������������������������������0000664�0000000�0000000�00000002321�13251554454�0023226�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/degrees.inc�������������������������������������0000664�0000000�0000000�00000002263�13251554454�0023555�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE degrees(__CLC_GENTYPE x); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/mix.h�������������������������������������������0000664�0000000�0000000�00000000110�13251554454�0022377�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/mix.inc�����������������������������������������0000664�0000000�0000000�00000000340�13251554454�0022726�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c); #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_SCALAR_GENTYPE c); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/radians.h���������������������������������������0000664�0000000�0000000�00000002321�13251554454�0023231�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/radians.inc�������������������������������������0000664�0000000�0000000�00000002263�13251554454�0023560�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE radians(__CLC_GENTYPE x); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/sign.h������������������������������������������0000664�0000000�0000000�00000000221�13251554454�0022545�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION sign #define __CLC_BODY #include #undef __CLC_FUNCTION #undef __CLC_BODY �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/smoothstep.h������������������������������������0000664�0000000�0000000�00000002324�13251554454�0024020�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/smoothstep.inc����������������������������������0000664�0000000�0000000�00000002667�13251554454�0024354�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(__CLC_GENTYPE edge0, __CLC_GENTYPE edge1, __CLC_GENTYPE x); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(float edge0, float edge1, __CLC_GENTYPE x); #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE smoothstep(double edge0, double edge1, __CLC_GENTYPE x); #endif �������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/step.h������������������������������������������0000664�0000000�0000000�00000002316�13251554454�0022567�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/common/step.inc����������������������������������������0000664�0000000�0000000�00000002562�13251554454�0023114�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE step(__CLC_GENTYPE edge, __CLC_GENTYPE x); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE step(float edge, __CLC_GENTYPE x); #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE step(double edge, __CLC_GENTYPE x); #endif ����������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/convert.h����������������������������������������������0000664�0000000�0000000�00000004416�13251554454�0022007�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \ _CLC_OVERLOAD _CLC_DECL TO_TYPE convert_##TO_TYPE##SUFFIX(FROM_TYPE x); #define _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE##2, TO_TYPE##2, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE##3, TO_TYPE##3, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE##4, TO_TYPE##4, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE##8, TO_TYPE##8, SUFFIX) \ _CLC_CONVERT_DECL(FROM_TYPE##16, TO_TYPE##16, SUFFIX) #define _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, char, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uchar, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, int, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uint, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, short, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ushort, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, long, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ulong, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, float, SUFFIX) #ifdef cl_khr_fp64 #define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \ _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX) #else #define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) #endif #define _CLC_VECTOR_CONVERT_TO1(SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(char, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(uchar, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(int, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(uint, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(short, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(ushort, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(long, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(ulong, SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(float, SUFFIX) #ifdef cl_khr_fp64 #define _CLC_VECTOR_CONVERT_TO(SUFFIX) \ _CLC_VECTOR_CONVERT_TO1(SUFFIX) \ _CLC_VECTOR_CONVERT_FROM(double, SUFFIX) #else #define _CLC_VECTOR_CONVERT_TO(SUFFIX) \ _CLC_VECTOR_CONVERT_TO1(SUFFIX) #endif #define _CLC_VECTOR_CONVERT_TO_SUFFIX(ROUND) \ _CLC_VECTOR_CONVERT_TO(_sat##ROUND) \ _CLC_VECTOR_CONVERT_TO(ROUND) _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtn) _CLC_VECTOR_CONVERT_TO_SUFFIX(_rte) _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtz) _CLC_VECTOR_CONVERT_TO_SUFFIX(_rtp) _CLC_VECTOR_CONVERT_TO_SUFFIX() ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/explicit_fence/����������������������������������������0000775�0000000�0000000�00000000000�13251554454�0023132�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/explicit_fence/explicit_memory_fence.h�����������������0000664�0000000�0000000�00000000247�13251554454�0027657�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL void mem_fence(cl_mem_fence_flags flags); _CLC_DECL void read_mem_fence(cl_mem_fence_flags flags); _CLC_DECL void write_mem_fence(cl_mem_fence_flags flags); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/float/�������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021256�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/float/definitions.h������������������������������������0000664�0000000�0000000�00000004501�13251554454�0023742�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define MAXFLOAT 0x1.fffffep127f #define HUGE_VALF __builtin_huge_valf() #define INFINITY __builtin_inff() #define NAN __builtin_nanf("") #define FLT_DIG 6 #define FLT_MANT_DIG 24 #define FLT_MAX_10_EXP +38 #define FLT_MAX_EXP +128 #define FLT_MIN_10_EXP -37 #define FLT_MIN_EXP -125 #define FLT_RADIX 2 #define FLT_MAX MAXFLOAT #define FLT_MIN 0x1.0p-126f #define FLT_EPSILON 0x1.0p-23f #define FP_ILOGB0 (-2147483647 - 1) #define FP_ILOGBNAN (-2147483647 - 1) #define M_E_F 0x1.5bf0a8p+1f #define M_LOG2E_F 0x1.715476p+0f #define M_LOG10E_F 0x1.bcb7b2p-2f #define M_LN2_F 0x1.62e430p-1f #define M_LN10_F 0x1.26bb1cp+1f #define M_PI_F 0x1.921fb6p+1f #define M_PI_2_F 0x1.921fb6p+0f #define M_PI_4_F 0x1.921fb6p-1f #define M_1_PI_F 0x1.45f306p-2f #define M_2_PI_F 0x1.45f306p-1f #define M_2_SQRTPI_F 0x1.20dd76p+0f #define M_SQRT2_F 0x1.6a09e6p+0f #define M_SQRT1_2_F 0x1.6a09e6p-1f #ifdef __CLC_INTERNAL #define M_LOG210_F 0x1.a934f0p+1f #endif #ifdef cl_khr_fp64 #define HUGE_VAL __builtin_huge_val() #define DBL_DIG 15 #define DBL_MANT_DIG 53 #define DBL_MAX_10_EXP +308 #define DBL_MAX_EXP +1024 #define DBL_MIN_10_EXP -307 #define DBL_MIN_EXP -1021 #define DBL_MAX 0x1.fffffffffffffp1023 #define DBL_MIN 0x1.0p-1022 #define DBL_EPSILON 0x1.0p-52 #define M_E 0x1.5bf0a8b145769p+1 #define M_LOG2E 0x1.71547652b82fep+0 #define M_LOG10E 0x1.bcb7b1526e50ep-2 #define M_LN2 0x1.62e42fefa39efp-1 #define M_LN10 0x1.26bb1bbb55516p+1 #define M_PI 0x1.921fb54442d18p+1 #define M_PI_2 0x1.921fb54442d18p+0 #define M_PI_4 0x1.921fb54442d18p-1 #define M_1_PI 0x1.45f306dc9c883p-2 #define M_2_PI 0x1.45f306dc9c883p-1 #define M_2_SQRTPI 0x1.20dd750429b6dp+0 #define M_SQRT2 0x1.6a09e667f3bcdp+0 #define M_SQRT1_2 0x1.6a09e667f3bcdp-1 #ifdef __CLC_INTERNAL #define M_LOG210 0x1.a934f0979a371p+1 #endif #endif #ifdef cl_khr_fp16 #if __OPENCL_VERSION__ >= 120 #define HALF_DIG 3 #define HALF_MANT_DIG 11 #define HALF_MAX_10_EXP +4 #define HALF_MAX_EXP +16 #define HALF_MIN_10_EXP -4 #define HALF_MIN_EXP -13 #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/���������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0022127�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/cross.h��������������������������������������0000664�0000000�0000000�00000000421�13251554454�0023426�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1); _CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1); #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DECL double3 cross(double3 p0, double3 p1); _CLC_OVERLOAD _CLC_DECL double4 cross(double4 p0, double4 p1); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/distance.h�����������������������������������0000664�0000000�0000000�00000000124�13251554454�0024067�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/distance.inc���������������������������������0000664�0000000�0000000�00000002303�13251554454�0024412�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_FLOAT distance(__CLC_FLOATN p0, __CLC_FLOATN p1); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/dot.h����������������������������������������0000664�0000000�0000000�00000000117�13251554454�0023065�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/dot.inc��������������������������������������0000664�0000000�0000000�00000000113�13251554454�0023403�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT dot(__CLC_FLOATN p0, __CLC_FLOATN p1); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_distance.h������������������������������0000664�0000000�0000000�00000002365�13251554454�0025115�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __FLOAT_ONLY #include #undef __FLOAT_ONLY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_distance.inc����������������������������0000664�0000000�0000000�00000002310�13251554454�0025425�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_FLOAT fast_distance(__CLC_FLOATN p0, __CLC_FLOATN p1); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_length.h��������������������������������0000664�0000000�0000000�00000002363�13251554454�0024602�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __FLOAT_ONLY #include #undef __FLOAT_ONLY �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_length.inc������������������������������0000664�0000000�0000000�00000002265�13251554454�0025125�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_FLOAT fast_length(__CLC_FLOATN p0); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_normalize.h�����������������������������0000664�0000000�0000000�00000002366�13251554454�0025324�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __FLOAT_ONLY #include #undef __FLOAT_ONLY ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/fast_normalize.inc���������������������������0000664�0000000�0000000�00000002271�13251554454�0025641�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_FLOATN fast_normalize(__CLC_FLOATN p); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/floatn.inc�����������������������������������0000664�0000000�0000000�00000001653�13251554454�0024112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FLOAT float #define __CLC_FPSIZE 32 #define __CLC_FLOATN float #define __CLC_SCALAR #include __CLC_BODY #undef __CLC_FLOATN #undef __CLC_SCALAR #define __CLC_FLOATN float2 #include __CLC_BODY #undef __CLC_FLOATN #define __CLC_FLOATN float3 #include __CLC_BODY #undef __CLC_FLOATN #define __CLC_FLOATN float4 #include __CLC_BODY #undef __CLC_FLOATN #undef __CLC_FLOAT #undef __CLC_FPSIZE #ifndef __FLOAT_ONLY #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define __CLC_FLOAT double #define __CLC_FPSIZE 64 #define __CLC_FLOATN double #define __CLC_SCALAR #include __CLC_BODY #undef __CLC_FLOATN #undef __CLC_SCALAR #define __CLC_FLOATN double2 #include __CLC_BODY #undef __CLC_FLOATN #define __CLC_FLOATN double3 #include __CLC_BODY #undef __CLC_FLOATN #define __CLC_FLOATN double4 #include __CLC_BODY #undef __CLC_FLOATN #undef __CLC_FLOAT #undef __CLC_FPSIZE #endif #endif #undef __CLC_BODY �������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/length.h�������������������������������������0000664�0000000�0000000�00000000122�13251554454�0023554�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/length.inc�����������������������������������0000664�0000000�0000000�00000000075�13251554454�0024105�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT length(__CLC_FLOATN p0); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/normalize.h����������������������������������0000664�0000000�0000000�00000000125�13251554454�0024276�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/geometric/normalize.inc��������������������������������0000664�0000000�0000000�00000000100�13251554454�0024611�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_FLOATN normalize(__CLC_FLOATN p); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/image/�������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021233�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/image/image.h������������������������������������������0000664�0000000�0000000�00000003016�13251554454�0022466�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_height (image2d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_height (image3d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_depth (image3d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image2d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image3d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image2d_t image); _CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image3d_t image); _CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image); _CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image); _CLC_OVERLOAD _CLC_DECL void write_imagef(image2d_t image, int2 coord, float4 color); _CLC_OVERLOAD _CLC_DECL void write_imagei(image2d_t image, int2 coord, int4 color); _CLC_OVERLOAD _CLC_DECL void write_imageui(image2d_t image, int2 coord, uint4 color); _CLC_OVERLOAD _CLC_DECL float4 read_imagef(image2d_t image, sampler_t sampler, int2 coord); _CLC_OVERLOAD _CLC_DECL float4 read_imagef(image2d_t image, sampler_t sampler, float2 coord); _CLC_OVERLOAD _CLC_DECL int4 read_imagei(image2d_t image, sampler_t sampler, int2 coord); _CLC_OVERLOAD _CLC_DECL int4 read_imagei(image2d_t image, sampler_t sampler, float2 coord); _CLC_OVERLOAD _CLC_DECL uint4 read_imageui(image2d_t image, sampler_t sampler, int2 coord); _CLC_OVERLOAD _CLC_DECL uint4 read_imageui(image2d_t image, sampler_t sampler, float2 coord); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/image/image_defines.h����������������������������������0000664�0000000�0000000�00000003610�13251554454�0024163�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* get_image_channel_data_type flags */ #define CLK_SNORM_INT8 0x10D0 #define CLK_SNORM_INT16 0x10D1 #define CLK_UNORM_INT8 0x10D2 #define CLK_UNORM_INT16 0x10D3 #define CLK_UNORM_SHORT_565 0x10D4 #define CLK_UNORM_SHORT_555 0x10D5 #define CLK_UNORM_SHORT_101010 0x10D6 #define CLK_SIGNED_INT8 0x10D7 #define CLK_SIGNED_INT16 0x10D8 #define CLK_SIGNED_INT32 0x10D9 #define CLK_UNSIGNED_INT8 0x10DA #define CLK_UNSIGNED_INT16 0x10DB #define CLK_UNSIGNED_INT32 0x10DC #define CLK_HALF_FLOAT 0x10DD #define CLK_FLOAT 0x10DE /* get_image_channel_order flags */ #define CLK_R 0x10B0 #define CLK_A 0x10B1 #define CLK_RG 0x10B2 #define CLK_RA 0x10B3 #define CLK_RGB 0x10B4 #define CLK_RGBA 0x10B5 #define CLK_BGRA 0x10B6 #define CLK_ARGB 0x10B7 #define CLK_INTENSITY 0x10B8 #define CLK_LUMINANCE 0x10B9 #define CLK_Rx 0x10BA #define CLK_RGx 0x10BB #define CLK_RGBx 0x10BC /* sampler normalized coords */ #define CLK_NORMALIZED_COORDS_FALSE 0x0000 #define CLK_NORMALIZED_COORDS_TRUE 0x0001 #define __CLC_NORMALIZED_COORDS_MASK 0x0001 /* sampler addressing mode */ #define CLK_ADDRESS_NONE 0x0000 #define CLK_ADDRESS_CLAMP_TO_EDGE 0x0002 #define CLK_ADDRESS_CLAMP 0x0004 #define CLK_ADDRESS_REPEAT 0x0006 #define CLK_ADDRESS_MIRRORED_REPEAT 0x0008 #define __CLC_ADDRESS_MASK 0x000E /* sampler filter mode */ #define CLK_FILTER_NEAREST 0x0000 #define CLK_FILTER_LINEAR 0x0010 #define __CLC_FILTER_MASK 0x0010 ������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/�����������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021606�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/abs.h������������������������������������������0000664�0000000�0000000�00000000114�13251554454�0022520�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/abs.inc����������������������������������������0000664�0000000�0000000�00000000076�13251554454�0023051�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs(__CLC_GENTYPE x); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/abs_diff.h�������������������������������������0000664�0000000�0000000�00000000121�13251554454�0023506�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/abs_diff.inc�����������������������������������0000664�0000000�0000000�00000000124�13251554454�0024033�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/add_sat.h��������������������������������������0000664�0000000�0000000�00000000120�13251554454�0023347�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/add_sat.inc������������������������������������0000664�0000000�0000000�00000000121�13251554454�0023672�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE add_sat(__CLC_GENTYPE x, __CLC_GENTYPE y); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/clz.h������������������������������������������0000664�0000000�0000000�00000000114�13251554454�0022543�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/clz.inc����������������������������������������0000664�0000000�0000000�00000000074�13251554454�0023072�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE clz(__CLC_GENTYPE x); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/definitions.h����������������������������������0000664�0000000�0000000�00000000661�13251554454�0024275�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define CHAR_BIT 8 #define INT_MAX 2147483647 #define INT_MIN (-2147483647 - 1) #define LONG_MAX 0x7fffffffffffffffL #define LONG_MIN (-0x7fffffffffffffffL - 1) #define CHAR_MAX SCHAR_MAX #define CHAR_MIN SCHAR_MIN #define SCHAR_MAX 127 #define SCHAR_MIN (-127 - 1) #define SHRT_MAX 32767 #define SHRT_MIN (-32767 - 1) #define UCHAR_MAX 255 #define USHRT_MAX 65535 #define UINT_MAX 0xffffffff #define ULONG_MAX 0xffffffffffffffffUL �������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/gentype.inc������������������������������������0000664�0000000�0000000�00000027073�13251554454�0023765�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//These 2 defines only change when switching between data sizes or base types to //keep this file manageable. #define __CLC_GENSIZE 8 #define __CLC_SCALAR_GENTYPE char #define __CLC_GENTYPE char #define __CLC_U_GENTYPE uchar #define __CLC_S_GENTYPE char #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE char2 #define __CLC_U_GENTYPE uchar2 #define __CLC_S_GENTYPE char2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE char3 #define __CLC_U_GENTYPE uchar3 #define __CLC_S_GENTYPE char3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE char4 #define __CLC_U_GENTYPE uchar4 #define __CLC_S_GENTYPE char4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE char8 #define __CLC_U_GENTYPE uchar8 #define __CLC_S_GENTYPE char8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE char16 #define __CLC_U_GENTYPE uchar16 #define __CLC_S_GENTYPE char16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE uchar #define __CLC_GENTYPE uchar #define __CLC_U_GENTYPE uchar #define __CLC_S_GENTYPE char #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uchar2 #define __CLC_U_GENTYPE uchar2 #define __CLC_S_GENTYPE char2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uchar3 #define __CLC_U_GENTYPE uchar3 #define __CLC_S_GENTYPE char3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uchar4 #define __CLC_U_GENTYPE uchar4 #define __CLC_S_GENTYPE char4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uchar8 #define __CLC_U_GENTYPE uchar8 #define __CLC_S_GENTYPE char8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uchar16 #define __CLC_U_GENTYPE uchar16 #define __CLC_S_GENTYPE char16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_GENSIZE #define __CLC_GENSIZE 16 #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE short #define __CLC_GENTYPE short #define __CLC_U_GENTYPE ushort #define __CLC_S_GENTYPE short #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE short2 #define __CLC_U_GENTYPE ushort2 #define __CLC_S_GENTYPE short2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE short3 #define __CLC_U_GENTYPE ushort3 #define __CLC_S_GENTYPE short3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE short4 #define __CLC_U_GENTYPE ushort4 #define __CLC_S_GENTYPE short4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE short8 #define __CLC_U_GENTYPE ushort8 #define __CLC_S_GENTYPE short8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE short16 #define __CLC_U_GENTYPE ushort16 #define __CLC_S_GENTYPE short16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE ushort #define __CLC_GENTYPE ushort #define __CLC_U_GENTYPE ushort #define __CLC_S_GENTYPE short #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ushort2 #define __CLC_U_GENTYPE ushort2 #define __CLC_S_GENTYPE short2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ushort3 #define __CLC_U_GENTYPE ushort3 #define __CLC_S_GENTYPE short3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ushort4 #define __CLC_U_GENTYPE ushort4 #define __CLC_S_GENTYPE short4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ushort8 #define __CLC_U_GENTYPE ushort8 #define __CLC_S_GENTYPE short8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ushort16 #define __CLC_U_GENTYPE ushort16 #define __CLC_S_GENTYPE short16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_GENSIZE #define __CLC_GENSIZE 32 #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE int #define __CLC_GENTYPE int #define __CLC_U_GENTYPE uint #define __CLC_S_GENTYPE int #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE int2 #define __CLC_U_GENTYPE uint2 #define __CLC_S_GENTYPE int2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE int3 #define __CLC_U_GENTYPE uint3 #define __CLC_S_GENTYPE int3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE int4 #define __CLC_U_GENTYPE uint4 #define __CLC_S_GENTYPE int4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE int8 #define __CLC_U_GENTYPE uint8 #define __CLC_S_GENTYPE int8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE int16 #define __CLC_U_GENTYPE uint16 #define __CLC_S_GENTYPE int16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE uint #define __CLC_GENTYPE uint #define __CLC_U_GENTYPE uint #define __CLC_S_GENTYPE int #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uint2 #define __CLC_U_GENTYPE uint2 #define __CLC_S_GENTYPE int2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uint3 #define __CLC_U_GENTYPE uint3 #define __CLC_S_GENTYPE int3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uint4 #define __CLC_U_GENTYPE uint4 #define __CLC_S_GENTYPE int4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uint8 #define __CLC_U_GENTYPE uint8 #define __CLC_S_GENTYPE int8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE uint16 #define __CLC_U_GENTYPE uint16 #define __CLC_S_GENTYPE int16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_GENSIZE #define __CLC_GENSIZE 64 #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE long #define __CLC_GENTYPE long #define __CLC_U_GENTYPE ulong #define __CLC_S_GENTYPE long #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE long2 #define __CLC_U_GENTYPE ulong2 #define __CLC_S_GENTYPE long2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE long3 #define __CLC_U_GENTYPE ulong3 #define __CLC_S_GENTYPE long3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE long4 #define __CLC_U_GENTYPE ulong4 #define __CLC_S_GENTYPE long4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE long8 #define __CLC_U_GENTYPE ulong8 #define __CLC_S_GENTYPE long8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE long16 #define __CLC_U_GENTYPE ulong16 #define __CLC_S_GENTYPE long16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_SCALAR_GENTYPE #define __CLC_SCALAR_GENTYPE ulong #define __CLC_GENTYPE ulong #define __CLC_U_GENTYPE ulong #define __CLC_S_GENTYPE long #define __CLC_SCALAR 1 #define __CLC_VECSIZE #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_SCALAR #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ulong2 #define __CLC_U_GENTYPE ulong2 #define __CLC_S_GENTYPE long2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ulong3 #define __CLC_U_GENTYPE ulong3 #define __CLC_S_GENTYPE long3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ulong4 #define __CLC_U_GENTYPE ulong4 #define __CLC_S_GENTYPE long4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ulong8 #define __CLC_U_GENTYPE ulong8 #define __CLC_S_GENTYPE long8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #define __CLC_GENTYPE ulong16 #define __CLC_U_GENTYPE ulong16 #define __CLC_S_GENTYPE long16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_S_GENTYPE #undef __CLC_GENSIZE #undef __CLC_SCALAR_GENTYPE #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/hadd.h�����������������������������������������0000664�0000000�0000000�00000000115�13251554454�0022654�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/hadd.inc���������������������������������������0000664�0000000�0000000�00000000116�13251554454�0023177�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE hadd(__CLC_GENTYPE x, __CLC_GENTYPE y); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/integer-gentype.inc����������������������������0000664�0000000�0000000�00000001501�13251554454�0025404�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_GENTYPE int #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int3 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE int16 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint2 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint3 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint4 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint8 #include __CLC_BODY #undef __CLC_GENTYPE #define __CLC_GENTYPE uint16 #include __CLC_BODY #undef __CLC_GENTYPE �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mad24.h����������������������������������������0000664�0000000�0000000�00000000150�13251554454�0022662�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mad24.inc��������������������������������������0000664�0000000�0000000�00000000140�13251554454�0023203�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad24(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mad_hi.h���������������������������������������0000664�0000000�0000000�00000000056�13251554454�0023201�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define mad_hi(a, b, c) (mul_hi((a),(b))+(c)) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mad_sat.h��������������������������������������0000664�0000000�0000000�00000000142�13251554454�0023364�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mad_sat.inc������������������������������������0000664�0000000�0000000�00000000142�13251554454�0023706�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad_sat(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mul24.h����������������������������������������0000664�0000000�0000000�00000000150�13251554454�0022716�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mul24.inc��������������������������������������0000664�0000000�0000000�00000000117�13251554454�0023243�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul24(__CLC_GENTYPE x, __CLC_GENTYPE y); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mul_hi.h���������������������������������������0000664�0000000�0000000�00000000117�13251554454�0023233�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/mul_hi.inc�������������������������������������0000664�0000000�0000000�00000000120�13251554454�0023547�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul_hi(__CLC_GENTYPE x, __CLC_GENTYPE y); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/popcount.h�������������������������������������0000664�0000000�0000000�00000000226�13251554454�0023626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION popcount #define __CLC_BODY #include #undef __CLC_FUNCTION #undef __CLC_BODY ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/rhadd.h����������������������������������������0000664�0000000�0000000�00000000116�13251554454�0023037�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/rhadd.inc��������������������������������������0000664�0000000�0000000�00000000117�13251554454�0023362�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rhadd(__CLC_GENTYPE x, __CLC_GENTYPE y); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/rotate.h���������������������������������������0000664�0000000�0000000�00000000117�13251554454�0023254�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/rotate.inc�������������������������������������0000664�0000000�0000000�00000000120�13251554454�0023570�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE y); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/sub_sat.h��������������������������������������0000664�0000000�0000000�00000000120�13251554454�0023410�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/sub_sat.inc������������������������������������0000664�0000000�0000000�00000000121�13251554454�0023733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE sub_sat(__CLC_GENTYPE x, __CLC_GENTYPE y); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/unary.inc��������������������������������������0000664�0000000�0000000�00000000107�13251554454�0023435�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/integer/upsample.h�������������������������������������0000664�0000000�0000000�00000001723�13251554454�0023610�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \ _CLC_OVERLOAD _CLC_DECL BGENTYPE upsample(GENTYPE hi, UGENTYPE lo); #define __CLC_UPSAMPLE_VEC(BGENTYPE, GENTYPE, UGENTYPE) \ __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \ __CLC_UPSAMPLE_DECL(BGENTYPE##2, GENTYPE##2, UGENTYPE##2) \ __CLC_UPSAMPLE_DECL(BGENTYPE##3, GENTYPE##3, UGENTYPE##3) \ __CLC_UPSAMPLE_DECL(BGENTYPE##4, GENTYPE##4, UGENTYPE##4) \ __CLC_UPSAMPLE_DECL(BGENTYPE##8, GENTYPE##8, UGENTYPE##8) \ __CLC_UPSAMPLE_DECL(BGENTYPE##16, GENTYPE##16, UGENTYPE##16) \ #define __CLC_UPSAMPLE_TYPES() \ __CLC_UPSAMPLE_VEC(short, char, uchar) \ __CLC_UPSAMPLE_VEC(ushort, uchar, uchar) \ __CLC_UPSAMPLE_VEC(int, short, ushort) \ __CLC_UPSAMPLE_VEC(uint, ushort, ushort) \ __CLC_UPSAMPLE_VEC(long, int, uint) \ __CLC_UPSAMPLE_VEC(ulong, uint, uint) \ __CLC_UPSAMPLE_TYPES() #undef __CLC_UPSAMPLE_TYPES #undef __CLC_UPSAMPLE_DECL #undef __CLC_UPSAMPLE_VEC ���������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/��������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021102�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/acos.h��������������������������������������������0000664�0000000�0000000�00000000223�13251554454�0022175�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION acos #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/acosh.h�������������������������������������������0000664�0000000�0000000�00000002410�13251554454�0022345�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION acosh #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/acospi.h������������������������������������������0000664�0000000�0000000�00000002411�13251554454�0022527�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION acospi #include #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/asin.h��������������������������������������������0000664�0000000�0000000�00000000223�13251554454�0022202�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION asin #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/asinh.h�������������������������������������������0000664�0000000�0000000�00000002410�13251554454�0022352�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION asinh #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/asinpi.h������������������������������������������0000664�0000000�0000000�00000002411�13251554454�0022534�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION asinpi #include #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atan.h��������������������������������������������0000664�0000000�0000000�00000002401�13251554454�0022173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION atan #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atan2.h�������������������������������������������0000664�0000000�0000000�00000002266�13251554454�0022266�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atan2.inc�����������������������������������������0000664�0000000�0000000�00000002275�13251554454�0022610�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE atan2(__CLC_GENTYPE a, __CLC_GENTYPE b); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atan2pi.h�����������������������������������������0000664�0000000�0000000�00000002276�13251554454�0022620�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atan2pi.inc���������������������������������������0000664�0000000�0000000�00000002305�13251554454�0023133�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE atan2pi(__CLC_GENTYPE x, __CLC_GENTYPE y); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atanh.h�������������������������������������������0000664�0000000�0000000�00000002410�13251554454�0022343�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION atanh #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/atanpi.h������������������������������������������0000664�0000000�0000000�00000002411�13251554454�0022525�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION atanpi #include #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/binary_decl.inc�����������������������������������0000664�0000000�0000000�00000000267�13251554454�0024055�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/binary_decl_tt.inc��������������������������������0000664�0000000�0000000�00000000130�13251554454�0024551�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/binary_intrin.inc���������������������������������0000664�0000000�0000000�00000002203�13251554454�0024441�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD float __CLC_FUNCTION(float, float) __asm(__CLC_INTRINSIC ".f32"); _CLC_OVERLOAD float2 __CLC_FUNCTION(float2, float2) __asm(__CLC_INTRINSIC ".v2f32"); _CLC_OVERLOAD float3 __CLC_FUNCTION(float3, float3) __asm(__CLC_INTRINSIC ".v3f32"); _CLC_OVERLOAD float4 __CLC_FUNCTION(float4, float4) __asm(__CLC_INTRINSIC ".v4f32"); _CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8) __asm(__CLC_INTRINSIC ".v8f32"); _CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16) __asm(__CLC_INTRINSIC ".v16f32"); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD double __CLC_FUNCTION(double, double) __asm(__CLC_INTRINSIC ".f64"); _CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2) __asm(__CLC_INTRINSIC ".v2f64"); _CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3) __asm(__CLC_INTRINSIC ".v3f64"); _CLC_OVERLOAD double4 __CLC_FUNCTION(double4, double4) __asm(__CLC_INTRINSIC ".v4f64"); _CLC_OVERLOAD double8 __CLC_FUNCTION(double8, double8) __asm(__CLC_INTRINSIC ".v8f64"); _CLC_OVERLOAD double16 __CLC_FUNCTION(double16, double16) __asm(__CLC_INTRINSIC ".v16f64"); #endif #undef __CLC_FUNCTION #undef __CLC_INTRINSIC ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/cbrt.h��������������������������������������������0000664�0000000�0000000�00000002407�13251554454�0022210�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION cbrt #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ceil.h��������������������������������������������0000664�0000000�0000000�00000000220�13251554454�0022161�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef ceil #define ceil __clc_ceil #define __CLC_FUNCTION __clc_ceil #define __CLC_INTRINSIC "llvm.ceil" #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/copysign.h����������������������������������������0000664�0000000�0000000�00000000113�13251554454�0023101�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/copysign.inc��������������������������������������0000664�0000000�0000000�00000000122�13251554454�0023423�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE copysign(__CLC_GENTYPE a, __CLC_GENTYPE b); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/cos.h���������������������������������������������0000664�0000000�0000000�00000000222�13251554454�0022033�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION cos #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/cosh.h��������������������������������������������0000664�0000000�0000000�00000002407�13251554454�0022212�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION cosh #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/cospi.h�������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022366�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION cospi #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/erf.h���������������������������������������������0000664�0000000�0000000�00000000237�13251554454�0022031�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef erfc #define __CLC_BODY #define __CLC_FUNCTION erf #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/erfc.h��������������������������������������������0000664�0000000�0000000�00000000240�13251554454�0022166�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef erfc #define __CLC_BODY #define __CLC_FUNCTION erfc #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/exp.h���������������������������������������������0000664�0000000�0000000�00000000236�13251554454�0022050�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef exp #define __CLC_BODY #define __CLC_FUNCTION exp #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/exp10.h�������������������������������������������0000664�0000000�0000000�00000000242�13251554454�0022206�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef exp10 #define __CLC_BODY #define __CLC_FUNCTION exp10 #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/exp2.h��������������������������������������������0000664�0000000�0000000�00000002407�13251554454�0022134�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION exp2 #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/expm1.h�������������������������������������������0000664�0000000�0000000�00000000240�13251554454�0022301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef exp #define __CLC_BODY #define __CLC_FUNCTION expm1 #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fabs.h��������������������������������������������0000664�0000000�0000000�00000000220�13251554454�0022160�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef fabs #define fabs __clc_fabs #define __CLC_FUNCTION __clc_fabs #define __CLC_INTRINSIC "llvm.fabs" #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fdim.h��������������������������������������������0000664�0000000�0000000�00000000107�13251554454�0022170�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fdim.inc������������������������������������������0000664�0000000�0000000�00000000116�13251554454�0022512�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fdim(__CLC_GENTYPE a, __CLC_GENTYPE b); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/floor.h�������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022373�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef floor #define floor __clc_floor #define __CLC_FUNCTION __clc_floor #define __CLC_INTRINSIC "llvm.floor" #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fma.h���������������������������������������������0000664�0000000�0000000�00000000215�13251554454�0022014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef fma #define fma __clc_fma #define __CLC_FUNCTION __clc_fma #define __CLC_INTRINSIC "llvm.fma" #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fmax.h��������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022205�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION fmax #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fmin.h��������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022203�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION fmin #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fmod.h��������������������������������������������0000664�0000000�0000000�00000000107�13251554454�0022176�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fmod.inc������������������������������������������0000664�0000000�0000000�00000000116�13251554454�0022520�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fmod(__CLC_GENTYPE a, __CLC_GENTYPE b); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fract.h�������������������������������������������0000664�0000000�0000000�00000002274�13251554454�0022357�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/fract.inc�����������������������������������������0000664�0000000�0000000�00000002602�13251554454�0022674�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract(__CLC_GENTYPE x, global __CLC_GENTYPE *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract(__CLC_GENTYPE x, local __CLC_GENTYPE *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fract(__CLC_GENTYPE x, private __CLC_GENTYPE *iptr); ������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/frexp.h�������������������������������������������0000664�0000000�0000000�00000000110�13251554454�0022367�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/frexp.inc�����������������������������������������0000664�0000000�0000000�00000000405�13251554454�0022720�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, global __CLC_INTN *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, local __CLC_INTN *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE frexp(__CLC_GENTYPE x, private __CLC_INTN *iptr); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/gentype.inc���������������������������������������0000664�0000000�0000000�00000004272�13251554454�0023255�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_SCALAR_GENTYPE float #define __CLC_FPSIZE 32 #define __CLC_GENTYPE float #define __CLC_INTN int #define __CLC_SCALAR #include __CLC_BODY #undef __CLC_GENTYPE #undef __CLC_INTN #undef __CLC_SCALAR #define __CLC_GENTYPE float2 #define __CLC_INTN int2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE float3 #define __CLC_INTN int3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE float4 #define __CLC_INTN int4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE float8 #define __CLC_INTN int8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE float16 #define __CLC_INTN int16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #undef __CLC_FPSIZE #undef __CLC_SCALAR_GENTYPE #ifndef __FLOAT_ONLY #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define __CLC_SCALAR_GENTYPE double #define __CLC_FPSIZE 64 #define __CLC_SCALAR #define __CLC_GENTYPE double #define __CLC_INTN int #include __CLC_BODY #undef __CLC_GENTYPE #undef __CLC_INTN #undef __CLC_SCALAR #define __CLC_GENTYPE double2 #define __CLC_INTN int2 #define __CLC_VECSIZE 2 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE double3 #define __CLC_INTN int3 #define __CLC_VECSIZE 3 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE double4 #define __CLC_INTN int4 #define __CLC_VECSIZE 4 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE double8 #define __CLC_INTN int8 #define __CLC_VECSIZE 8 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #define __CLC_GENTYPE double16 #define __CLC_INTN int16 #define __CLC_VECSIZE 16 #include __CLC_BODY #undef __CLC_VECSIZE #undef __CLC_GENTYPE #undef __CLC_INTN #undef __CLC_FPSIZE #undef __CLC_SCALAR_GENTYPE #endif #undef __CLC_BODY #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_cos.h����������������������������������������0000664�0000000�0000000�00000000300�13251554454�0023022�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_cos #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_divide.h�������������������������������������0000664�0000000�0000000�00000000236�13251554454�0023512�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_divide #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_exp.h����������������������������������������0000664�0000000�0000000�00000000300�13251554454�0023032�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_exp #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_exp10.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023175�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_exp10 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_exp2.h���������������������������������������0000664�0000000�0000000�00000000301�13251554454�0023115�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_exp2 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_log.h����������������������������������������0000664�0000000�0000000�00000000300�13251554454�0023017�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_log #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_log10.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023162�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_log10 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_log2.h���������������������������������������0000664�0000000�0000000�00000000301�13251554454�0023102�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_log2 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_powr.h���������������������������������������0000664�0000000�0000000�00000000234�13251554454�0023233�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_powr #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_recip.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023342�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_recip #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_rsqrt.h��������������������������������������0000664�0000000�0000000�00000002463�13251554454�0023425�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION half_rsqrt #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_sin.h����������������������������������������0000664�0000000�0000000�00000000300�13251554454�0023027�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_sin #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_sqrt.h���������������������������������������0000664�0000000�0000000�00000002462�13251554454�0023242�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION half_sqrt #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/half_tan.h����������������������������������������0000664�0000000�0000000�00000000300�13251554454�0023020�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION half_tan #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/hypot.h�������������������������������������������0000664�0000000�0000000�00000000110�13251554454�0022406�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/hypot.inc�����������������������������������������0000664�0000000�0000000�00000000117�13251554454�0022737�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE hypot(__CLC_GENTYPE x, __CLC_GENTYPE y); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ilogb.h�������������������������������������������0000664�0000000�0000000�00000000134�13251554454�0022345�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ilogb.inc�����������������������������������������0000664�0000000�0000000�00000000073�13251554454�0022671�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_INTN ilogb(__CLC_GENTYPE x); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ldexp.h�������������������������������������������0000664�0000000�0000000�00000002273�13251554454�0022373�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ldexp.inc�����������������������������������������0000664�0000000�0000000�00000002443�13251554454�0022714�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE ldexp(__CLC_GENTYPE x, int n); #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE ldexp(__CLC_GENTYPE x, __CLC_INTN n); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/lgamma.h������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022510�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION lgamma #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/lgamma_r.h����������������������������������������0000664�0000000�0000000�00000000113�13251554454�0023025�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/lgamma_r.inc��������������������������������������0000664�0000000�0000000�00000000416�13251554454�0023355�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, global __CLC_INTN *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, local __CLC_INTN *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, private __CLC_INTN *iptr); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/log.h���������������������������������������������0000664�0000000�0000000�00000002400�13251554454�0022030�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION log #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/log10.h�������������������������������������������0000664�0000000�0000000�00000000242�13251554454�0022173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef log10 #define __CLC_BODY #define __CLC_FUNCTION log10 #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/log1p.h�������������������������������������������0000664�0000000�0000000�00000002402�13251554454�0022273�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION log1p #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/log2.h��������������������������������������������0000664�0000000�0000000�00000002401�13251554454�0022113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION log2 #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/logb.h��������������������������������������������0000664�0000000�0000000�00000000223�13251554454�0022173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION logb #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/mad.h���������������������������������������������0000664�0000000�0000000�00000000106�13251554454�0022011�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/mad.inc�������������������������������������������0000664�0000000�0000000�00000000136�13251554454�0022336�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/maxmag.h������������������������������������������0000664�0000000�0000000�00000000231�13251554454�0022521�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION maxmag #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/minmag.h������������������������������������������0000664�0000000�0000000�00000000231�13251554454�0022517�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION minmag #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/modf.h��������������������������������������������0000664�0000000�0000000�00000002265�13251554454�0022205�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/modf.inc������������������������������������������0000664�0000000�0000000�00000002577�13251554454�0022535�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE modf(__CLC_GENTYPE x, global __CLC_GENTYPE *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE modf(__CLC_GENTYPE x, local __CLC_GENTYPE *iptr); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE modf(__CLC_GENTYPE x, private __CLC_GENTYPE *iptr); ���������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/nan.h���������������������������������������������0000664�0000000�0000000�00000000302�13251554454�0022022�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_CONCAT(x, y) x ## y #define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y) #define __CLC_BODY #include #undef __CLC_XCONCAT #undef __CLC_CONCAT ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/nan.inc�������������������������������������������0000664�0000000�0000000�00000000503�13251554454�0022347�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 #define __CLC_NATN __CLC_XCONCAT(ulong, __CLC_VECSIZE) #else #define __CLC_NATN __CLC_XCONCAT(uint, __CLC_VECSIZE) #endif _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE nan(__CLC_NATN code); #undef __CLC_NATN #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_cos.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023400�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_cos #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_divide.h�����������������������������������0000664�0000000�0000000�00000000240�13251554454�0024061�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_divide #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_exp.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023410�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_exp #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_exp10.h������������������������������������0000664�0000000�0000000�00000000304�13251554454�0023553�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_exp10 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_exp2.h�������������������������������������0000664�0000000�0000000�00000000303�13251554454�0023473�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_exp2 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_log.h��������������������������������������0000664�0000000�0000000�00000002460�13251554454�0023404�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION native_log #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_log10.h������������������������������������0000664�0000000�0000000�00000000304�13251554454�0023540�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_log10 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_log2.h�������������������������������������0000664�0000000�0000000�00000002461�13251554454�0023467�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION native_log2 #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_powr.h�������������������������������������0000664�0000000�0000000�00000000236�13251554454�0023611�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_powr #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_recip.h������������������������������������0000664�0000000�0000000�00000000304�13251554454�0023720�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_recip #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_rsqrt.h������������������������������������0000664�0000000�0000000�00000000304�13251554454�0023771�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_rsqrt #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_sin.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023405�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_sin #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_sqrt.h�������������������������������������0000664�0000000�0000000�00000000303�13251554454�0023606�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_sqrt #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/native_tan.h��������������������������������������0000664�0000000�0000000�00000000302�13251554454�0023376�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION native_tan #define __FLOAT_ONLY #include #undef __FLOAT_ONLY #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/nextafter.h���������������������������������������0000664�0000000�0000000�00000000114�13251554454�0023247�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/nextafter.inc�������������������������������������0000664�0000000�0000000�00000000123�13251554454�0023571�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE nextafter(__CLC_GENTYPE a, __CLC_GENTYPE b); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/pow.h���������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022056�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION pow #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/pown.h��������������������������������������������0000664�0000000�0000000�00000000131�13251554454�0022231�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/pown.inc������������������������������������������0000664�0000000�0000000�00000000113�13251554454�0022553�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE pown(__CLC_GENTYPE a, __CLC_INTN b); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/powr.h��������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022241�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION powr #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/rint.h��������������������������������������������0000664�0000000�0000000�00000000220�13251554454�0022221�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef rint #define rint __clc_rint #define __CLC_FUNCTION __clc_rint #define __CLC_INTRINSIC "llvm.rint" #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/rootn.h�������������������������������������������0000664�0000000�0000000�00000000132�13251554454�0022410�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/rootn.inc�����������������������������������������0000664�0000000�0000000�00000000114�13251554454�0022732�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rootn(__CLC_GENTYPE a, __CLC_INTN b); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/round.h�������������������������������������������0000664�0000000�0000000�00000000303�13251554454�0022376�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef round #define round __clc_round #define __CLC_FUNCTION __clc_round #define __CLC_INTRINSIC "llvm.round" #include #undef __CLC_FUNCTION #undef __CLC_INTRINSIC �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/rsqrt.h�������������������������������������������0000664�0000000�0000000�00000000037�13251554454�0022426�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define rsqrt(x) (1.f/sqrt(x)) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sin.h���������������������������������������������0000664�0000000�0000000�00000000222�13251554454�0022040�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION sin #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sincos.h������������������������������������������0000664�0000000�0000000�00000000111�13251554454�0022542�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sincos.inc����������������������������������������0000664�0000000�0000000�00000000433�13251554454�0023073�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_DECLARE_SINCOS(ADDRSPACE, TYPE) \ _CLC_OVERLOAD _CLC_DECL TYPE sincos (TYPE x, ADDRSPACE TYPE * cosval); __CLC_DECLARE_SINCOS(global, __CLC_GENTYPE) __CLC_DECLARE_SINCOS(local, __CLC_GENTYPE) __CLC_DECLARE_SINCOS(private, __CLC_GENTYPE) #undef __CLC_DECLARE_SINCOS �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sinh.h��������������������������������������������0000664�0000000�0000000�00000002407�13251554454�0022217�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION sinh #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sinpi.h�������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022373�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION sinpi #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/sqrt.h��������������������������������������������0000664�0000000�0000000�00000000223�13251554454�0022241�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION sqrt #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/tan.h���������������������������������������������0000664�0000000�0000000�00000000222�13251554454�0022031�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION tan #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/tanh.h��������������������������������������������0000664�0000000�0000000�00000002401�13251554454�0022202�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #define __CLC_FUNCTION tanh #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/tanpi.h�������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022364�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION tanpi #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/ternary_intrin.inc��������������������������������0000664�0000000�0000000�00000002351�13251554454�0024645�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD float __CLC_FUNCTION(float, float, float) __asm(__CLC_INTRINSIC ".f32"); _CLC_OVERLOAD float2 __CLC_FUNCTION(float2, float2, float2) __asm(__CLC_INTRINSIC ".v2f32"); _CLC_OVERLOAD float3 __CLC_FUNCTION(float3, float3, float3) __asm(__CLC_INTRINSIC ".v3f32"); _CLC_OVERLOAD float4 __CLC_FUNCTION(float4, float4, float4) __asm(__CLC_INTRINSIC ".v4f32"); _CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8, float8) __asm(__CLC_INTRINSIC ".v8f32"); _CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16, float16) __asm(__CLC_INTRINSIC ".v16f32"); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD double __CLC_FUNCTION(double, double, double) __asm(__CLC_INTRINSIC ".f64"); _CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2, double2) __asm(__CLC_INTRINSIC ".v2f64"); _CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3, double3) __asm(__CLC_INTRINSIC ".v3f64"); _CLC_OVERLOAD double4 __CLC_FUNCTION(double4, double4, double4) __asm(__CLC_INTRINSIC ".v4f64"); _CLC_OVERLOAD double8 __CLC_FUNCTION(double8, double8, double8) __asm(__CLC_INTRINSIC ".v8f64"); _CLC_OVERLOAD double16 __CLC_FUNCTION(double16, double16, double16) __asm(__CLC_INTRINSIC ".v16f64"); #endif #undef __CLC_FUNCTION #undef __CLC_INTRINSIC ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/tgamma.h������������������������������������������0000664�0000000�0000000�00000000225�13251554454�0022520�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION tgamma #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/trunc.h�������������������������������������������0000664�0000000�0000000�00000000303�13251554454�0022402�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef trunc #define trunc __clc_trunc #define __CLC_FUNCTION __clc_trunc #define __CLC_INTRINSIC "llvm.trunc" #include #undef __CLC_FUNCTION #undef __CLC_INTRINSIC �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/unary_decl.inc������������������������������������0000664�0000000�0000000�00000000107�13251554454�0023720�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/math/unary_intrin.inc����������������������������������0000664�0000000�0000000�00000002065�13251554454�0024321�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD float __CLC_FUNCTION(float f) __asm(__CLC_INTRINSIC ".f32"); _CLC_OVERLOAD float2 __CLC_FUNCTION(float2 f) __asm(__CLC_INTRINSIC ".v2f32"); _CLC_OVERLOAD float3 __CLC_FUNCTION(float3 f) __asm(__CLC_INTRINSIC ".v3f32"); _CLC_OVERLOAD float4 __CLC_FUNCTION(float4 f) __asm(__CLC_INTRINSIC ".v4f32"); _CLC_OVERLOAD float8 __CLC_FUNCTION(float8 f) __asm(__CLC_INTRINSIC ".v8f32"); _CLC_OVERLOAD float16 __CLC_FUNCTION(float16 f) __asm(__CLC_INTRINSIC ".v16f32"); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD double __CLC_FUNCTION(double d) __asm(__CLC_INTRINSIC ".f64"); _CLC_OVERLOAD double2 __CLC_FUNCTION(double2 d) __asm(__CLC_INTRINSIC ".v2f64"); _CLC_OVERLOAD double3 __CLC_FUNCTION(double3 d) __asm(__CLC_INTRINSIC ".v3f64"); _CLC_OVERLOAD double4 __CLC_FUNCTION(double4 d) __asm(__CLC_INTRINSIC ".v4f64"); _CLC_OVERLOAD double8 __CLC_FUNCTION(double8 d) __asm(__CLC_INTRINSIC ".v8f64"); _CLC_OVERLOAD double16 __CLC_FUNCTION(double16 d) __asm(__CLC_INTRINSIC ".v16f64"); #endif #undef __CLC_FUNCTION #undef __CLC_INTRINSIC ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/misc/��������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021104�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/misc/shuffle.h�����������������������������������������0000664�0000000�0000000�00000003524�13251554454�0022715�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//===-- generic/include/clc/misc/shuffle.h ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under both the University of Illinois Open Source // License and the MIT license. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #define _CLC_SHUFFLE_DECL(TYPE, MASKTYPE, RETTYPE) \ _CLC_OVERLOAD _CLC_DECL RETTYPE shuffle(TYPE x, MASKTYPE mask); //Return type is same base type as the input type, with the same vector size as the mask. //Elements in the mask must be the same size (number of bits) as the input value. //E.g. char8 ret = shuffle(char2 x, uchar8 mask); #define _CLC_VECTOR_SHUFFLE_MASKSIZE(INBASE, INTYPE, MASKTYPE) \ _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##2, INBASE##2) \ _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##4, INBASE##4) \ _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##8, INBASE##8) \ _CLC_SHUFFLE_DECL(INTYPE, MASKTYPE##16, INBASE##16) \ #define _CLC_VECTOR_SHUFFLE_INSIZE(TYPE, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##2, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##4, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##8, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, TYPE##16, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_INSIZE(char, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(short, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(int, uint) _CLC_VECTOR_SHUFFLE_INSIZE(long, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(uchar, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(ushort, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(uint, uint) _CLC_VECTOR_SHUFFLE_INSIZE(ulong, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(float, uint) #ifdef cl_khr_fp64 _CLC_VECTOR_SHUFFLE_INSIZE(double, ulong) #endif #ifdef cl_khr_fp16 _CLC_VECTOR_SHUFFLE_INSIZE(half, ushort) #endif #undef _CLC_SHUFFLE_DECL #undef _CLC_VECTOR_SHUFFLE_MASKSIZE #undef _CLC_VECTOR_SHUFFLE_INSIZE ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/misc/shuffle2.h����������������������������������������0000664�0000000�0000000�00000003600�13251554454�0022772�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//===-- generic/include/clc/misc/shuffle2.h ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under both the University of Illinois Open Source // License and the MIT license. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #define _CLC_SHUFFLE2_DECL(TYPE, MASKTYPE, RETTYPE) \ _CLC_OVERLOAD _CLC_DECL RETTYPE shuffle2(TYPE x, TYPE y, MASKTYPE mask); //Return type is same base type as the input type, with the same vector size as the mask. //Elements in the mask must be the same size (number of bits) as the input value. //E.g. char8 ret = shuffle2(char2 x, char2 y, uchar8 mask); #define _CLC_VECTOR_SHUFFLE2_MASKSIZE(INBASE, INTYPE, MASKTYPE) \ _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##2, INBASE##2) \ _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##4, INBASE##4) \ _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##8, INBASE##8) \ _CLC_SHUFFLE2_DECL(INTYPE, MASKTYPE##16, INBASE##16) \ #define _CLC_VECTOR_SHUFFLE2_INSIZE(TYPE, MASKTYPE) \ _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##2, MASKTYPE) \ _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##4, MASKTYPE) \ _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##8, MASKTYPE) \ _CLC_VECTOR_SHUFFLE2_MASKSIZE(TYPE, TYPE##16, MASKTYPE) \ _CLC_VECTOR_SHUFFLE2_INSIZE(char, uchar) _CLC_VECTOR_SHUFFLE2_INSIZE(short, ushort) _CLC_VECTOR_SHUFFLE2_INSIZE(int, uint) _CLC_VECTOR_SHUFFLE2_INSIZE(long, ulong) _CLC_VECTOR_SHUFFLE2_INSIZE(uchar, uchar) _CLC_VECTOR_SHUFFLE2_INSIZE(ushort, ushort) _CLC_VECTOR_SHUFFLE2_INSIZE(uint, uint) _CLC_VECTOR_SHUFFLE2_INSIZE(ulong, ulong) _CLC_VECTOR_SHUFFLE2_INSIZE(float, uint) #ifdef cl_khr_fp64 _CLC_VECTOR_SHUFFLE2_INSIZE(double, ulong) #endif #ifdef cl_khr_fp16 _CLC_VECTOR_SHUFFLE2_INSIZE(half, ushort) #endif #undef _CLC_SHUFFLE_DECL #undef _CLC_VECTOR_SHUFFLE2_MASKSIZE #undef _CLC_VECTOR_SHUFFLE2_INSIZE ��������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/��������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0022303�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/all.h���������������������������������������0000664�0000000�0000000�00000000664�13251554454�0023232�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_ALL_DECL(TYPE) \ _CLC_OVERLOAD _CLC_DECL int all(TYPE v); #define _CLC_VECTOR_ALL_DECL(TYPE) \ _CLC_ALL_DECL(TYPE) \ _CLC_ALL_DECL(TYPE##2) \ _CLC_ALL_DECL(TYPE##3) \ _CLC_ALL_DECL(TYPE##4) \ _CLC_ALL_DECL(TYPE##8) \ _CLC_ALL_DECL(TYPE##16) _CLC_VECTOR_ALL_DECL(char) _CLC_VECTOR_ALL_DECL(short) _CLC_VECTOR_ALL_DECL(int) _CLC_VECTOR_ALL_DECL(long) #undef _CLC_ALL_DECL #undef _CLC_VECTOR_ALL_DECL ����������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/any.h���������������������������������������0000664�0000000�0000000�00000000603�13251554454�0023242�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define _CLC_ANY_DECL(TYPE) \ _CLC_OVERLOAD _CLC_DECL int any(TYPE v); #define _CLC_VECTOR_ANY_DECL(TYPE) \ _CLC_ANY_DECL(TYPE) \ _CLC_ANY_DECL(TYPE##2) \ _CLC_ANY_DECL(TYPE##3) \ _CLC_ANY_DECL(TYPE##4) \ _CLC_ANY_DECL(TYPE##8) \ _CLC_ANY_DECL(TYPE##16) _CLC_VECTOR_ANY_DECL(char) _CLC_VECTOR_ANY_DECL(short) _CLC_VECTOR_ANY_DECL(int) _CLC_VECTOR_ANY_DECL(long) �����������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/binary_decl.inc�����������������������������0000664�0000000�0000000�00000000123�13251554454�0025245�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_INTN __CLC_FUNCTION(__CLC_FLOATN a, __CLC_FLOATN b); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/bitselect.h���������������������������������0000664�0000000�0000000�00000002450�13251554454�0024433�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_BODY #include #define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/bitselect.inc�������������������������������0000664�0000000�0000000�00000002322�13251554454�0024753�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE bitselect(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/floatn.inc����������������������������������0000664�0000000�0000000�00000002623�13251554454�0024264�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define __CLC_FLOATN float #define __CLC_INTN int #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN float2 #define __CLC_INTN int2 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN float3 #define __CLC_INTN int3 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN float4 #define __CLC_INTN int4 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN float8 #define __CLC_INTN int8 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN float16 #define __CLC_INTN int16 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #undef __CLC_FLOAT #undef __CLC_INT #ifdef cl_khr_fp64 #define __CLC_FLOATN double #define __CLC_INTN int #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN double2 #define __CLC_INTN long2 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN double3 #define __CLC_INTN long3 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN double4 #define __CLC_INTN long4 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN double8 #define __CLC_INTN long8 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #define __CLC_FLOATN double16 #define __CLC_INTN long16 #include __CLC_BODY #undef __CLC_INTN #undef __CLC_FLOATN #endif #undef __CLC_BODY �������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isequal.h�����������������������������������0000664�0000000�0000000�00000001122�13251554454�0024113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_ISEQUAL_DECL(TYPE, RETTYPE) \ _CLC_OVERLOAD _CLC_DECL RETTYPE isequal(TYPE x, TYPE y); #define _CLC_VECTOR_ISEQUAL_DECL(TYPE, RETTYPE) \ _CLC_ISEQUAL_DECL(TYPE##2, RETTYPE##2) \ _CLC_ISEQUAL_DECL(TYPE##3, RETTYPE##3) \ _CLC_ISEQUAL_DECL(TYPE##4, RETTYPE##4) \ _CLC_ISEQUAL_DECL(TYPE##8, RETTYPE##8) \ _CLC_ISEQUAL_DECL(TYPE##16, RETTYPE##16) _CLC_ISEQUAL_DECL(float, int) _CLC_VECTOR_ISEQUAL_DECL(float, int) #ifdef cl_khr_fp64 _CLC_ISEQUAL_DECL(double, int) _CLC_VECTOR_ISEQUAL_DECL(double, long) #endif #undef _CLC_ISEQUAL_DECL #undef _CLC_VECTOR_ISEQUAL_DEC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isfinite.h����������������������������������0000664�0000000�0000000�00000000263�13251554454�0024267�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isfinite #define __CLC_FUNCTION isfinite #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isgreater.h���������������������������������0000664�0000000�0000000�00000000266�13251554454�0024445�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isgreater #define __CLC_FUNCTION isgreater #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isgreaterequal.h����������������������������0000664�0000000�0000000�00000000300�13251554454�0025462�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isgreaterequal #define __CLC_FUNCTION isgreaterequal #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isinf.h�������������������������������������0000664�0000000�0000000�00000001122�13251554454�0023560�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define _CLC_ISINF_DECL(RET_TYPE, ARG_TYPE) \ _CLC_OVERLOAD _CLC_DECL RET_TYPE isinf(ARG_TYPE); #define _CLC_VECTOR_ISINF_DECL(RET_TYPE, ARG_TYPE) \ _CLC_ISINF_DECL(RET_TYPE##2, ARG_TYPE##2) \ _CLC_ISINF_DECL(RET_TYPE##3, ARG_TYPE##3) \ _CLC_ISINF_DECL(RET_TYPE##4, ARG_TYPE##4) \ _CLC_ISINF_DECL(RET_TYPE##8, ARG_TYPE##8) \ _CLC_ISINF_DECL(RET_TYPE##16, ARG_TYPE##16) _CLC_ISINF_DECL(int, float) _CLC_VECTOR_ISINF_DECL(int, float) #ifdef cl_khr_fp64 _CLC_ISINF_DECL(int, double) _CLC_VECTOR_ISINF_DECL(long, double) #endif #undef _CLC_ISINF_DECL #undef _CLC_VECTOR_ISINF_DECL ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isless.h������������������������������������0000664�0000000�0000000�00000000241�13251554454�0023753�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION isless #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/islessequal.h�������������������������������0000664�0000000�0000000�00000000246�13251554454�0025010�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION islessequal #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/islessgreater.h�����������������������������0000664�0000000�0000000�00000000250�13251554454�0025325�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION islessgreater #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isnan.h�������������������������������������0000664�0000000�0000000�00000001122�13251554454�0023560�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define _CLC_ISNAN_DECL(RET_TYPE, ARG_TYPE) \ _CLC_OVERLOAD _CLC_DECL RET_TYPE isnan(ARG_TYPE); #define _CLC_VECTOR_ISNAN_DECL(RET_TYPE, ARG_TYPE) \ _CLC_ISNAN_DECL(RET_TYPE##2, ARG_TYPE##2) \ _CLC_ISNAN_DECL(RET_TYPE##3, ARG_TYPE##3) \ _CLC_ISNAN_DECL(RET_TYPE##4, ARG_TYPE##4) \ _CLC_ISNAN_DECL(RET_TYPE##8, ARG_TYPE##8) \ _CLC_ISNAN_DECL(RET_TYPE##16, ARG_TYPE##16) _CLC_ISNAN_DECL(int, float) _CLC_VECTOR_ISNAN_DECL(int, float) #ifdef cl_khr_fp64 _CLC_ISNAN_DECL(int, double) _CLC_VECTOR_ISNAN_DECL(long, double) #endif #undef _CLC_ISNAN_DECL #undef _CLC_VECTOR_ISNAN_DECL ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isnormal.h����������������������������������0000664�0000000�0000000�00000000263�13251554454�0024301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isnormal #define __CLC_FUNCTION isnormal #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isnotequal.h��������������������������������0000664�0000000�0000000�00000000270�13251554454�0024637�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isnotequal #define __CLC_FUNCTION isnotequal #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isordered.h���������������������������������0000664�0000000�0000000�00000000266�13251554454�0024440�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isordered #define __CLC_FUNCTION isordered #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/isunordered.h�������������������������������0000664�0000000�0000000�00000000272�13251554454�0025000�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef isunordered #define __CLC_FUNCTION isunordered #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/select.h������������������������������������0000664�0000000�0000000�00000000532�13251554454�0023733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Duplciate these so we don't have to distribute utils.h */ #define __CLC_CONCAT(x, y) x ## y #define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y) #define __CLC_BODY #include #define __CLC_BODY #include #undef __CLC_CONCAT #undef __CLC_XCONCAT ����������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/select.inc����������������������������������0000664�0000000�0000000�00000001446�13251554454�0024262�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 #define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE) #elif __CLC_FPSIZE == 32 #define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE) #elif __CLC_FPSIZE == 16 #define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE) #endif _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z); _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z); #ifdef __CLC_FPSIZE #undef __CLC_S_GENTYPE #undef __CLC_U_GENTYPE #endif #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/signbit.h�����������������������������������0000664�0000000�0000000�00000000261�13251554454�0024112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#undef signbit #define __CLC_FUNCTION signbit #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/relational/unary_decl.inc������������������������������0000664�0000000�0000000�00000000103�13251554454�0025115�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_INTN __CLC_FUNCTION(__CLC_FLOATN x); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021417�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/clamp.h�����������������������������������������0000664�0000000�0000000�00000000230�13251554454�0022657�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/clamp.inc���������������������������������������0000664�0000000�0000000�00000000353�13251554454�0023207�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z); #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_SCALAR_GENTYPE y, __CLC_SCALAR_GENTYPE z); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/max.h�������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022353�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/max.inc�����������������������������������������0000664�0000000�0000000�00000000276�13251554454�0022704�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE max(__CLC_GENTYPE a, __CLC_GENTYPE b); #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE max(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/min.h�������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0022351�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/min.inc�����������������������������������������0000664�0000000�0000000�00000000276�13251554454�0022702�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_GENTYPE b); #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/vload.h�����������������������������������������0000664�0000000�0000000�00000004356�13251554454�0022705�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, VEC_TYPE, WIDTH, ADDR_SPACE) \ _CLC_OVERLOAD _CLC_DECL VEC_TYPE vload##SUFFIX##WIDTH(size_t offset, const ADDR_SPACE MEM_TYPE *x); #define _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, ADDR_SPACE) \ _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##2, 2, ADDR_SPACE) \ _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##3, 3, ADDR_SPACE) \ _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##4, 4, ADDR_SPACE) \ _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##8, 8, ADDR_SPACE) \ _CLC_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##16, 16, ADDR_SPACE) #define _CLC_VECTOR_VLOAD_PRIM3(SUFFIX, MEM_TYPE, PRIM_TYPE) \ _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __private) \ _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __local) \ _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __constant) \ _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __global) #define _CLC_VECTOR_VLOAD_PRIM1(PRIM_TYPE) \ _CLC_VECTOR_VLOAD_PRIM3(, PRIM_TYPE, PRIM_TYPE) // Declare vector load prototypes _CLC_VECTOR_VLOAD_PRIM1(char) _CLC_VECTOR_VLOAD_PRIM1(uchar) _CLC_VECTOR_VLOAD_PRIM1(short) _CLC_VECTOR_VLOAD_PRIM1(ushort) _CLC_VECTOR_VLOAD_PRIM1(int) _CLC_VECTOR_VLOAD_PRIM1(uint) _CLC_VECTOR_VLOAD_PRIM1(long) _CLC_VECTOR_VLOAD_PRIM1(ulong) _CLC_VECTOR_VLOAD_PRIM1(float) _CLC_VECTOR_VLOAD_PRIM3(_half, half, float) // Use suffix to declare aligned vloada_halfN _CLC_VECTOR_VLOAD_PRIM3(a_half, half, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64: enable _CLC_VECTOR_VLOAD_PRIM1(double) #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16: enable _CLC_VECTOR_VLOAD_PRIM1(half) #endif // Scalar vload_half also needs to be declared _CLC_VLOAD_DECL(_half, half, float, , __constant) _CLC_VLOAD_DECL(_half, half, float, , __global) _CLC_VLOAD_DECL(_half, half, float, , __local) _CLC_VLOAD_DECL(_half, half, float, , __private) // Scalar vloada_half is not part of the specs but CTS expects it _CLC_VLOAD_DECL(a_half, half, float, , __constant) _CLC_VLOAD_DECL(a_half, half, float, , __global) _CLC_VLOAD_DECL(a_half, half, float, , __local) _CLC_VLOAD_DECL(a_half, half, float, , __private) #undef _CLC_VLOAD_DECL #undef _CLC_VECTOR_VLOAD_DECL #undef _CLC_VECTOR_VLOAD_PRIM3 #undef _CLC_VECTOR_VLOAD_PRIM1 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/shared/vstore.h����������������������������������������0000664�0000000�0000000�00000004737�13251554454�0023125�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_VSTORE_DECL(SUFFIX, PRIM_TYPE, VEC_TYPE, WIDTH, ADDR_SPACE, RND) \ _CLC_OVERLOAD _CLC_DECL void vstore##SUFFIX##WIDTH##RND(VEC_TYPE vec, size_t offset, ADDR_SPACE PRIM_TYPE *out); #define _CLC_VECTOR_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, ADDR_SPACE, RND) \ _CLC_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##2, 2, ADDR_SPACE, RND) \ _CLC_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##3, 3, ADDR_SPACE, RND) \ _CLC_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##4, 4, ADDR_SPACE, RND) \ _CLC_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##8, 8, ADDR_SPACE, RND) \ _CLC_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE##16, 16, ADDR_SPACE, RND) #define _CLC_VECTOR_VSTORE_PRIM3(SUFFIX, MEM_TYPE, PRIM_TYPE, RND) \ _CLC_VECTOR_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __private, RND) \ _CLC_VECTOR_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __local, RND) \ _CLC_VECTOR_VSTORE_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __global, RND) #define _CLC_VECTOR_VSTORE_PRIM1(PRIM_TYPE) \ _CLC_VECTOR_VSTORE_PRIM3(,PRIM_TYPE, PRIM_TYPE, ) #define _CLC_VECTOR_VSTORE_HALF_PRIM1(PRIM_TYPE, RND) \ _CLC_VSTORE_DECL(_half, half, PRIM_TYPE, , __private, RND) \ _CLC_VSTORE_DECL(_half, half, PRIM_TYPE, , __local, RND) \ _CLC_VSTORE_DECL(_half, half, PRIM_TYPE, , __global, RND) \ _CLC_VECTOR_VSTORE_PRIM3(_half, half, PRIM_TYPE, RND) \ _CLC_VSTORE_DECL(a_half, half, PRIM_TYPE, , __private, RND) \ _CLC_VSTORE_DECL(a_half, half, PRIM_TYPE, , __local, RND) \ _CLC_VSTORE_DECL(a_half, half, PRIM_TYPE, , __global, RND) \ _CLC_VECTOR_VSTORE_PRIM3(a_half, half, PRIM_TYPE, RND) _CLC_VECTOR_VSTORE_PRIM1(char) _CLC_VECTOR_VSTORE_PRIM1(uchar) _CLC_VECTOR_VSTORE_PRIM1(short) _CLC_VECTOR_VSTORE_PRIM1(ushort) _CLC_VECTOR_VSTORE_PRIM1(int) _CLC_VECTOR_VSTORE_PRIM1(uint) _CLC_VECTOR_VSTORE_PRIM1(long) _CLC_VECTOR_VSTORE_PRIM1(ulong) _CLC_VECTOR_VSTORE_PRIM1(float) _CLC_VECTOR_VSTORE_HALF_PRIM1(float,) _CLC_VECTOR_VSTORE_HALF_PRIM1(float, _rtz) _CLC_VECTOR_VSTORE_HALF_PRIM1(float, _rtn) _CLC_VECTOR_VSTORE_HALF_PRIM1(float, _rtp) _CLC_VECTOR_VSTORE_HALF_PRIM1(float, _rte) #ifdef cl_khr_fp64 _CLC_VECTOR_VSTORE_PRIM1(double) _CLC_VECTOR_VSTORE_HALF_PRIM1(double,) _CLC_VECTOR_VSTORE_HALF_PRIM1(double, _rtz) _CLC_VECTOR_VSTORE_HALF_PRIM1(double, _rtn) _CLC_VECTOR_VSTORE_HALF_PRIM1(double, _rtp) _CLC_VECTOR_VSTORE_HALF_PRIM1(double, _rte) #endif #ifdef cl_khr_fp16 _CLC_VECTOR_VSTORE_PRIM1(half) #endif #undef _CLC_VSTORE_DECL #undef _CLC_VECTOR_VSTORE_DECL #undef _CLC_VECTOR_VSTORE_PRIM3 #undef _CLC_VECTOR_VSTORE_PRIM1 ���������������������������������libclc-0.2.0+git20180312/generic/include/clc/synchronization/���������������������������������������0000775�0000000�0000000�00000000000�13251554454�0023412�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/synchronization/barrier.h������������������������������0000664�0000000�0000000�00000000062�13251554454�0025207�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL void barrier(cl_mem_fence_flags flags); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/synchronization/cl_mem_fence_flags.h�������������������0000664�0000000�0000000�00000000137�13251554454�0027334�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������typedef uint cl_mem_fence_flags; #define CLK_LOCAL_MEM_FENCE 1 #define CLK_GLOBAL_MEM_FENCE 2 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/����������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0022012�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_global_id.h�������������������������������0000664�0000000�0000000�00000000052�13251554454�0024733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_global_id(uint dim); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_global_offset.h���������������������������0000664�0000000�0000000�00000000056�13251554454�0025631�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_global_offset(uint dim); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_global_size.h�����������������������������0000664�0000000�0000000�00000000054�13251554454�0025313�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_global_size(uint dim); ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_group_id.h��������������������������������0000664�0000000�0000000�00000000051�13251554454�0024626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_group_id(uint dim); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_local_id.h��������������������������������0000664�0000000�0000000�00000000051�13251554454�0024564�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_local_id(uint dim); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_local_size.h������������������������������0000664�0000000�0000000�00000000053�13251554454�0025144�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_local_size(uint dim); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_num_groups.h������������������������������0000664�0000000�0000000�00000000053�13251554454�0025216�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL size_t get_num_groups(uint dim); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/clc/workitem/get_work_dim.h��������������������������������0000664�0000000�0000000�00000000043�13251554454�0024632�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DECL uint get_work_dim(void); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/config.h���������������������������������������������������0000664�0000000�0000000�00000002460�13251554454�0021030�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_DECL bool __clc_subnormals_disabled(); _CLC_DECL bool __clc_fp16_subnormals_supported(); _CLC_DECL bool __clc_fp32_subnormals_supported(); _CLC_DECL bool __clc_fp64_subnormals_supported(); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/integer/���������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021045�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/integer/popcount.h�����������������������������������������0000664�0000000�0000000�00000000166�13251554454�0023070�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION __clc_native_popcount #define __CLC_INTRINSIC "llvm.ctpop" #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/integer/unary_intrin.inc�����������������������������������0000664�0000000�0000000�00000001752�13251554454�0024266�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_INTRINSIC_DEF(SCALAR_TYPE, BIT_SIZE) \ _CLC_OVERLOAD SCALAR_TYPE __CLC_FUNCTION(SCALAR_TYPE x) __asm(__CLC_INTRINSIC ".i" BIT_SIZE); \ _CLC_OVERLOAD SCALAR_TYPE##2 __CLC_FUNCTION(SCALAR_TYPE##2 x) __asm(__CLC_INTRINSIC ".v2i" BIT_SIZE); \ _CLC_OVERLOAD SCALAR_TYPE##3 __CLC_FUNCTION(SCALAR_TYPE##3 x) __asm(__CLC_INTRINSIC ".v3i" BIT_SIZE); \ _CLC_OVERLOAD SCALAR_TYPE##4 __CLC_FUNCTION(SCALAR_TYPE##4 x) __asm(__CLC_INTRINSIC ".v4i" BIT_SIZE); \ _CLC_OVERLOAD SCALAR_TYPE##8 __CLC_FUNCTION(SCALAR_TYPE##8 x) __asm(__CLC_INTRINSIC ".v8i" BIT_SIZE); \ _CLC_OVERLOAD SCALAR_TYPE##16 __CLC_FUNCTION(SCALAR_TYPE##16 x) __asm(__CLC_INTRINSIC ".v16i" BIT_SIZE); __CLC_INTRINSIC_DEF(char, "8") __CLC_INTRINSIC_DEF(uchar, "8") __CLC_INTRINSIC_DEF(short, "16") __CLC_INTRINSIC_DEF(ushort, "16") __CLC_INTRINSIC_DEF(int, "32") __CLC_INTRINSIC_DEF(uint, "32") __CLC_INTRINSIC_DEF(long, "64") __CLC_INTRINSIC_DEF(ulong, "64") #undef __CLC_FUNCTION #undef __CLC_INTRINSIC #undef __CLC_INTRINSIC_DEF ����������������������libclc-0.2.0+git20180312/generic/include/math/������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020341�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_ldexp.h�������������������������������������������0000664�0000000�0000000�00000000273�13251554454�0022451�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_DEF _CLC_OVERLOAD float __clc_ldexp(float, int); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEF _CLC_OVERLOAD double __clc_ldexp(double, int); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_nextafter.h���������������������������������������0000664�0000000�0000000�00000000237�13251554454�0023335�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #define __CLC_FUNCTION __clc_nextafter #include #undef __CLC_BODY #undef __CLC_FUNCTION �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_pow.h���������������������������������������������0000664�0000000�0000000�00000000232�13251554454�0022135�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION __clc_pow #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_pown.h��������������������������������������������0000664�0000000�0000000�00000000131�13251554454�0022311�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_pown.inc������������������������������������������0000664�0000000�0000000�00000000121�13251554454�0022632�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_pown(__CLC_GENTYPE a, __CLC_INTN b); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_powr.h��������������������������������������������0000664�0000000�0000000�00000000233�13251554454�0022320�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION __clc_powr #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_rootn.h�������������������������������������������0000664�0000000�0000000�00000000132�13251554454�0022470�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_BODY #include #undef __CLC_BODY ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_rootn.inc�����������������������������������������0000664�0000000�0000000�00000000122�13251554454�0023011�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_rootn(__CLC_GENTYPE a, __CLC_INTN b); ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_sqrt.h��������������������������������������������0000664�0000000�0000000�00000002420�13251554454�0022322�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #endif #define __CLC_BODY #include #undef __CLC_BODY ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_sqrt.inc������������������������������������������0000664�0000000�0000000�00000002261�13251554454�0022647�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_sqrt(__CLC_GENTYPE a); �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_tan.h���������������������������������������������0000664�0000000�0000000�00000000226�13251554454�0022115�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION __clc_tan #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/math/clc_tanpi.h�������������������������������������������0000664�0000000�0000000�00000000230�13251554454�0022441�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_FUNCTION __clc_tanpi #define __CLC_BODY #include #undef __CLC_BODY #undef __CLC_FUNCTION ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/include/utils.h����������������������������������������������������0000664�0000000�0000000�00000000304�13251554454�0020716�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef __CLC_UTILS_H_ #define __CLC_UTILS_H_ #define __CLC_CONCAT(x, y) x ## y #define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y) #define __CLC_STR(x) #x #define __CLC_XSTR(x) __CLC_STR(x) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/���������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0016533�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/SOURCES��������������������������������������������������������0000664�0000000�0000000�00000010611�13251554454�0017600�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������subnormal_config.cl subnormal_helper_func.ll async/async_work_group_copy.cl async/async_work_group_strided_copy.cl async/prefetch.cl async/wait_group_events.cl atomic/atomic_add.cl atomic/atomic_and.cl atomic/atomic_cmpxchg.cl atomic/atomic_max.cl atomic/atomic_min.cl atomic/atomic_or.cl atomic/atomic_sub.cl atomic/atomic_xor.cl atomic/atomic_xchg.cl cl_khr_global_int32_base_atomics/atom_add.cl cl_khr_global_int32_base_atomics/atom_cmpxchg.cl cl_khr_global_int32_base_atomics/atom_dec.cl cl_khr_global_int32_base_atomics/atom_inc.cl cl_khr_global_int32_base_atomics/atom_sub.cl cl_khr_global_int32_base_atomics/atom_xchg.cl cl_khr_global_int32_extended_atomics/atom_and.cl cl_khr_global_int32_extended_atomics/atom_max.cl cl_khr_global_int32_extended_atomics/atom_min.cl cl_khr_global_int32_extended_atomics/atom_or.cl cl_khr_global_int32_extended_atomics/atom_xor.cl cl_khr_local_int32_base_atomics/atom_add.cl cl_khr_local_int32_base_atomics/atom_cmpxchg.cl cl_khr_local_int32_base_atomics/atom_dec.cl cl_khr_local_int32_base_atomics/atom_inc.cl cl_khr_local_int32_base_atomics/atom_sub.cl cl_khr_local_int32_base_atomics/atom_xchg.cl cl_khr_local_int32_extended_atomics/atom_and.cl cl_khr_local_int32_extended_atomics/atom_max.cl cl_khr_local_int32_extended_atomics/atom_min.cl cl_khr_local_int32_extended_atomics/atom_or.cl cl_khr_local_int32_extended_atomics/atom_xor.cl cl_khr_int64_base_atomics/atom_add.cl cl_khr_int64_base_atomics/atom_cmpxchg.cl cl_khr_int64_base_atomics/atom_dec.cl cl_khr_int64_base_atomics/atom_inc.cl cl_khr_int64_base_atomics/atom_sub.cl cl_khr_int64_base_atomics/atom_xchg.cl cl_khr_int64_extended_atomics/atom_and.cl cl_khr_int64_extended_atomics/atom_max.cl cl_khr_int64_extended_atomics/atom_min.cl cl_khr_int64_extended_atomics/atom_or.cl cl_khr_int64_extended_atomics/atom_xor.cl convert.cl common/degrees.cl common/mix.cl common/radians.cl common/sign.cl common/smoothstep.cl common/step.cl geometric/cross.cl geometric/distance.cl geometric/dot.cl geometric/fast_distance.cl geometric/fast_length.cl geometric/fast_normalize.cl geometric/length.cl geometric/normalize.cl integer/abs.cl integer/abs_diff.cl integer/add_sat.cl integer/clz.cl integer/hadd.cl integer/mad24.cl integer/mad_sat.cl integer/mul24.cl integer/mul_hi.cl integer/popcount.cl integer/rhadd.cl integer/rotate.cl integer/sub_sat.cl integer/upsample.cl math/acos.cl math/acosh.cl math/acospi.cl math/asin.cl math/asinh.cl math/asinpi.cl math/atan.cl math/atan2.cl math/atan2pi.cl math/atanh.cl math/atanpi.cl math/cbrt.cl math/copysign.cl math/cos.cl math/cosh.cl math/cospi.cl math/ep_log.cl math/erf.cl math/erfc.cl math/exp.cl math/exp_helper.cl math/expm1.cl math/exp2.cl math/exp10.cl math/fdim.cl math/fmax.cl math/fmin.cl math/fmod.cl math/fract.cl math/frexp.cl math/half_cos.cl math/half_divide.cl math/half_exp.cl math/half_exp10.cl math/half_exp2.cl math/half_log.cl math/half_log10.cl math/half_log2.cl math/half_powr.cl math/half_recip.cl math/half_rsqrt.cl math/half_sin.cl math/half_sqrt.cl math/half_tan.cl math/hypot.cl math/ilogb.cl math/clc_ldexp.cl math/ldexp.cl math/lgamma.cl math/lgamma_r.cl math/log.cl math/log10.cl math/log1p.cl math/log2.cl math/logb.cl math/mad.cl math/maxmag.cl math/minmag.cl math/modf.cl math/nan.cl math/native_cos.cl math/native_divide.cl math/native_exp.cl math/native_exp10.cl math/native_exp2.cl math/native_log.cl math/native_log10.cl math/native_log2.cl math/native_powr.cl math/native_recip.cl math/native_rsqrt.cl math/native_sin.cl math/native_sqrt.cl math/native_tan.cl math/tables.cl math/clc_nextafter.cl math/nextafter.cl math/clc_pow.cl math/pow.cl math/clc_pown.cl math/pown.cl math/clc_powr.cl math/powr.cl math/clc_rootn.cl math/rootn.cl math/sin.cl math/sincos.cl math/sincos_helpers.cl math/sinh.cl math/sinpi.cl math/clc_sqrt.cl math/sqrt.cl math/clc_tan.cl math/tan.cl math/tanh.cl math/clc_tanpi.cl math/tanpi.cl math/tgamma.cl misc/shuffle.cl misc/shuffle2.cl relational/all.cl relational/any.cl relational/bitselect.cl relational/isequal.cl relational/isfinite.cl relational/isgreater.cl relational/isgreaterequal.cl relational/isinf.cl relational/isless.cl relational/islessequal.cl relational/islessgreater.cl relational/isnan.cl relational/isnormal.cl relational/isnotequal.cl relational/isordered.cl relational/isunordered.cl relational/select.cl relational/signbit.cl shared/clamp.cl shared/max.cl shared/min.cl shared/vload.cl shared/vstore.cl workitem/get_global_id.cl workitem/get_global_size.cl �����������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/���������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017650�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/async_work_group_copy.cl���������������������������������0000664�0000000�0000000�00000000146�13251554454�0024616�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/async_work_group_copy.inc��������������������������������0000664�0000000�0000000�00000000751�13251554454�0024773�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF event_t async_work_group_copy( local __CLC_GENTYPE *dst, const global __CLC_GENTYPE *src, size_t num_gentypes, event_t event) { return async_work_group_strided_copy(dst, src, num_gentypes, 1, event); } _CLC_OVERLOAD _CLC_DEF event_t async_work_group_copy( global __CLC_GENTYPE *dst, const local __CLC_GENTYPE *src, size_t num_gentypes, event_t event) { return async_work_group_strided_copy(dst, src, num_gentypes, 1, event); } �����������������������libclc-0.2.0+git20180312/generic/lib/async/async_work_group_strided_copy.cl�������������������������0000664�0000000�0000000�00000000156�13251554454�0026335�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/async_work_group_strided_copy.inc������������������������0000664�0000000�0000000�00000002335�13251554454�0026511�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #define STRIDED_COPY(dst, src, num_gentypes, dst_stride, src_stride) \ size_t size = get_local_size(0) * get_local_size(1) * get_local_size(2); \ size_t id = (get_local_size(1) * get_local_size(2) * get_local_id(0)) + \ (get_local_size(2) * get_local_id(1)) + \ get_local_id(2); \ size_t i; \ \ for (i = id; i < num_gentypes; i += size) { \ dst[i * dst_stride] = src[i * src_stride]; \ } _CLC_OVERLOAD _CLC_DEF event_t async_work_group_strided_copy( local __CLC_GENTYPE *dst, const global __CLC_GENTYPE *src, size_t num_gentypes, size_t src_stride, event_t event) { STRIDED_COPY(dst, src, num_gentypes, 1, src_stride); return event; } _CLC_OVERLOAD _CLC_DEF event_t async_work_group_strided_copy( global __CLC_GENTYPE *dst, const local __CLC_GENTYPE *src, size_t num_gentypes, size_t dst_stride, event_t event) { STRIDED_COPY(dst, src, num_gentypes, dst_stride, 1); return event; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/prefetch.cl����������������������������������������������0000664�0000000�0000000�00000000131�13251554454�0021763�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/prefetch.inc���������������������������������������������0000664�0000000�0000000�00000000135�13251554454�0022142�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF void prefetch(const global __CLC_GENTYPE *p, size_t num_gentypes) { } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/async/wait_group_events.cl�������������������������������������0000664�0000000�0000000�00000000226�13251554454�0023734�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF void wait_group_events(int num_events, event_t *event_list) { barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/��������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020007�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_add.cl�������������������������������������������0000664�0000000�0000000�00000000411�13251554454�0022407�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_add(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_add(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_and.cl�������������������������������������������0000664�0000000�0000000�00000000411�13251554454�0022421�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_and(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_and(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_cmpxchg.cl���������������������������������������0000664�0000000�0000000�00000000443�13251554454�0023315�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_cmpxchg(volatile AS TYPE *p, TYPE cmp, TYPE val) { \ return __sync_val_compare_and_swap(p, cmp, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_max.cl�������������������������������������������0000664�0000000�0000000�00000000444�13251554454�0022452�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS, OP) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_max(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_##OP(p, val); \ } IMPL(int, global, max) IMPL(unsigned int, global, umax) IMPL(int, local, max) IMPL(unsigned int, local, umax) #undef IMPL ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_min.cl�������������������������������������������0000664�0000000�0000000�00000000444�13251554454�0022450�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS, OP) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_min(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_##OP(p, val); \ } IMPL(int, global, min) IMPL(unsigned int, global, umin) IMPL(int, local, min) IMPL(unsigned int, local, umin) #undef IMPL ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_or.cl��������������������������������������������0000664�0000000�0000000�00000000407�13251554454�0022304�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_or(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_or(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_sub.cl�������������������������������������������0000664�0000000�0000000�00000000411�13251554454�0022450�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_sub(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_sub(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_xchg.cl������������������������������������������0000664�0000000�0000000�00000001071�13251554454�0022613�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_OVERLOAD _CLC_DEF float atomic_xchg(volatile global float *p, float val) { return as_float(atomic_xchg((volatile global uint *)p, as_uint(val))); } _CLC_OVERLOAD _CLC_DEF float atomic_xchg(volatile local float *p, float val) { return as_float(atomic_xchg((volatile local uint *)p, as_uint(val))); } #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_xchg(volatile AS TYPE *p, TYPE val) { \ return __sync_swap_4(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/atomic/atomic_xor.cl�������������������������������������������0000664�0000000�0000000�00000000411�13251554454�0022467�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE atomic_xor(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_xor(p, val); \ } IMPL(int, global) IMPL(unsigned int, global) IMPL(int, local) IMPL(unsigned int, local) #undef IMPL �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/������������������������������0000775�0000000�0000000�00000000000�13251554454�0025045�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_add.cl�������������������0000664�0000000�0000000�00000000255�13251554454�0027137�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_add(global TYPE *p, TYPE val) { \ return atomic_add(p, val); \ } IMPL(int) IMPL(unsigned int) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl���������������0000664�0000000�0000000�00000000304�13251554454�0030033�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(global TYPE *p, TYPE cmp, TYPE val) { \ return atomic_cmpxchg(p, cmp, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl�������������������0000664�0000000�0000000�00000000245�13251554454�0027141�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(global TYPE *p) { \ return atom_sub(p, (TYPE)1); \ } IMPL(int) IMPL(unsigned int) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl�������������������0000664�0000000�0000000�00000000245�13251554454�0027157�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(global TYPE *p) { \ return atom_add(p, (TYPE)1); \ } IMPL(int) IMPL(unsigned int) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_sub.cl�������������������0000664�0000000�0000000�00000000255�13251554454�0027200�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_sub(global TYPE *p, TYPE val) { \ return atomic_sub(p, val); \ } IMPL(int) IMPL(unsigned int) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_base_atomics/atom_xchg.cl������������������0000664�0000000�0000000�00000000257�13251554454�0027342�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(global TYPE *p, TYPE val) { \ return atomic_xchg(p, val); \ } IMPL(int) IMPL(unsigned int) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/��������������������������0000775�0000000�0000000�00000000000�13251554454�0025733�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/atom_and.cl���������������0000664�0000000�0000000�00000000254�13251554454�0030036�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_and(global TYPE *p, TYPE val) { \ return atomic_and(p, val); \ } IMPL(int) IMPL(unsigned int)����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/atom_max.cl���������������0000664�0000000�0000000�00000000255�13251554454�0030062�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_max(global TYPE *p, TYPE val) { \ return atomic_max(p, val); \ } IMPL(int) IMPL(unsigned int) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/atom_min.cl���������������0000664�0000000�0000000�00000000255�13251554454�0030060�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_min(global TYPE *p, TYPE val) { \ return atomic_min(p, val); \ } IMPL(int) IMPL(unsigned int) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/atom_or.cl����������������0000664�0000000�0000000�00000000253�13251554454�0027713�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_or(global TYPE *p, TYPE val) { \ return atomic_or(p, val); \ } IMPL(int) IMPL(unsigned int) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_global_int32_extended_atomics/atom_xor.cl���������������0000664�0000000�0000000�00000000255�13251554454�0030105�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xor(global TYPE *p, TYPE val) { \ return atomic_xor(p, val); \ } IMPL(int) IMPL(unsigned int) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/�������������������������������������0000775�0000000�0000000�00000000000�13251554454�0023532�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_add.cl��������������������������0000664�0000000�0000000�00000000467�13251554454�0025631�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_add(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_add_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_cmpxchg.cl����������������������0000664�0000000�0000000�00000000521�13251554454�0026521�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile AS TYPE *p, TYPE cmp, TYPE val) { \ return __sync_val_compare_and_swap_8(p, cmp, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_dec.cl��������������������������0000664�0000000�0000000�00000000443�13251554454�0025626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile AS TYPE *p) { \ return atom_sub(p, (TYPE)1); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_inc.cl��������������������������0000664�0000000�0000000�00000000443�13251554454�0025644�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile AS TYPE *p) { \ return atom_add(p, (TYPE)1); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_sub.cl��������������������������0000664�0000000�0000000�00000000467�13251554454�0025672�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_sub(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_sub_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_base_atomics/atom_xchg.cl�������������������������0000664�0000000�0000000�00000000457�13251554454�0026031�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_base_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(volatile AS TYPE *p, TYPE val) { \ return __sync_swap_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/���������������������������������0000775�0000000�0000000�00000000000�13251554454�0024420�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/atom_and.cl����������������������0000664�0000000�0000000�00000000473�13251554454�0026526�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_extended_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_and(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_and_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/atom_max.cl����������������������0000664�0000000�0000000�00000001307�13251554454�0026546�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_extended_atomics unsigned long __clc__sync_fetch_and_max_local_8(volatile local long *, long); unsigned long __clc__sync_fetch_and_max_global_8(volatile global long *, long); unsigned long __clc__sync_fetch_and_umax_local_8(volatile local unsigned long *, unsigned long); unsigned long __clc__sync_fetch_and_umax_global_8(volatile global unsigned long *, unsigned long); #define IMPL(AS, TYPE, OP) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_max(volatile AS TYPE *p, TYPE val) { \ return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ } IMPL(global, long, max) IMPL(global, unsigned long, umax) IMPL(local, long, max) IMPL(local, unsigned long, umax) #undef IMPL #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/atom_min.cl����������������������0000664�0000000�0000000�00000001307�13251554454�0026544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_extended_atomics unsigned long __clc__sync_fetch_and_min_local_8(volatile local long *, long); unsigned long __clc__sync_fetch_and_min_global_8(volatile global long *, long); unsigned long __clc__sync_fetch_and_umin_local_8(volatile local unsigned long *, unsigned long); unsigned long __clc__sync_fetch_and_umin_global_8(volatile global unsigned long *, unsigned long); #define IMPL(AS, TYPE, OP) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_min(volatile AS TYPE *p, TYPE val) { \ return __clc__sync_fetch_and_##OP##_##AS##_8(p, val); \ } IMPL(global, long, min) IMPL(global, unsigned long, umin) IMPL(local, long, min) IMPL(local, unsigned long, umin) #undef IMPL #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/atom_or.cl�����������������������0000664�0000000�0000000�00000000471�13251554454�0026402�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_extended_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_or(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_or_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_int64_extended_atomics/atom_xor.cl����������������������0000664�0000000�0000000�00000000473�13251554454�0026574�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #ifdef cl_khr_int64_extended_atomics #define IMPL(AS, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xor(volatile AS TYPE *p, TYPE val) { \ return __sync_fetch_and_xor_8(p, val); \ } IMPL(global, long) IMPL(global, unsigned long) IMPL(local, long) IMPL(local, unsigned long) #undef IMPL #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/�������������������������������0000775�0000000�0000000�00000000000�13251554454�0024677�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl��������������������0000664�0000000�0000000�00000000254�13251554454�0026770�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_add(local TYPE *p, TYPE val) { \ return atomic_add(p, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl����������������0000664�0000000�0000000�00000000303�13251554454�0027664�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(local TYPE *p, TYPE cmp, TYPE val) { \ return atomic_cmpxchg(p, cmp, val); \ } IMPL(int) IMPL(unsigned int) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl��������������������0000664�0000000�0000000�00000000244�13251554454�0026772�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \ return atom_sub(p, (TYPE)1); \ } IMPL(int) IMPL(unsigned int) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl��������������������0000664�0000000�0000000�00000000244�13251554454�0027010�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \ return atom_add(p, (TYPE)1); \ } IMPL(int) IMPL(unsigned int) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl��������������������0000664�0000000�0000000�00000000254�13251554454�0027031�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_sub(local TYPE *p, TYPE val) { \ return atomic_sub(p, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_base_atomics/atom_xchg.cl�������������������0000664�0000000�0000000�00000000256�13251554454�0027173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xchg(local TYPE *p, TYPE val) { \ return atomic_xchg(p, val); \ } IMPL(int) IMPL(unsigned int) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/���������������������������0000775�0000000�0000000�00000000000�13251554454�0025565�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/atom_and.cl����������������0000664�0000000�0000000�00000000253�13251554454�0027667�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_and(local TYPE *p, TYPE val) { \ return atomic_and(p, val); \ } IMPL(int) IMPL(unsigned int)�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/atom_max.cl����������������0000664�0000000�0000000�00000000254�13251554454�0027713�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_max(local TYPE *p, TYPE val) { \ return atomic_max(p, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/atom_min.cl����������������0000664�0000000�0000000�00000000254�13251554454�0027711�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_min(local TYPE *p, TYPE val) { \ return atomic_min(p, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/atom_or.cl�����������������0000664�0000000�0000000�00000000252�13251554454�0027544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_or(local TYPE *p, TYPE val) { \ return atomic_or(p, val); \ } IMPL(int) IMPL(unsigned int) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/cl_khr_local_int32_extended_atomics/atom_xor.cl����������������0000664�0000000�0000000�00000000254�13251554454�0027736�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define IMPL(TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE atom_xor(local TYPE *p, TYPE val) { \ return atomic_xor(p, val); \ } IMPL(int) IMPL(unsigned int) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/clc_unary.inc��������������������������������������������������0000664�0000000�0000000�00000000142�13251554454�0021202�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x) { return __CLC_IMPL_FUNC(x); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/clcmacro.h�����������������������������������������������������0000664�0000000�0000000�00000014624�13251554454�0020476�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \ return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \ return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \ return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \ return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \ return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \ } #define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \ return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \ return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \ FUNCTION(x.z, y.z)); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \ return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \ return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \ return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \ } #define _CLC_V_S_V_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE x, ARG2_TYPE##2 y) { \ return (RET_TYPE##2)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE x, ARG2_TYPE##3 y) { \ return (RET_TYPE##3)(FUNCTION(x, y.x), FUNCTION(x, y.y), \ FUNCTION(x, y.z)); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE x, ARG2_TYPE##4 y) { \ return (RET_TYPE##4)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE x, ARG2_TYPE##8 y) { \ return (RET_TYPE##8)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE x, ARG2_TYPE##16 y) { \ return (RET_TYPE##16)(FUNCTION(x, y.lo), FUNCTION(x, y.hi)); \ } \ \ #define _CLC_TERNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y, ARG3_TYPE##2 z) { \ return (RET_TYPE##2)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y)); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y, ARG3_TYPE##3 z) { \ return (RET_TYPE##3)(FUNCTION(x.x, y.x, z.x), FUNCTION(x.y, y.y, z.y), \ FUNCTION(x.z, y.z, z.z)); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y, ARG3_TYPE##4 z) { \ return (RET_TYPE##4)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y, ARG3_TYPE##8 z) { \ return (RET_TYPE##8)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y, ARG3_TYPE##16 z) { \ return (RET_TYPE##16)(FUNCTION(x.lo, y.lo, z.lo), FUNCTION(x.hi, y.hi, z.hi)); \ } #define _CLC_V_S_S_V_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE x, ARG2_TYPE y, ARG3_TYPE##2 z) { \ return (RET_TYPE##2)(FUNCTION(x, y, z.lo), FUNCTION(x, y, z.hi)); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE x, ARG2_TYPE y, ARG3_TYPE##3 z) { \ return (RET_TYPE##3)(FUNCTION(x, y, z.x), FUNCTION(x, y, z.y), \ FUNCTION(x, y, z.z)); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE x, ARG2_TYPE y, ARG3_TYPE##4 z) { \ return (RET_TYPE##4)(FUNCTION(x, y, z.lo), FUNCTION(x, y, z.hi)); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE x, ARG2_TYPE y, ARG3_TYPE##8 z) { \ return (RET_TYPE##8)(FUNCTION(x, y, z.lo), FUNCTION(x, y, z.hi)); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE x, ARG2_TYPE y, ARG3_TYPE##16 z) { \ return (RET_TYPE##16)(FUNCTION(x, y, z.lo), FUNCTION(x, y, z.hi)); \ } \ \ #define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ADDR_SPACE, ARG2_TYPE) \ DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ADDR_SPACE ARG2_TYPE##2 *y) { \ return (RET_TYPE##2)( \ FUNCTION(x.x, (ARG2_TYPE*)y), \ FUNCTION(x.y, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+1)) \ ); \ } \ \ DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ADDR_SPACE ARG2_TYPE##3 *y) { \ return (RET_TYPE##3)( \ FUNCTION(x.x, (ARG2_TYPE*)y), \ FUNCTION(x.y, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+1)), \ FUNCTION(x.z, (ADDR_SPACE ARG2_TYPE*)((ADDR_SPACE ARG2_TYPE*)y+2)) \ ); \ } \ \ DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ADDR_SPACE ARG2_TYPE##4 *y) { \ return (RET_TYPE##4)( \ FUNCTION(x.lo, (ARG2_TYPE##2*)y), \ FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##2*)((ADDR_SPACE ARG2_TYPE*)y+2)) \ ); \ } \ \ DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ADDR_SPACE ARG2_TYPE##8 *y) { \ return (RET_TYPE##8)( \ FUNCTION(x.lo, (ARG2_TYPE##4*)y), \ FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##4*)((ADDR_SPACE ARG2_TYPE*)y+4)) \ ); \ } \ \ DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ADDR_SPACE ARG2_TYPE##16 *y) { \ return (RET_TYPE##16)( \ FUNCTION(x.lo, (ARG2_TYPE##8*)y), \ FUNCTION(x.hi, (ADDR_SPACE ARG2_TYPE##8*)((ADDR_SPACE ARG2_TYPE*)y+8)) \ ); \ } #define _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \ return BUILTIN(x, y); \ } \ _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) #define _CLC_DEFINE_BINARY_BUILTIN_WITH_SCALAR_SECOND_ARG(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \ _CLC_DEFINE_BINARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE, ARG2_TYPE) \ _CLC_BINARY_VECTORIZE_SCALAR_SECOND_ARG(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) #define _CLC_DEFINE_UNARY_BUILTIN(RET_TYPE, FUNCTION, BUILTIN, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x) { \ return BUILTIN(x); \ } \ _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, RET_TYPE, FUNCTION, ARG1_TYPE) ������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/��������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020023�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/degrees.cl����������������������������������������������0000664�0000000�0000000�00000003335�13251554454�0021765�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float degrees(float radians) { // 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F return 0x1.ca5dc2p+5F * radians; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, degrees, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double degrees(double radians) { // 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F return 0x1.ca5dc1a63c1f8p+5 * radians; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, degrees, double); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/mix.cl��������������������������������������������������0000664�0000000�0000000�00000000123�13251554454�0021134�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/mix.inc�������������������������������������������������0000664�0000000�0000000�00000000451�13251554454�0021313�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE mix(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE a) { return mad( y - x, a, x ); } #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE mix(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_SCALAR_GENTYPE a) { return mix(x, y, (__CLC_GENTYPE)a); } #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/radians.cl����������������������������������������������0000664�0000000�0000000�00000003333�13251554454�0021766�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float radians(float degrees) { // pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F return 0x1.1df46ap-6F * degrees; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, radians, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double radians(double degrees) { // pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F return 0x1.1df46a2529d39p-6 * degrees; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, radians, double); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/sign.cl�������������������������������������������������0000664�0000000�0000000�00000001074�13251554454�0021305�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" #define SIGN(TYPE, F) \ _CLC_DEF _CLC_OVERLOAD TYPE sign(TYPE x) { \ if (isnan(x)) { \ return 0.0F; \ } \ if (x > 0.0F) { \ return 1.0F; \ } \ if (x < 0.0F) { \ return -1.0F; \ } \ return x; /* -0.0 or +0.0 */ \ } SIGN(float, f) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, sign, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable SIGN(double, ) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sign, double) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/smoothstep.cl�������������������������������������������0000664�0000000�0000000�00000004372�13251554454�0022556�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float smoothstep(float edge0, float edge1, float x) { float t = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); return t * t * (3.0f - 2.0f * t); } _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, float); _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define SMOOTH_STEP_DEF(edge_type, x_type, impl) \ _CLC_OVERLOAD _CLC_DEF x_type smoothstep(edge_type edge0, edge_type edge1, x_type x) { \ double t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); \ return t * t * (3.0 - 2.0 * t); \ } SMOOTH_STEP_DEF(double, double, SMOOTH_STEP_IMPL_D); _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, double, double); SMOOTH_STEP_DEF(float, double, SMOOTH_STEP_IMPL_D); SMOOTH_STEP_DEF(double, float, SMOOTH_STEP_IMPL_D); _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, float, float, double); _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, double, double, float); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/common/step.cl�������������������������������������������������0000664�0000000�0000000�00000003754�13251554454�0021327�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float step(float edge, float x) { return x < edge ? 0.0f : 1.0f; } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, float, float); _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define STEP_DEF(edge_type, x_type) \ _CLC_OVERLOAD _CLC_DEF x_type step(edge_type edge, x_type x) { \ return x < edge ? 0.0 : 1.0; \ } STEP_DEF(double, double); _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double); _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double); STEP_DEF(float, double); STEP_DEF(double, float); _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, float, double); _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, double, float); #endif ��������������������libclc-0.2.0+git20180312/generic/lib/gen_convert.py�������������������������������������������������0000664�0000000�0000000�00000032567�13251554454�0021433�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env python3 # OpenCL built-in library: type conversion functions # # Copyright (c) 2013 Victor Oliveira # Copyright (c) 2013 Jesse Towner # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # This script generates the file convert_type.cl, which contains all of the # OpenCL functions in the form: # # convert_<_sat><_roundingMode>() types = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float', 'double'] int_types = ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long', 'ulong'] unsigned_types = ['uchar', 'ushort', 'uint', 'ulong'] float_types = ['float', 'double'] int64_types = ['long', 'ulong'] float64_types = ['double'] vector_sizes = ['', '2', '3', '4', '8', '16'] half_sizes = [('2',''), ('4','2'), ('8','4'), ('16','8')] saturation = ['','_sat'] rounding_modes = ['_rtz','_rte','_rtp','_rtn'] float_prefix = {'float':'FLT_', 'double':'DBL_'} float_suffix = {'float':'f', 'double':''} bool_type = {'char' : 'char', 'uchar' : 'char', 'short' : 'short', 'ushort': 'short', 'int' : 'int', 'uint' : 'int', 'long' : 'long', 'ulong' : 'long', 'float' : 'int', 'double' : 'long'} unsigned_type = {'char' : 'uchar', 'uchar' : 'uchar', 'short' : 'ushort', 'ushort': 'ushort', 'int' : 'uint', 'uint' : 'uint', 'long' : 'ulong', 'ulong' : 'ulong'} sizeof_type = {'char' : 1, 'uchar' : 1, 'short' : 2, 'ushort' : 2, 'int' : 4, 'uint' : 4, 'long' : 8, 'ulong' : 8, 'float' : 4, 'double' : 8} limit_max = {'char' : 'CHAR_MAX', 'uchar' : 'UCHAR_MAX', 'short' : 'SHRT_MAX', 'ushort': 'USHRT_MAX', 'int' : 'INT_MAX', 'uint' : 'UINT_MAX', 'long' : 'LONG_MAX', 'ulong' : 'ULONG_MAX'} limit_min = {'char' : 'CHAR_MIN', 'uchar' : '0', 'short' : 'SHRT_MIN', 'ushort': '0', 'int' : 'INT_MIN', 'uint' : '0', 'long' : 'LONG_MIN', 'ulong' : '0'} def conditional_guard(src, dst): int64_count = 0 float64_count = 0 if src in int64_types: int64_count = int64_count +1 elif src in float64_types: float64_count = float64_count + 1 if dst in int64_types: int64_count = int64_count +1 elif dst in float64_types: float64_count = float64_count + 1 if float64_count > 0: #In embedded profile, if cl_khr_fp64 is supported cles_khr_int64 has to be print("#ifdef cl_khr_fp64") return True elif int64_count > 0: print("#if defined cles_khr_int64 || !defined(__EMBEDDED_PROFILE__)") return True return False print("""/* !!!! AUTOGENERATED FILE generated by convert_type.py !!!!! DON'T CHANGE THIS FILE. MAKE YOUR CHANGES TO convert_type.py AND RUN: $ ./generate-conversion-type-cl.sh OpenCL type conversion functions Copyright (c) 2013 Victor Oliveira Copyright (c) 2013 Jesse Towner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #if defined(__EMBEDDED_PROFILE__) && !defined(cles_khr_int64) #error Embedded profile that supports cl_khr_fp64 also has to support cles_khr_int64 #endif #endif #ifdef cles_khr_int64 #pragma OPENCL EXTENSION cles_khr_int64 : enable #endif """) # # Default Conversions # # All conversions are in accordance with the OpenCL specification, # which cites the C99 conversion rules. # # Casting from floating point to integer results in conversions # with truncation, so it should be suitable for the default convert # functions. # # Conversions from integer to floating-point, and floating-point to # floating-point through casting is done with the default rounding # mode. While C99 allows dynamically changing the rounding mode # during runtime, it is not a supported feature in OpenCL according # to Section 7.1 - Rounding Modes in the OpenCL 1.2 specification. # # Therefore, we can assume for optimization purposes that the # rounding mode is fixed to round-to-nearest-even. Platform target # authors should ensure that the rounding-control registers remain # in this state, and that this invariant holds. # # Also note, even though the OpenCL specification isn't entirely # clear on this matter, we implement all rounding mode combinations # even for integer-to-integer conversions. When such a conversion # is used, the rounding mode is ignored. # def generate_default_conversion(src, dst, mode): close_conditional = conditional_guard(src, dst) # scalar conversions print("""_CLC_DEF _CLC_OVERLOAD {DST} convert_{DST}{M}({SRC} x) {{ return ({DST})x; }} """.format(SRC=src, DST=dst, M=mode)) # vector conversions, done through decomposition to components for size, half_size in half_sizes: print("""_CLC_DEF _CLC_OVERLOAD {DST}{N} convert_{DST}{N}{M}({SRC}{N} x) {{ return ({DST}{N})(convert_{DST}{H}(x.lo), convert_{DST}{H}(x.hi)); }} """.format(SRC=src, DST=dst, N=size, H=half_size, M=mode)) # 3-component vector conversions print("""_CLC_DEF _CLC_OVERLOAD {DST}3 convert_{DST}3{M}({SRC}3 x) {{ return ({DST}3)(convert_{DST}2(x.s01), convert_{DST}(x.s2)); }}""".format(SRC=src, DST=dst, M=mode)) if close_conditional: print("#endif") for src in types: for dst in types: generate_default_conversion(src, dst, '') for src in int_types: for dst in int_types: for mode in rounding_modes: generate_default_conversion(src, dst, mode) # # Saturated Conversions To Integers # # These functions are dependent on the unsaturated conversion functions # generated above, and use clamp, max, min, and select to eliminate # branching and vectorize the conversions. # # Again, as above, we allow all rounding modes for integer-to-integer # conversions with saturation. # def generate_saturated_conversion(src, dst, size): # Header close_conditional = conditional_guard(src, dst) print("""_CLC_DEF _CLC_OVERLOAD {DST}{N} convert_{DST}{N}_sat({SRC}{N} x) {{""".format(DST=dst, SRC=src, N=size)) # FIXME: This is a work around for lack of select function with # signed third argument when the first two arguments are unsigned types. # We cast to the signed type for sign-extension, then do a bitcast to # the unsigned type. if dst in unsigned_types: bool_prefix = "as_{DST}{N}(convert_{BOOL}{N}".format(DST=dst, BOOL=bool_type[dst], N=size); bool_suffix = ")" else: bool_prefix = "convert_{BOOL}{N}".format(BOOL=bool_type[dst], N=size); bool_suffix = "" # Body if src == dst: # Conversion between same types print(" return x;") elif src in float_types: # Conversion from float to int print(""" {DST}{N} y = convert_{DST}{N}(x); y = select(y, ({DST}{N}){DST_MIN}, {BP}(x < ({SRC}{N}){DST_MIN}){BS}); y = select(y, ({DST}{N}){DST_MAX}, {BP}(x > ({SRC}{N}){DST_MAX}){BS}); return y;""".format(SRC=src, DST=dst, N=size, DST_MIN=limit_min[dst], DST_MAX=limit_max[dst], BP=bool_prefix, BS=bool_suffix)) else: # Integer to integer convesion with sizeof(src) == sizeof(dst) if sizeof_type[src] == sizeof_type[dst]: if src in unsigned_types: print(" x = min(x, ({SRC}){DST_MAX});".format(SRC=src, DST_MAX=limit_max[dst])) else: print(" x = max(x, ({SRC})0);".format(SRC=src)) # Integer to integer conversion where sizeof(src) > sizeof(dst) elif sizeof_type[src] > sizeof_type[dst]: if src in unsigned_types: print(" x = min(x, ({SRC}){DST_MAX});".format(SRC=src, DST_MAX=limit_max[dst])) else: print(" x = clamp(x, ({SRC}){DST_MIN}, ({SRC}){DST_MAX});" .format(SRC=src, DST_MIN=limit_min[dst], DST_MAX=limit_max[dst])) # Integer to integer conversion where sizeof(src) < sizeof(dst) elif src not in unsigned_types and dst in unsigned_types: print(" x = max(x, ({SRC})0);".format(SRC=src)) print(" return convert_{DST}{N}(x);".format(DST=dst, N=size)) # Footer print("}") if close_conditional: print("#endif") for src in types: for dst in int_types: for size in vector_sizes: generate_saturated_conversion(src, dst, size) def generate_saturated_conversion_with_rounding(src, dst, size, mode): # Header close_conditional = conditional_guard(src, dst) # Body print("""_CLC_DEF _CLC_OVERLOAD {DST}{N} convert_{DST}{N}_sat{M}({SRC}{N} x) {{ return convert_{DST}{N}_sat(x); }} """.format(DST=dst, SRC=src, N=size, M=mode)) # Footer if close_conditional: print("#endif") for src in int_types: for dst in int_types: for size in vector_sizes: for mode in rounding_modes: generate_saturated_conversion_with_rounding(src, dst, size, mode) # # Conversions To/From Floating-Point With Rounding # # Note that we assume as above that casts from floating-point to # integer are done with truncation, and that the default rounding # mode is fixed to round-to-nearest-even, as per C99 and OpenCL # rounding rules. # # These functions rely on the use of abs, ceil, fabs, floor, # nextafter, sign, rint and the above generated conversion functions. # # Only conversions to integers can have saturation. # def generate_float_conversion(src, dst, size, mode, sat): # Header close_conditional = conditional_guard(src, dst) print("""_CLC_DEF _CLC_OVERLOAD {DST}{N} convert_{DST}{N}{S}{M}({SRC}{N} x) {{""".format(SRC=src, DST=dst, N=size, M=mode, S=sat)) # Perform conversion if dst in int_types: if mode == '_rte': print(" x = rint(x);"); elif mode == '_rtp': print(" x = ceil(x);"); elif mode == '_rtn': print(" x = floor(x);"); print(" return convert_{DST}{N}{S}(x);".format(DST=dst, N=size, S=sat)) elif mode == '_rte': print(" return convert_{DST}{N}(x);".format(DST=dst, N=size)) else: print(" {DST}{N} r = convert_{DST}{N}(x);".format(DST=dst, N=size)) print(" {SRC}{N} y = convert_{SRC}{N}(y);".format(SRC=src, N=size)) if mode == '_rtz': if src in int_types: print(" {USRC}{N} abs_x = abs(x);".format(USRC=unsigned_type[src], N=size)) print(" {USRC}{N} abs_y = abs(y);".format(USRC=unsigned_type[src], N=size)) else: print(" {SRC}{N} abs_x = fabs(x);".format(SRC=src, N=size)) print(" {SRC}{N} abs_y = fabs(y);".format(SRC=src, N=size)) print(" return select(r, nextafter(r, sign(r) * ({DST}{N})-INFINITY), convert_{BOOL}{N}(abs_y > abs_x));" .format(DST=dst, N=size, BOOL=bool_type[dst])) if mode == '_rtp': print(" return select(r, nextafter(r, ({DST}{N})INFINITY), convert_{BOOL}{N}(y < x));" .format(DST=dst, N=size, BOOL=bool_type[dst])) if mode == '_rtn': print(" return select(r, nextafter(r, ({DST}{N})-INFINITY), convert_{BOOL}{N}(y > x));" .format(DST=dst, N=size, BOOL=bool_type[dst])) # Footer print("}") if close_conditional: print("#endif") for src in float_types: for dst in int_types: for size in vector_sizes: for mode in rounding_modes: for sat in saturation: generate_float_conversion(src, dst, size, mode, sat) for src in types: for dst in float_types: for size in vector_sizes: for mode in rounding_modes: generate_float_conversion(src, dst, size, mode, '') �����������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/�����������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020511�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/cross.cl���������������������������������������������0000664�0000000�0000000�00000001426�13251554454�0022165�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_OVERLOAD _CLC_DEF float3 cross(float3 p0, float3 p1) { return (float3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z, p0.x*p1.y - p0.y*p1.x); } _CLC_OVERLOAD _CLC_DEF float4 cross(float4 p0, float4 p1) { return (float4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z, p0.x*p1.y - p0.y*p1.x, 0.f); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double3 cross(double3 p0, double3 p1) { return (double3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z, p0.x*p1.y - p0.y*p1.x); } _CLC_OVERLOAD _CLC_DEF double4 cross(double4 p0, double4 p1) { return (double4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z, p0.x*p1.y - p0.y*p1.x, 0.f); } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/distance.cl������������������������������������������0000664�0000000�0000000�00000002317�13251554454�0022626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/distance.inc�����������������������������������������0000664�0000000�0000000�00000002337�13251554454�0023003�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DEF __CLC_FLOAT distance(__CLC_FLOATN p0, __CLC_FLOATN p1) { return length(p0 - p1); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/dot.cl�����������������������������������������������0000664�0000000�0000000�00000001560�13251554454�0021621�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_OVERLOAD _CLC_DEF float dot(float p0, float p1) { return p0*p1; } _CLC_OVERLOAD _CLC_DEF float dot(float2 p0, float2 p1) { return p0.x*p1.x + p0.y*p1.y; } _CLC_OVERLOAD _CLC_DEF float dot(float3 p0, float3 p1) { return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z; } _CLC_OVERLOAD _CLC_DEF float dot(float4 p0, float4 p1) { return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w; } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double dot(double p0, double p1) { return p0*p1; } _CLC_OVERLOAD _CLC_DEF double dot(double2 p0, double2 p1) { return p0.x*p1.x + p0.y*p1.y; } _CLC_OVERLOAD _CLC_DEF double dot(double3 p0, double3 p1) { return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z; } _CLC_OVERLOAD _CLC_DEF double dot(double4 p0, double4 p1) { return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/fast_distance.cl�������������������������������������0000664�0000000�0000000�00000002375�13251554454�0023647�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #define __CLC_BODY #define __FLOAT_ONLY #include #undef __FLOAT_ONLY �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/fast_distance.inc������������������������������������0000664�0000000�0000000�00000002351�13251554454�0024014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DEF __CLC_FLOAT fast_distance(__CLC_FLOATN p0, __CLC_FLOATN p1) { return fast_length(p0 - p1); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/fast_length.cl���������������������������������������0000664�0000000�0000000�00000002721�13251554454�0023331�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include _CLC_OVERLOAD _CLC_DEF float fast_length(float p) { return fabs(p); } _CLC_OVERLOAD _CLC_DEF float fast_length(float2 p) { return half_sqrt(dot(p, p)); } _CLC_OVERLOAD _CLC_DEF float fast_length(float3 p) { return half_sqrt(dot(p, p)); } _CLC_OVERLOAD _CLC_DEF float fast_length(float4 p) { return half_sqrt(dot(p, p)); } �����������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/fast_normalize.cl������������������������������������0000664�0000000�0000000�00000002517�13251554454�0024053�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include _CLC_OVERLOAD _CLC_DEF float fast_normalize(float p) { return normalize(p); } #define __CLC_BODY #define __FLOAT_ONLY #include #undef __FLOAT_ONLY ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/fast_normalize.inc�����������������������������������0000664�0000000�0000000�00000002512�13251554454�0024221�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef __CLC_SCALAR // Only handle vector implementations _CLC_OVERLOAD _CLC_DEF __CLC_FLOATN fast_normalize(__CLC_FLOATN p) { __CLC_FLOAT l2 = dot(p, p); return l2 == 0.0f ? p : p * half_rsqrt(l2); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/length.cl��������������������������������������������0000664�0000000�0000000�00000005336�13251554454�0022321�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include _CLC_OVERLOAD _CLC_DEF float length(float p) { return fabs(p); } #define V_FLENGTH(p) \ float l2 = dot(p, p); \ \ if (l2 < FLT_MIN) { \ p *= 0x1.0p+86F; \ return sqrt(dot(p, p)) * 0x1.0p-86F; \ } else if (l2 == INFINITY) { \ p *= 0x1.0p-65F; \ return sqrt(dot(p, p)) * 0x1.0p+65F; \ } \ \ return sqrt(l2); _CLC_OVERLOAD _CLC_DEF float length(float2 p) { V_FLENGTH(p); } _CLC_OVERLOAD _CLC_DEF float length(float3 p) { V_FLENGTH(p); } _CLC_OVERLOAD _CLC_DEF float length(float4 p) { V_FLENGTH(p); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double length(double p){ return fabs(p); } #define V_DLENGTH(p) \ double l2 = dot(p, p); \ \ if (l2 < DBL_MIN) { \ p *= 0x1.0p+563; \ return sqrt(dot(p, p)) * 0x1.0p-563; \ } else if (l2 == INFINITY) { \ p *= 0x1.0p-513; \ return sqrt(dot(p, p)) * 0x1.0p+513; \ } \ \ return sqrt(l2); _CLC_OVERLOAD _CLC_DEF double length(double2 p) { V_DLENGTH(p); } _CLC_OVERLOAD _CLC_DEF double length(double3 p) { V_DLENGTH(p); } _CLC_OVERLOAD _CLC_DEF double length(double4 p) { V_DLENGTH(p); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/geometric/normalize.cl�����������������������������������������0000664�0000000�0000000�00000007411�13251554454�0023034�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include _CLC_OVERLOAD _CLC_DEF float normalize(float p) { return sign(p); } _CLC_OVERLOAD _CLC_DEF float2 normalize(float2 p) { if (all(p == (float2)0.0F)) return p; float l2 = dot(p, p); if (l2 < FLT_MIN) { p *= 0x1.0p+86F; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-65f; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((float2)0.0F, (float2)1.0F, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } _CLC_OVERLOAD _CLC_DEF float3 normalize(float3 p) { if (all(p == (float3)0.0F)) return p; float l2 = dot(p, p); if (l2 < FLT_MIN) { p *= 0x1.0p+86F; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-66f; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((float3)0.0F, (float3)1.0F, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } _CLC_OVERLOAD _CLC_DEF float4 normalize(float4 p) { if (all(p == (float4)0.0F)) return p; float l2 = dot(p, p); if (l2 < FLT_MIN) { p *= 0x1.0p+86F; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-66f; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((float4)0.0F, (float4)1.0F, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double normalize(double p) { return sign(p); } _CLC_OVERLOAD _CLC_DEF double2 normalize(double2 p) { if (all(p == (double2)0.0)) return p; double l2 = dot(p, p); if (l2 < DBL_MIN) { p *= 0x1.0p+563; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-513; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((double2)0.0, (double2)1.0, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } _CLC_OVERLOAD _CLC_DEF double3 normalize(double3 p) { if (all(p == (double3)0.0)) return p; double l2 = dot(p, p); if (l2 < DBL_MIN) { p *= 0x1.0p+563; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-514; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((double3)0.0, (double3)1.0, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } _CLC_OVERLOAD _CLC_DEF double4 normalize(double4 p) { if (all(p == (double4)0.0)) return p; double l2 = dot(p, p); if (l2 < DBL_MIN) { p *= 0x1.0p+563; l2 = dot(p, p); } else if (l2 == INFINITY) { p *= 0x1.0p-514; l2 = dot(p, p); if (l2 == INFINITY) { p = copysign(select((double4)0.0, (double4)1.0, isinf(p)), p); l2 = dot(p, p); } } return p * rsqrt(l2); } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/�������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020170�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/abs.cl�������������������������������������������������0000664�0000000�0000000�00000000126�13251554454�0021254�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/abs.inc������������������������������������������������0000664�0000000�0000000�00000000236�13251554454�0021431�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs(__CLC_GENTYPE x) { return __builtin_astype((__CLC_GENTYPE)(x > (__CLC_GENTYPE)(0) ? x : -x), __CLC_U_GENTYPE); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/abs_diff.cl��������������������������������������������0000664�0000000�0000000�00000000133�13251554454�0022242�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/abs_diff.inc�������������������������������������������0000664�0000000�0000000�00000000246�13251554454�0022422�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y) { return __builtin_astype((__CLC_GENTYPE)(x > y ? x-y : y-x), __CLC_U_GENTYPE); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/add_sat.cl���������������������������������������������0000664�0000000�0000000�00000004412�13251554454�0022110�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" // From add_sat.ll _CLC_DECL char __clc_add_sat_s8(char, char); _CLC_DECL uchar __clc_add_sat_u8(uchar, uchar); _CLC_DECL short __clc_add_sat_s16(short, short); _CLC_DECL ushort __clc_add_sat_u16(ushort, ushort); _CLC_DECL int __clc_add_sat_s32(int, int); _CLC_DECL uint __clc_add_sat_u32(uint, uint); _CLC_DECL long __clc_add_sat_s64(long, long); _CLC_DECL ulong __clc_add_sat_u64(ulong, ulong); _CLC_OVERLOAD _CLC_DEF char add_sat(char x, char y) { short r = x + y; return convert_char_sat(r); } _CLC_OVERLOAD _CLC_DEF uchar add_sat(uchar x, uchar y) { ushort r = x + y; return convert_uchar_sat(r); } _CLC_OVERLOAD _CLC_DEF short add_sat(short x, short y) { int r = x + y; return convert_short_sat(r); } _CLC_OVERLOAD _CLC_DEF ushort add_sat(ushort x, ushort y) { uint r = x + y; return convert_ushort_sat(r); } _CLC_OVERLOAD _CLC_DEF int add_sat(int x, int y) { int r; if (__builtin_sadd_overflow(x, y, &r)) // The oveflow can only occur if both are pos or both are neg, // thus we only need to check one operand return x > 0 ? INT_MAX : INT_MIN; return r; } _CLC_OVERLOAD _CLC_DEF uint add_sat(uint x, uint y) { uint r; if (__builtin_uadd_overflow(x, y, &r)) return UINT_MAX; return r; } _CLC_OVERLOAD _CLC_DEF long add_sat(long x, long y) { long r; if (__builtin_saddl_overflow(x, y, &r)) // The oveflow can only occur if both are pos or both are neg, // thus we only need to check one operand return x > 0 ? LONG_MAX : LONG_MIN; return r; } _CLC_OVERLOAD _CLC_DEF ulong add_sat(ulong x, ulong y) { ulong r; if (__builtin_uaddl_overflow(x, y, &r)) return ULONG_MAX; return r; } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, add_sat, char, char) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, add_sat, uchar, uchar) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, add_sat, short, short) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, add_sat, ushort, ushort) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, add_sat, int, int) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, add_sat, uint, uint) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, add_sat, long, long) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, add_sat, ulong, ulong) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/clz.cl�������������������������������������������������0000664�0000000�0000000�00000002264�13251554454�0021304�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF char clz(char x) { return clz((ushort)(uchar)x) - 8; } _CLC_OVERLOAD _CLC_DEF uchar clz(uchar x) { return clz((ushort)x) - 8; } _CLC_OVERLOAD _CLC_DEF short clz(short x) { return x ? __builtin_clzs(x) : 16; } _CLC_OVERLOAD _CLC_DEF ushort clz(ushort x) { return x ? __builtin_clzs(x) : 16; } _CLC_OVERLOAD _CLC_DEF int clz(int x) { return x ? __builtin_clz(x) : 32; } _CLC_OVERLOAD _CLC_DEF uint clz(uint x) { return x ? __builtin_clz(x) : 32; } _CLC_OVERLOAD _CLC_DEF long clz(long x) { return x ? __builtin_clzl(x) : 64; } _CLC_OVERLOAD _CLC_DEF ulong clz(ulong x) { return x ? __builtin_clzl(x) : 64; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, clz, char) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, clz, uchar) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, clz, short) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, clz, ushort) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, clz, int) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, clz, uint) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, clz, long) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, clz, ulong) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/hadd.cl������������������������������������������������0000664�0000000�0000000�00000000127�13251554454�0021410�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/hadd.inc�����������������������������������������������0000664�0000000�0000000�00000000514�13251554454�0021563�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//hadd = (x+y)>>1 //This can be simplified to x>>1 + y>>1 + (1 if both x and y have the 1s bit set) //This saves us having to do any checks for overflow in the addition sum _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE hadd(__CLC_GENTYPE x, __CLC_GENTYPE y) { return (x>>(__CLC_GENTYPE)1)+(y>>(__CLC_GENTYPE)1)+(x&y&(__CLC_GENTYPE)1); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mad24.cl�����������������������������������������������0000664�0000000�0000000�00000000140�13251554454�0021412�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mad24.inc����������������������������������������������0000664�0000000�0000000�00000000173�13251554454�0021573�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE mad24(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z){ return mul24(x, y) + z; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mad_sat.cl���������������������������������������������0000664�0000000�0000000�00000005154�13251554454�0022125�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF char mad_sat(char x, char y, char z) { return clamp((short)mad24((short)x, (short)y, (short)z), (short)CHAR_MIN, (short) CHAR_MAX); } _CLC_OVERLOAD _CLC_DEF uchar mad_sat(uchar x, uchar y, uchar z) { return clamp((ushort)mad24((ushort)x, (ushort)y, (ushort)z), (ushort)0, (ushort) UCHAR_MAX); } _CLC_OVERLOAD _CLC_DEF short mad_sat(short x, short y, short z) { return clamp((int)mad24((int)x, (int)y, (int)z), (int)SHRT_MIN, (int) SHRT_MAX); } _CLC_OVERLOAD _CLC_DEF ushort mad_sat(ushort x, ushort y, ushort z) { return clamp((uint)mad24((uint)x, (uint)y, (uint)z), (uint)0, (uint) USHRT_MAX); } _CLC_OVERLOAD _CLC_DEF int mad_sat(int x, int y, int z) { int mhi = mul_hi(x, y); uint mlo = x * y; long m = upsample(mhi, mlo); m += z; if (m > INT_MAX) return INT_MAX; if (m < INT_MIN) return INT_MIN; return m; } _CLC_OVERLOAD _CLC_DEF uint mad_sat(uint x, uint y, uint z) { if (mul_hi(x, y) != 0) return UINT_MAX; return add_sat(x * y, z); } _CLC_OVERLOAD _CLC_DEF long mad_sat(long x, long y, long z) { long hi = mul_hi(x, y); ulong ulo = x * y; long slo = x * y; /* Big overflow of more than 2 bits, add can't fix this */ if (((x < 0) == (y < 0)) && hi != 0) return LONG_MAX; /* Low overflow in mul and z not neg enough to correct it */ if (hi == 0 && ulo >= LONG_MAX && (z > 0 || (ulo + z) > LONG_MAX)) return LONG_MAX; /* Big overflow of more than 2 bits, add can't fix this */ if (((x < 0) != (y < 0)) && hi != -1) return LONG_MIN; /* Low overflow in mul and z not pos enough to correct it */ if (hi == -1 && ulo <= ((ulong)LONG_MAX + 1UL) && (z < 0 || z < (LONG_MAX - ulo))) return LONG_MIN; /* We have checked all conditions, any overflow in addition returns * the correct value */ return ulo + z; } _CLC_OVERLOAD _CLC_DEF ulong mad_sat(ulong x, ulong y, ulong z) { if (mul_hi(x, y) != 0) return ULONG_MAX; return add_sat(x * y, z); } _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, mad_sat, char, char, char) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, mad_sat, uchar, uchar, uchar) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, mad_sat, short, short, short) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, mad_sat, ushort, ushort, ushort) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, mad_sat, int, int, int) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, mad_sat, uint, uint, uint) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, mad_sat, long, long, long) _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, mad_sat, ulong, ulong, ulong) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mul24.cl�����������������������������������������������0000664�0000000�0000000�00000000140�13251554454�0021446�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mul24.inc����������������������������������������������0000664�0000000�0000000�00000000565�13251554454�0021634�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ // We need to use shifts here in order to mantain the sign bit for signed // integers. The compiler should optimize this to (x & 0x00FFFFFF) for // unsigned integers. #define CONVERT_TO_24BIT(x) (((x) << 8) >> 8) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE mul24(__CLC_GENTYPE x, __CLC_GENTYPE y){ return CONVERT_TO_24BIT(x) * CONVERT_TO_24BIT(y); } #undef CONVERT_TO_24BIT �������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/mul_hi.cl����������������������������������������������0000664�0000000�0000000�00000007605�13251554454�0021775�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include //For all types EXCEPT long, which is implemented separately #define __CLC_MUL_HI_IMPL(BGENTYPE, GENTYPE, GENSIZE) \ _CLC_OVERLOAD _CLC_DEF GENTYPE mul_hi(GENTYPE x, GENTYPE y){ \ return (GENTYPE)(((BGENTYPE)x * (BGENTYPE)y) >> GENSIZE); \ } \ //FOIL-based long mul_hi // // Summary: Treat mul_hi(long x, long y) as: // (a+b) * (c+d) where a and c are the high-order parts of x and y respectively // and b and d are the low-order parts of x and y. // Thinking back to algebra, we use FOIL to do the work. _CLC_OVERLOAD _CLC_DEF long mul_hi(long x, long y){ long f, o, i; ulong l; //Move the high/low halves of x/y into the lower 32-bits of variables so //that we can multiply them without worrying about overflow. long x_hi = x >> 32; long x_lo = x & UINT_MAX; long y_hi = y >> 32; long y_lo = y & UINT_MAX; //Multiply all of the components according to FOIL method f = x_hi * y_hi; o = x_hi * y_lo; i = x_lo * y_hi; l = x_lo * y_lo; //Now add the components back together in the following steps: //F: doesn't need to be modified //O/I: Need to be added together. //L: Shift right by 32-bits, then add into the sum of O and I //Once O/I/L are summed up, then shift the sum by 32-bits and add to F. // //We use hadd to give us a bit of extra precision for the intermediate sums //but as a result, we shift by 31 bits instead of 32 return (long)(f + (hadd(o, (i + (long)((ulong)l>>32))) >> 31)); } _CLC_OVERLOAD _CLC_DEF ulong mul_hi(ulong x, ulong y){ ulong f, o, i; ulong l; //Move the high/low halves of x/y into the lower 32-bits of variables so //that we can multiply them without worrying about overflow. ulong x_hi = x >> 32; ulong x_lo = x & UINT_MAX; ulong y_hi = y >> 32; ulong y_lo = y & UINT_MAX; //Multiply all of the components according to FOIL method f = x_hi * y_hi; o = x_hi * y_lo; i = x_lo * y_hi; l = x_lo * y_lo; //Now add the components back together, taking care to respect the fact that: //F: doesn't need to be modified //O/I: Need to be added together. //L: Shift right by 32-bits, then add into the sum of O and I //Once O/I/L are summed up, then shift the sum by 32-bits and add to F. // //We use hadd to give us a bit of extra precision for the intermediate sums //but as a result, we shift by 31 bits instead of 32 return (f + (hadd(o, (i + (l>>32))) >> 31)); } #define __CLC_MUL_HI_VEC(GENTYPE) \ _CLC_OVERLOAD _CLC_DEF GENTYPE##2 mul_hi(GENTYPE##2 x, GENTYPE##2 y){ \ return (GENTYPE##2){mul_hi(x.s0, y.s0), mul_hi(x.s1, y.s1)}; \ } \ _CLC_OVERLOAD _CLC_DEF GENTYPE##3 mul_hi(GENTYPE##3 x, GENTYPE##3 y){ \ return (GENTYPE##3){mul_hi(x.s0, y.s0), mul_hi(x.s1, y.s1), mul_hi(x.s2, y.s2)}; \ } \ _CLC_OVERLOAD _CLC_DEF GENTYPE##4 mul_hi(GENTYPE##4 x, GENTYPE##4 y){ \ return (GENTYPE##4){mul_hi(x.lo, y.lo), mul_hi(x.hi, y.hi)}; \ } \ _CLC_OVERLOAD _CLC_DEF GENTYPE##8 mul_hi(GENTYPE##8 x, GENTYPE##8 y){ \ return (GENTYPE##8){mul_hi(x.lo, y.lo), mul_hi(x.hi, y.hi)}; \ } \ _CLC_OVERLOAD _CLC_DEF GENTYPE##16 mul_hi(GENTYPE##16 x, GENTYPE##16 y){ \ return (GENTYPE##16){mul_hi(x.lo, y.lo), mul_hi(x.hi, y.hi)}; \ } \ #define __CLC_MUL_HI_DEC_IMPL(BTYPE, TYPE, BITS) \ __CLC_MUL_HI_IMPL(BTYPE, TYPE, BITS) \ __CLC_MUL_HI_VEC(TYPE) #define __CLC_MUL_HI_TYPES() \ __CLC_MUL_HI_DEC_IMPL(short, char, 8) \ __CLC_MUL_HI_DEC_IMPL(ushort, uchar, 8) \ __CLC_MUL_HI_DEC_IMPL(int, short, 16) \ __CLC_MUL_HI_DEC_IMPL(uint, ushort, 16) \ __CLC_MUL_HI_DEC_IMPL(long, int, 32) \ __CLC_MUL_HI_DEC_IMPL(ulong, uint, 32) \ __CLC_MUL_HI_VEC(long) \ __CLC_MUL_HI_VEC(ulong) __CLC_MUL_HI_TYPES() #undef __CLC_MUL_HI_TYPES #undef __CLC_MUL_HI_DEC_IMPL #undef __CLC_MUL_HI_IMPL #undef __CLC_MUL_HI_VEC #undef __CLC_B32 ���������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/popcount.cl��������������������������������������������0000664�0000000�0000000�00000000310�13251554454�0022351�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_FUNC popcount #define __CLC_IMPL_FUNC __clc_native_popcount #define __CLC_BODY "../clc_unary.inc" #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/rhadd.cl�����������������������������������������������0000664�0000000�0000000�00000000130�13251554454�0021564�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/rhadd.inc����������������������������������������������0000664�0000000�0000000�00000000547�13251554454�0021753�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//rhadd = (x+y+1)>>1 //This can be simplified to x>>1 + y>>1 + (1 if either x or y have the 1s bit set) //This saves us having to do any checks for overflow in the addition sums _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE rhadd(__CLC_GENTYPE x, __CLC_GENTYPE y) { return (x>>(__CLC_GENTYPE)1)+(y>>(__CLC_GENTYPE)1)+((x&(__CLC_GENTYPE)1)|(y&(__CLC_GENTYPE)1)); } ���������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/rotate.cl����������������������������������������������0000664�0000000�0000000�00000000131�13251554454�0022001�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/rotate.inc���������������������������������������������0000664�0000000�0000000�00000003220�13251554454�0022156�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * Not necessarily optimal... but it produces correct results (at least for int) * If we're lucky, LLVM will recognize the pattern and produce rotate * instructions: * http://llvm.1065342.n5.nabble.com/rotate-td47679.html * * Eventually, someone should feel free to implement an llvm-specific version */ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE n){ //Try to avoid extra work if someone's spinning the value through multiple //full rotations n = n % (__CLC_GENTYPE)__CLC_GENSIZE; #ifdef __CLC_SCALAR if (n > 0){ return (x << n) | (((__CLC_U_GENTYPE)x) >> (__CLC_GENSIZE - n)); } else if (n == 0){ return x; } else { return ( (((__CLC_U_GENTYPE)x) >> -n) | (x << (__CLC_GENSIZE + n)) ); } #else //XXX: There's a lot of __builtin_astype calls to cast everything to // unsigned ... This should be improved so that if __CLC_GENTYPE==__CLC_U_GENTYPE, no // casts are required. __CLC_U_GENTYPE x_1 = __builtin_astype(x, __CLC_U_GENTYPE); //XXX: Is (__CLC_U_GENTYPE >> S__CLC_GENTYPE) | (__CLC_U_GENTYPE << S__CLC_GENTYPE) legal? // If so, then combine the amt and shifts into a single set of statements __CLC_U_GENTYPE amt; amt = (n < (__CLC_GENTYPE)0 ? __builtin_astype((__CLC_GENTYPE)0-n, __CLC_U_GENTYPE) : (__CLC_U_GENTYPE)0); x_1 = (x_1 >> amt) | (x_1 << ((__CLC_U_GENTYPE)__CLC_GENSIZE - amt)); amt = (n < (__CLC_GENTYPE)0 ? (__CLC_U_GENTYPE)0 : __builtin_astype(n, __CLC_U_GENTYPE)); x_1 = (x_1 << amt) | (x_1 >> ((__CLC_U_GENTYPE)__CLC_GENSIZE - amt)); return __builtin_astype(x_1, __CLC_GENTYPE); #endif } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/sub_sat.cl���������������������������������������������0000664�0000000�0000000�00000003415�13251554454�0022153�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF char sub_sat(char x, char y) { short r = x - y; return convert_char_sat(r); } _CLC_OVERLOAD _CLC_DEF uchar sub_sat(uchar x, uchar y) { short r = x - y; return convert_uchar_sat(r); } _CLC_OVERLOAD _CLC_DEF short sub_sat(short x, short y) { int r = x - y; return convert_short_sat(r); } _CLC_OVERLOAD _CLC_DEF ushort sub_sat(ushort x, ushort y) { int r = x - y; return convert_ushort_sat(r); } _CLC_OVERLOAD _CLC_DEF int sub_sat(int x, int y) { int r; if (__builtin_ssub_overflow(x, y, &r)) // The oveflow can only occur in the direction of the first operand return x > 0 ? INT_MAX : INT_MIN; return r; } _CLC_OVERLOAD _CLC_DEF uint sub_sat(uint x, uint y) { uint r; if (__builtin_usub_overflow(x, y, &r)) return 0; return r; } _CLC_OVERLOAD _CLC_DEF long sub_sat(long x, long y) { long r; if (__builtin_ssubl_overflow(x, y, &r)) // The oveflow can only occur in the direction of the first operand return x > 0 ? LONG_MAX : LONG_MIN; return r; } _CLC_OVERLOAD _CLC_DEF ulong sub_sat(ulong x, ulong y) { ulong r; if (__builtin_usubl_overflow(x, y, &r)) return 0; return r; } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, sub_sat, char, char) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, sub_sat, uchar, uchar) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, sub_sat, short, short) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, sub_sat, ushort, ushort) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, sub_sat, int, int) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, sub_sat, uint, uint) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, sub_sat, long, long) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, sub_sat, ulong, ulong) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/integer/upsample.cl��������������������������������������������0000664�0000000�0000000�00000002746�13251554454�0022347�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_UPSAMPLE_IMPL(BGENTYPE, GENTYPE, UGENTYPE, GENSIZE) \ _CLC_OVERLOAD _CLC_DEF BGENTYPE upsample(GENTYPE hi, UGENTYPE lo){ \ return ((BGENTYPE)hi << GENSIZE) | lo; \ } \ _CLC_OVERLOAD _CLC_DEF BGENTYPE##2 upsample(GENTYPE##2 hi, UGENTYPE##2 lo){ \ return (BGENTYPE##2){upsample(hi.s0, lo.s0), upsample(hi.s1, lo.s1)}; \ } \ _CLC_OVERLOAD _CLC_DEF BGENTYPE##3 upsample(GENTYPE##3 hi, UGENTYPE##3 lo){ \ return (BGENTYPE##3){upsample(hi.s0, lo.s0), upsample(hi.s1, lo.s1), upsample(hi.s2, lo.s2)}; \ } \ _CLC_OVERLOAD _CLC_DEF BGENTYPE##4 upsample(GENTYPE##4 hi, UGENTYPE##4 lo){ \ return (BGENTYPE##4){upsample(hi.lo, lo.lo), upsample(hi.hi, lo.hi)}; \ } \ _CLC_OVERLOAD _CLC_DEF BGENTYPE##8 upsample(GENTYPE##8 hi, UGENTYPE##8 lo){ \ return (BGENTYPE##8){upsample(hi.lo, lo.lo), upsample(hi.hi, lo.hi)}; \ } \ _CLC_OVERLOAD _CLC_DEF BGENTYPE##16 upsample(GENTYPE##16 hi, UGENTYPE##16 lo){ \ return (BGENTYPE##16){upsample(hi.lo, lo.lo), upsample(hi.hi, lo.hi)}; \ } \ #define __CLC_UPSAMPLE_TYPES() \ __CLC_UPSAMPLE_IMPL(short, char, uchar, 8) \ __CLC_UPSAMPLE_IMPL(ushort, uchar, uchar, 8) \ __CLC_UPSAMPLE_IMPL(int, short, ushort, 16) \ __CLC_UPSAMPLE_IMPL(uint, ushort, ushort, 16) \ __CLC_UPSAMPLE_IMPL(long, int, uint, 32) \ __CLC_UPSAMPLE_IMPL(ulong, uint, uint, 32) \ __CLC_UPSAMPLE_TYPES() #undef __CLC_UPSAMPLE_TYPES #undef __CLC_UPSAMPLE_IMPL ��������������������������libclc-0.2.0+git20180312/generic/lib/math/����������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017464�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/acos.cl���������������������������������������������������0000664�0000000�0000000�00000000124�13251554454�0020726�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/acos.inc��������������������������������������������������0000664�0000000�0000000�00000001546�13251554454�0021112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * There are multiple formulas for calculating arccosine of x: * 1) acos(x) = (1/2*pi) + i * ln(i*x + sqrt(1-x^2)) (notice the 'i'...) * 2) acos(x) = pi/2 + asin(-x) (asin isn't implemented yet) * 3) acos(x) = pi/2 - asin(x) (ditto) * 4) acos(x) = 2*atan2(sqrt(1-x), sqrt(1+x)) * 5) acos(x) = pi/2 - atan2(x, ( sqrt(1-x^2) ) ) * * Options 1-3 are not currently usable, #5 generates more concise radeonsi * bitcode and assembly than #4 (134 vs 132 instructions on radeonsi), but * precision of #4 may be better. */ #if __CLC_FPSIZE == 32 #define __CLC_CONST(x) x ## f #else #define __CLC_CONST(x) x #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE acos(__CLC_GENTYPE x) { return ( (__CLC_GENTYPE) __CLC_CONST(2.0) * atan2( sqrt((__CLC_GENTYPE) __CLC_CONST(1.0) - x), sqrt((__CLC_GENTYPE) __CLC_CONST(1.0) + x) ) ); } #undef __CLC_CONST ����������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/acosh.cl��������������������������������������������������0000664�0000000�0000000�00000007620�13251554454�0021106�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "ep_log.h" #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float acosh(float x) { uint ux = as_uint(x); // Arguments greater than 1/sqrt(epsilon) in magnitude are // approximated by acosh(x) = ln(2) + ln(x) // For 2.0 <= x <= 1/sqrt(epsilon) the approximation is // acosh(x) = ln(x + sqrt(x*x-1)) */ int high = ux > 0x46000000U; int med = ux > 0x40000000U; float w = x - 1.0f; float s = w*w + 2.0f*w; float t = x*x - 1.0f; float r = sqrt(med ? t : s) + (med ? x : w); float v = (high ? x : r) - (med ? 1.0f : 0.0f); float z = log1p(v) + (high ? 0x1.62e430p-1f : 0.0f); z = ux >= PINFBITPATT_SP32 ? x : z; z = x < 1.0f ? as_float(QNANBITPATT_SP32) : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, acosh, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double acosh(double x) { const double recrteps = 0x1.6a09e667f3bcdp+26; // 1/sqrt(eps) = 9.49062656242515593767e+07 //log2_lead and log2_tail sum to an extra-precise version of log(2) const double log2_lead = 0x1.62e42ep-1; const double log2_tail = 0x1.efa39ef35793cp-25; // Handle x >= 128 here int xlarge = x > recrteps; double r = x + sqrt(fma(x, x, -1.0)); r = xlarge ? x : r; int xexp; double r1, r2; __clc_ep_log(r, &xexp, &r1, &r2); double dxexp = xexp + xlarge; r1 = fma(dxexp, log2_lead, r1); r2 = fma(dxexp, log2_tail, r2); double ret1 = r1 + r2; // Handle 1 < x < 128 here // We compute the value // t = x - 1.0 + sqrt(2.0*(x - 1.0) + (x - 1.0)*(x - 1.0)) // using simulated quad precision. double t = x - 1.0; double u1 = t * 2.0; // (t,0) * (t,0) -> (v1, v2) double v1 = t * t; double v2 = fma(t, t, -v1); // (u1,0) + (v1,v2) -> (w1,w2) r = u1 + v1; double s = (((u1 - r) + v1) + v2); double w1 = r + s; double w2 = (r - w1) + s; // sqrt(w1,w2) -> (u1,u2) double p1 = sqrt(w1); double a1 = p1*p1; double a2 = fma(p1, p1, -a1); double temp = (((w1 - a1) - a2) + w2); double p2 = MATH_DIVIDE(temp * 0.5, p1); u1 = p1 + p2; double u2 = (p1 - u1) + p2; // (u1,u2) + (t,0) -> (r1,r2) r = u1 + t; s = ((u1 - r) + t) + u2; // r1 = r + s; // r2 = (r - r1) + s; // t = r1 + r2; t = r + s; // For arguments 1.13 <= x <= 1.5 the log1p function is good enough double ret2 = log1p(t); ulong ux = as_ulong(x); double ret = x >= 128.0 ? ret1 : ret2; ret = ux >= 0x7FF0000000000000 ? x : ret; ret = x == 1.0 ? 0.0 : ret; ret = (ux & SIGNBIT_DP64) != 0UL | x < 1.0 ? as_double(QNANBITPATT_DP64) : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, acosh, double) #endif ����������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/acospi.cl�������������������������������������������������0000664�0000000�0000000�00000015334�13251554454�0021270�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float acospi(float x) { // Computes arccos(x). // The argument is first reduced by noting that arccos(x) // is invalid for abs(x) > 1. For denormal and small // arguments arccos(x) = pi/2 to machine accuracy. // Remaining argument ranges are handled as follows. // For abs(x) <= 0.5 use // arccos(x) = pi/2 - arcsin(x) // = pi/2 - (x + x^3*R(x^2)) // where R(x^2) is a rational minimax approximation to // (arcsin(x) - x)/x^3. // For abs(x) > 0.5 exploit the identity: // arccos(x) = pi - 2*arcsin(sqrt(1-x)/2) // together with the above rational approximation, and // reconstruct the terms carefully. // Some constants and split constants. const float pi = 3.1415926535897933e+00f; const float piby2_head = 1.5707963267948965580e+00f; /* 0x3ff921fb54442d18 */ const float piby2_tail = 6.12323399573676603587e-17f; /* 0x3c91a62633145c07 */ uint ux = as_uint(x); uint aux = ux & ~SIGNBIT_SP32; int xneg = ux != aux; int xexp = (int)(aux >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float y = as_float(aux); // transform if |x| >= 0.5 int transform = xexp >= -1; float y2 = y * y; float yt = 0.5f * (1.0f - y); float r = transform ? yt : y2; // Use a rational approximation for [0.0, 0.5] float a = mad(r, mad(r, mad(r, -0.00396137437848476485201154797087F, -0.0133819288943925804214011424456F), -0.0565298683201845211985026327361F), 0.184161606965100694821398249421F); float b = mad(r, -0.836411276854206731913362287293F, 1.10496961524520294485512696706F); float u = r * MATH_DIVIDE(a, b); float s = MATH_SQRT(r); y = s; float s1 = as_float(as_uint(s) & 0xffff0000); float c = MATH_DIVIDE(r - s1 * s1, s + s1); // float rettn = 1.0f - MATH_DIVIDE(2.0f * (s + (y * u - piby2_tail)), pi); float rettn = 1.0f - MATH_DIVIDE(2.0f * (s + mad(y, u, -piby2_tail)), pi); // float rettp = MATH_DIVIDE(2.0F * s1 + (2.0F * c + 2.0F * y * u), pi); float rettp = MATH_DIVIDE(2.0f*(s1 + mad(y, u, c)), pi); float rett = xneg ? rettn : rettp; // float ret = MATH_DIVIDE(piby2_head - (x - (piby2_tail - x * u)), pi); float ret = MATH_DIVIDE(piby2_head - (x - mad(x, -u, piby2_tail)), pi); ret = transform ? rett : ret; ret = aux > 0x3f800000U ? as_float(QNANBITPATT_SP32) : ret; ret = ux == 0x3f800000U ? 0.0f : ret; ret = ux == 0xbf800000U ? 1.0f : ret; ret = xexp < -26 ? 0.5f : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, acospi, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double acospi(double x) { // Computes arccos(x). // The argument is first reduced by noting that arccos(x) // is invalid for abs(x) > 1. For denormal and small // arguments arccos(x) = pi/2 to machine accuracy. // Remaining argument ranges are handled as follows. // For abs(x) <= 0.5 use // arccos(x) = pi/2 - arcsin(x) // = pi/2 - (x + x^3*R(x^2)) // where R(x^2) is a rational minimax approximation to // (arcsin(x) - x)/x^3. // For abs(x) > 0.5 exploit the identity: // arccos(x) = pi - 2*arcsin(sqrt(1-x)/2) // together with the above rational approximation, and // reconstruct the terms carefully. const double pi = 0x1.921fb54442d18p+1; const double piby2_tail = 6.12323399573676603587e-17; /* 0x3c91a62633145c07 */ double y = fabs(x); int xneg = as_int2(x).hi < 0; int xexp = (as_int2(y).hi >> 20) - EXPBIAS_DP64; // abs(x) >= 0.5 int transform = xexp >= -1; // Transform y into the range [0,0.5) double r1 = 0.5 * (1.0 - y); double s = sqrt(r1); double r = y * y; r = transform ? r1 : r; y = transform ? s : y; // Use a rational approximation for [0.0, 0.5] double un = fma(r, fma(r, fma(r, fma(r, fma(r, 0.0000482901920344786991880522822991, 0.00109242697235074662306043804220), -0.0549989809235685841612020091328), 0.275558175256937652532686256258), -0.445017216867635649900123110649), 0.227485835556935010735943483075); double ud = fma(r, fma(r, fma(r, fma(r, 0.105869422087204370341222318533, -0.943639137032492685763471240072), 2.76568859157270989520376345954), -3.28431505720958658909889444194), 1.36491501334161032038194214209); double u = r * MATH_DIVIDE(un, ud); // Reconstruct acos carefully in transformed region double res1 = fma(-2.0, MATH_DIVIDE(s + fma(y, u, -piby2_tail), pi), 1.0); double s1 = as_double(as_ulong(s) & 0xffffffff00000000UL); double c = MATH_DIVIDE(fma(-s1, s1, r), s + s1); double res2 = MATH_DIVIDE(fma(2.0, s1, fma(2.0, c, 2.0 * y * u)), pi); res1 = xneg ? res1 : res2; res2 = 0.5 - fma(x, u, x) / pi; res1 = transform ? res1 : res2; const double qnan = as_double(QNANBITPATT_DP64); res2 = x == 1.0 ? 0.0 : qnan; res2 = x == -1.0 ? 1.0 : res2; res1 = xexp >= 0 ? res2 : res1; res1 = xexp < -56 ? 0.5 : res1; return res1; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, acospi, double) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/asin.cl���������������������������������������������������0000664�0000000�0000000�00000000124�13251554454�0020733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/asin.inc��������������������������������������������������0000664�0000000�0000000�00000000363�13251554454�0021113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #if __CLC_FPSIZE == 32 #define __CLC_CONST(x) x ## f #else #define __CLC_CONST(x) x #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE asin(__CLC_GENTYPE x) { return atan2(x, sqrt( (__CLC_GENTYPE)__CLC_CONST(1.0) -(x*x) )); } #undef __CLC_CONST �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/asinh.cl��������������������������������������������������0000664�0000000�0000000�00000022757�13251554454�0021123�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "ep_log.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float asinh(float x) { uint ux = as_uint(x); uint ax = ux & EXSIGNBIT_SP32; uint xsgn = ax ^ ux; // |x| <= 2 float t = x * x; float a = mad(t, mad(t, mad(t, mad(t, -1.177198915954942694e-4f, -4.162727710583425360e-2f), -5.063201055468483248e-1f), -1.480204186473758321f), -1.152965835871758072f); float b = mad(t, mad(t, mad(t, mad(t, 6.284381367285534560e-2f, 1.260024978680227945f), 6.582362487198468066f), 11.99423176003939087f), 6.917795026025976739f); float q = MATH_DIVIDE(a, b); float z1 = mad(x*t, q, x); // |x| > 2 // Arguments greater than 1/sqrt(epsilon) in magnitude are // approximated by asinh(x) = ln(2) + ln(abs(x)), with sign of x // Arguments such that 4.0 <= abs(x) <= 1/sqrt(epsilon) are // approximated by asinhf(x) = ln(abs(x) + sqrt(x*x+1)) // with the sign of x (see Abramowitz and Stegun 4.6.20) float absx = as_float(ax); int hi = ax > 0x46000000U; float y = MATH_SQRT(absx * absx + 1.0f) + absx; y = hi ? absx : y; float r = log(y) + (hi ? 0x1.62e430p-1f : 0.0f); float z2 = as_float(xsgn | as_uint(r)); float z = ax <= 0x40000000 ? z1 : z2; z = ax < 0x39800000U | ax >= PINFBITPATT_SP32 ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, asinh, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define NA0 -0.12845379283524906084997e0 #define NA1 -0.21060688498409799700819e0 #define NA2 -0.10188951822578188309186e0 #define NA3 -0.13891765817243625541799e-1 #define NA4 -0.10324604871728082428024e-3 #define DA0 0.77072275701149440164511e0 #define DA1 0.16104665505597338100747e1 #define DA2 0.11296034614816689554875e1 #define DA3 0.30079351943799465092429e0 #define DA4 0.235224464765951442265117e-1 #define NB0 -0.12186605129448852495563e0 #define NB1 -0.19777978436593069928318e0 #define NB2 -0.94379072395062374824320e-1 #define NB3 -0.12620141363821680162036e-1 #define NB4 -0.903396794842691998748349e-4 #define DB0 0.73119630776696495279434e0 #define DB1 0.15157170446881616648338e1 #define DB2 0.10524909506981282725413e1 #define DB3 0.27663713103600182193817e0 #define DB4 0.21263492900663656707646e-1 #define NC0 -0.81210026327726247622500e-1 #define NC1 -0.12327355080668808750232e0 #define NC2 -0.53704925162784720405664e-1 #define NC3 -0.63106739048128554465450e-2 #define NC4 -0.35326896180771371053534e-4 #define DC0 0.48726015805581794231182e0 #define DC1 0.95890837357081041150936e0 #define DC2 0.62322223426940387752480e0 #define DC3 0.15028684818508081155141e0 #define DC4 0.10302171620320141529445e-1 #define ND0 -0.4638179204422665073e-1 #define ND1 -0.7162729496035415183e-1 #define ND2 -0.3247795155696775148e-1 #define ND3 -0.4225785421291932164e-2 #define ND4 -0.3808984717603160127e-4 #define ND5 0.8023464184964125826e-6 #define DD0 0.2782907534642231184e0 #define DD1 0.5549945896829343308e0 #define DD2 0.3700732511330698879e0 #define DD3 0.9395783438240780722e-1 #define DD4 0.7200057974217143034e-2 #define NE0 -0.121224194072430701e-4 #define NE1 -0.273145455834305218e-3 #define NE2 -0.152866982560895737e-2 #define NE3 -0.292231744584913045e-2 #define NE4 -0.174670900236060220e-2 #define NE5 -0.891754209521081538e-12 #define DE0 0.499426632161317606e-4 #define DE1 0.139591210395547054e-2 #define DE2 0.107665231109108629e-1 #define DE3 0.325809818749873406e-1 #define DE4 0.415222526655158363e-1 #define DE5 0.186315628774716763e-1 #define NF0 -0.195436610112717345e-4 #define NF1 -0.233315515113382977e-3 #define NF2 -0.645380957611087587e-3 #define NF3 -0.478948863920281252e-3 #define NF4 -0.805234112224091742e-12 #define NF5 0.246428598194879283e-13 #define DF0 0.822166621698664729e-4 #define DF1 0.135346265620413852e-2 #define DF2 0.602739242861830658e-2 #define DF3 0.972227795510722956e-2 #define DF4 0.510878800983771167e-2 #define NG0 -0.209689451648100728e-6 #define NG1 -0.219252358028695992e-5 #define NG2 -0.551641756327550939e-5 #define NG3 -0.382300259826830258e-5 #define NG4 -0.421182121910667329e-17 #define NG5 0.492236019998237684e-19 #define DG0 0.889178444424237735e-6 #define DG1 0.131152171690011152e-4 #define DG2 0.537955850185616847e-4 #define DG3 0.814966175170941864e-4 #define DG4 0.407786943832260752e-4 #define NH0 -0.178284193496441400e-6 #define NH1 -0.928734186616614974e-6 #define NH2 -0.923318925566302615e-6 #define NH3 -0.776417026702577552e-19 #define NH4 0.290845644810826014e-21 #define DH0 0.786694697277890964e-6 #define DH1 0.685435665630965488e-5 #define DH2 0.153780175436788329e-4 #define DH3 0.984873520613417917e-5 #define NI0 -0.538003743384069117e-10 #define NI1 -0.273698654196756169e-9 #define NI2 -0.268129826956403568e-9 #define NI3 -0.804163374628432850e-29 #define DI0 0.238083376363471960e-9 #define DI1 0.203579344621125934e-8 #define DI2 0.450836980450693209e-8 #define DI3 0.286005148753497156e-8 _CLC_OVERLOAD _CLC_DEF double asinh(double x) { const double rteps = 0x1.6a09e667f3bcdp-27; const double recrteps = 0x1.6a09e667f3bcdp+26; // log2_lead and log2_tail sum to an extra-precise version of log(2) const double log2_lead = 0x1.62e42ep-1; const double log2_tail = 0x1.efa39ef35793cp-25; ulong ux = as_ulong(x); ulong ax = ux & ~SIGNBIT_DP64; double absx = as_double(ax); double t = x * x; double pn, tn, pd, td; // XXX we are betting here that we can evaluate 8 pairs of // polys faster than we can grab 12 coefficients from a table // This also uses fewer registers // |x| >= 8 pn = fma(t, fma(t, fma(t, NI3, NI2), NI1), NI0); pd = fma(t, fma(t, fma(t, DI3, DI2), DI1), DI0); tn = fma(t, fma(t, fma(t, fma(t, NH4, NH3), NH2), NH1), NH0); td = fma(t, fma(t, fma(t, DH3, DH2), DH1), DH0); pn = absx < 8.0 ? tn : pn; pd = absx < 8.0 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, fma(t, NG5, NG4), NG3), NG2), NG1), NG0); td = fma(t, fma(t, fma(t, fma(t, DG4, DG3), DG2), DG1), DG0); pn = absx < 4.0 ? tn : pn; pd = absx < 4.0 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, fma(t, NF5, NF4), NF3), NF2), NF1), NF0); td = fma(t, fma(t, fma(t, fma(t, DF4, DF3), DF2), DF1), DF0); pn = absx < 2.0 ? tn : pn; pd = absx < 2.0 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, fma(t, NE5, NE4), NE3), NE2), NE1), NE0); td = fma(t, fma(t, fma(t, fma(t, fma(t, DE5, DE4), DE3), DE2), DE1), DE0); pn = absx < 1.5 ? tn : pn; pd = absx < 1.5 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, fma(t, ND5, ND4), ND3), ND2), ND1), ND0); td = fma(t, fma(t, fma(t, fma(t, DD4, DD3), DD2), DD1), DD0); pn = absx <= 1.0 ? tn : pn; pd = absx <= 1.0 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, NC4, NC3), NC2), NC1), NC0); td = fma(t, fma(t, fma(t, fma(t, DC4, DC3), DC2), DC1), DC0); pn = absx < 0.75 ? tn : pn; pd = absx < 0.75 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, NB4, NB3), NB2), NB1), NB0); td = fma(t, fma(t, fma(t, fma(t, DB4, DB3), DB2), DB1), DB0); pn = absx < 0.5 ? tn : pn; pd = absx < 0.5 ? td : pd; tn = fma(t, fma(t, fma(t, fma(t, NA4, NA3), NA2), NA1), NA0); td = fma(t, fma(t, fma(t, fma(t, DA4, DA3), DA2), DA1), DA0); pn = absx < 0.25 ? tn : pn; pd = absx < 0.25 ? td : pd; double pq = MATH_DIVIDE(pn, pd); // |x| <= 1 double result1 = fma(absx*t, pq, absx); // Other ranges int xout = absx <= 32.0 | absx > recrteps; double y = absx + sqrt(fma(absx, absx, 1.0)); y = xout ? absx : y; double r1, r2; int xexp; __clc_ep_log(y, &xexp, &r1, &r2); double dxexp = (double)(xexp + xout); r1 = fma(dxexp, log2_lead, r1); r2 = fma(dxexp, log2_tail, r2); // 1 < x <= 32 double v2 = (pq + 0.25) / t; double r = v2 + r1; double s = ((r1 - r) + v2) + r2; double v1 = r + s; v2 = (r - v1) + s; double result2 = v1 + v2; // x > 32 double result3 = r1 + r2; double ret = absx > 1.0 ? result2 : result1; ret = absx > 32.0 ? result3 : ret; ret = x < 0.0 ? -ret : ret; // NaN, +-Inf, or x small enough that asinh(x) = x ret = ax >= PINFBITPATT_DP64 | absx < rteps ? x : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, asinh, double) #endif �����������������libclc-0.2.0+git20180312/generic/lib/math/asinpi.cl�������������������������������������������������0000664�0000000�0000000�00000014375�13251554454�0021301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float asinpi(float x) { // Computes arcsin(x). // The argument is first reduced by noting that arcsin(x) // is invalid for abs(x) > 1 and arcsin(-x) = -arcsin(x). // For denormal and small arguments arcsin(x) = x to machine // accuracy. Remaining argument ranges are handled as follows. // For abs(x) <= 0.5 use // arcsin(x) = x + x^3*R(x^2) // where R(x^2) is a rational minimax approximation to // (arcsin(x) - x)/x^3. // For abs(x) > 0.5 exploit the identity: // arcsin(x) = pi/2 - 2*arcsin(sqrt(1-x)/2) // together with the above rational approximation, and // reconstruct the terms carefully. const float pi = 3.1415926535897933e+00f; const float piby2_tail = 7.5497894159e-08F; /* 0x33a22168 */ const float hpiby2_head = 7.8539812565e-01F; /* 0x3f490fda */ uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; uint xs = ux ^ aux; float shalf = as_float(xs | as_uint(0.5f)); int xexp = (int)(aux >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float y = as_float(aux); // abs(x) >= 0.5 int transform = xexp >= -1; float y2 = y * y; float rt = 0.5f * (1.0f - y); float r = transform ? rt : y2; // Use a rational approximation for [0.0, 0.5] float a = mad(r, mad(r, mad(r, -0.00396137437848476485201154797087F, -0.0133819288943925804214011424456F), -0.0565298683201845211985026327361F), 0.184161606965100694821398249421F); float b = mad(r, -0.836411276854206731913362287293F, 1.10496961524520294485512696706F); float u = r * MATH_DIVIDE(a, b); float s = MATH_SQRT(r); float s1 = as_float(as_uint(s) & 0xffff0000); float c = MATH_DIVIDE(mad(-s1, s1, r), s + s1); float p = mad(2.0f*s, u, -mad(c, -2.0f, piby2_tail)); float q = mad(s1, -2.0f, hpiby2_head); float vt = hpiby2_head - (p - q); float v = mad(y, u, y); v = transform ? vt : v; v = MATH_DIVIDE(v, pi); float xbypi = MATH_DIVIDE(x, pi); float ret = as_float(xs | as_uint(v)); ret = aux > 0x3f800000U ? as_float(QNANBITPATT_SP32) : ret; ret = aux == 0x3f800000U ? shalf : ret; ret = xexp < -14 ? xbypi : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, asinpi, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double asinpi(double x) { // Computes arcsin(x). // The argument is first reduced by noting that arcsin(x) // is invalid for abs(x) > 1 and arcsin(-x) = -arcsin(x). // For denormal and small arguments arcsin(x) = x to machine // accuracy. Remaining argument ranges are handled as follows. // For abs(x) <= 0.5 use // arcsin(x) = x + x^3*R(x^2) // where R(x^2) is a rational minimax approximation to // (arcsin(x) - x)/x^3. // For abs(x) > 0.5 exploit the identity: // arcsin(x) = pi/2 - 2*arcsin(sqrt(1-x)/2) // together with the above rational approximation, and // reconstruct the terms carefully. const double pi = 0x1.921fb54442d18p+1; const double piby2_tail = 6.1232339957367660e-17; /* 0x3c91a62633145c07 */ const double hpiby2_head = 7.8539816339744831e-01; /* 0x3fe921fb54442d18 */ double y = fabs(x); int xneg = as_int2(x).hi < 0; int xexp = (as_int2(y).hi >> 20) - EXPBIAS_DP64; // abs(x) >= 0.5 int transform = xexp >= -1; double rt = 0.5 * (1.0 - y); double y2 = y * y; double r = transform ? rt : y2; // Use a rational approximation for [0.0, 0.5] double un = fma(r, fma(r, fma(r, fma(r, fma(r, 0.0000482901920344786991880522822991, 0.00109242697235074662306043804220), -0.0549989809235685841612020091328), 0.275558175256937652532686256258), -0.445017216867635649900123110649), 0.227485835556935010735943483075); double ud = fma(r, fma(r, fma(r, fma(r, 0.105869422087204370341222318533, -0.943639137032492685763471240072), 2.76568859157270989520376345954), -3.28431505720958658909889444194), 1.36491501334161032038194214209); double u = r * MATH_DIVIDE(un, ud); // Reconstruct asin carefully in transformed region double s = sqrt(r); double sh = as_double(as_ulong(s) & 0xffffffff00000000UL); double c = MATH_DIVIDE(fma(-sh, sh, r), s + sh); double p = fma(2.0*s, u, -fma(-2.0, c, piby2_tail)); double q = fma(-2.0, sh, hpiby2_head); double vt = hpiby2_head - (p - q); double v = fma(y, u, y); v = transform ? vt : v; v = xexp < -28 ? y : v; v = MATH_DIVIDE(v, pi); v = xexp >= 0 ? as_double(QNANBITPATT_DP64) : v; v = y == 1.0 ? 0.5 : v; return xneg ? -v : v; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, asinpi, double) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/atan.cl���������������������������������������������������0000664�0000000�0000000�00000012541�13251554454�0020732�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "math.h" #include "../clcmacro.h" #include _CLC_OVERLOAD _CLC_DEF float atan(float x) { const float piby2 = 1.5707963267948966f; // 0x3ff921fb54442d18 uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; uint sx = ux ^ aux; float spiby2 = as_float(sx | as_uint(piby2)); float v = as_float(aux); // Return for NaN float ret = x; // 2^26 <= |x| <= Inf => atan(x) is close to piby2 ret = aux <= PINFBITPATT_SP32 ? spiby2 : ret; // Reduce arguments 2^-19 <= |x| < 2^26 // 39/16 <= x < 2^26 x = -MATH_RECIP(v); float c = 1.57079632679489655800f; // atan(infinity) // 19/16 <= x < 39/16 int l = aux < 0x401c0000; float xx = MATH_DIVIDE(v - 1.5f, mad(v, 1.5f, 1.0f)); x = l ? xx : x; c = l ? 9.82793723247329054082e-01f : c; // atan(1.5) // 11/16 <= x < 19/16 l = aux < 0x3f980000U; xx = MATH_DIVIDE(v - 1.0f, 1.0f + v); x = l ? xx : x; c = l ? 7.85398163397448278999e-01f : c; // atan(1) // 7/16 <= x < 11/16 l = aux < 0x3f300000; xx = MATH_DIVIDE(mad(v, 2.0f, -1.0f), 2.0f + v); x = l ? xx : x; c = l ? 4.63647609000806093515e-01f : c; // atan(0.5) // 2^-19 <= x < 7/16 l = aux < 0x3ee00000; x = l ? v : x; c = l ? 0.0f : c; // Core approximation: Remez(2,2) on [-7/16,7/16] float s = x * x; float a = mad(s, mad(s, 0.470677934286149214138357545549e-2f, 0.192324546402108583211697690500f), 0.296528598819239217902158651186f); float b = mad(s, mad(s, 0.299309699959659728404442796915f, 0.111072499995399550138837673349e1f), 0.889585796862432286486651434570f); float q = x * s * MATH_DIVIDE(a, b); float z = c - (q - x); float zs = as_float(sx | as_uint(z)); ret = aux < 0x4c800000 ? zs : ret; // |x| < 2^-19 ret = aux < 0x36000000 ? as_float(ux) : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, atan, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double atan(double x) { const double piby2 = 1.5707963267948966e+00; // 0x3ff921fb54442d18 double v = fabs(x); // 2^56 > v > 39/16 double a = -1.0; double b = v; // (chi + clo) = arctan(infinity) double chi = 1.57079632679489655800e+00; double clo = 6.12323399573676480327e-17; double ta = v - 1.5; double tb = 1.0 + 1.5 * v; int l = v <= 0x1.38p+1; // 39/16 > v > 19/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(1.5) chi = l ? 9.82793723247329054082e-01 : chi; clo = l ? 1.39033110312309953701e-17 : clo; ta = v - 1.0; tb = 1.0 + v; l = v <= 0x1.3p+0; // 19/16 > v > 11/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(1.) chi = l ? 7.85398163397448278999e-01 : chi; clo = l ? 3.06161699786838240164e-17 : clo; ta = 2.0 * v - 1.0; tb = 2.0 + v; l = v <= 0x1.6p-1; // 11/16 > v > 7/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(0.5) chi = l ? 4.63647609000806093515e-01 : chi; clo = l ? 2.26987774529616809294e-17 : clo; l = v <= 0x1.cp-2; // v < 7/16 a = l ? v : a; b = l ? 1.0 : b;; chi = l ? 0.0 : chi; clo = l ? 0.0 : clo; // Core approximation: Remez(4,4) on [-7/16,7/16] double r = a / b; double s = r * r; double qn = fma(s, fma(s, fma(s, fma(s, 0.142316903342317766e-3, 0.304455919504853031e-1), 0.220638780716667420e0), 0.447677206805497472e0), 0.268297920532545909e0); double qd = fma(s, fma(s, fma(s, fma(s, 0.389525873944742195e-1, 0.424602594203847109e0), 0.141254259931958921e1), 0.182596787737507063e1), 0.804893761597637733e0); double q = r * s * qn / qd; r = chi - ((q - clo) - r); double z = isnan(x) ? x : piby2; z = v <= 0x1.0p+56 ? r : z; z = v < 0x1.0p-26 ? v : z; return x == v ? z : -z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, atan, double); #endif // cl_khr_fp64 ���������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/atan2.cl��������������������������������������������������0000664�0000000�0000000�00000017366�13251554454�0021026�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float atan2(float y, float x) { const float pi = 0x1.921fb6p+1f; const float piby2 = 0x1.921fb6p+0f; const float piby4 = 0x1.921fb6p-1f; const float threepiby4 = 0x1.2d97c8p+1f; float ax = fabs(x); float ay = fabs(y); float v = min(ax, ay); float u = max(ax, ay); // Scale since u could be large, as in "regular" divide float s = u > 0x1.0p+96f ? 0x1.0p-32f : 1.0f; float vbyu = s * MATH_DIVIDE(v, s*u); float vbyu2 = vbyu * vbyu; #define USE_2_2_APPROXIMATION #if defined USE_2_2_APPROXIMATION float p = mad(vbyu2, mad(vbyu2, -0x1.7e1f78p-9f, -0x1.7d1b98p-3f), -0x1.5554d0p-2f) * vbyu2 * vbyu; float q = mad(vbyu2, mad(vbyu2, 0x1.1a714cp-2f, 0x1.287c56p+0f), 1.0f); #else float p = mad(vbyu2, mad(vbyu2, -0x1.55cd22p-5f, -0x1.26cf76p-2f), -0x1.55554ep-2f) * vbyu2 * vbyu; float q = mad(vbyu2, mad(vbyu2, mad(vbyu2, 0x1.9f1304p-5f, 0x1.2656fap-1f), 0x1.76b4b8p+0f), 1.0f); #endif // Octant 0 result float a = mad(p, MATH_RECIP(q), vbyu); // Fix up 3 other octants float at = piby2 - a; a = ay > ax ? at : a; at = pi - a; a = x < 0.0F ? at : a; // y == 0 => 0 for x >= 0, pi for x < 0 at = as_int(x) < 0 ? pi : 0.0f; a = y == 0.0f ? at : a; // if (!FINITE_ONLY()) { // x and y are +- Inf at = x > 0.0f ? piby4 : threepiby4; a = ax == INFINITY & ay == INFINITY ? at : a; // x or y is NaN a = isnan(x) | isnan(y) ? as_float(QNANBITPATT_SP32) : a; // } // Fixup sign and return return copysign(a, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, atan2, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double atan2(double y, double x) { const double pi = 3.1415926535897932e+00; /* 0x400921fb54442d18 */ const double piby2 = 1.5707963267948966e+00; /* 0x3ff921fb54442d18 */ const double piby4 = 7.8539816339744831e-01; /* 0x3fe921fb54442d18 */ const double three_piby4 = 2.3561944901923449e+00; /* 0x4002d97c7f3321d2 */ const double pi_head = 3.1415926218032836e+00; /* 0x400921fb50000000 */ const double pi_tail = 3.1786509547056392e-08; /* 0x3e6110b4611a6263 */ const double piby2_head = 1.5707963267948965e+00; /* 0x3ff921fb54442d18 */ const double piby2_tail = 6.1232339957367660e-17; /* 0x3c91a62633145c07 */ double x2 = x; int xneg = as_int2(x).hi < 0; int xexp = (as_int2(x).hi >> 20) & 0x7ff; double y2 = y; int yneg = as_int2(y).hi < 0; int yexp = (as_int2(y).hi >> 20) & 0x7ff; int cond2 = (xexp < 1021) & (yexp < 1021); int diffexp = yexp - xexp; // Scale up both x and y if they are both below 1/4 double x1 = ldexp(x, 1024); int xexp1 = (as_int2(x1).hi >> 20) & 0x7ff; double y1 = ldexp(y, 1024); int yexp1 = (as_int2(y1).hi >> 20) & 0x7ff; int diffexp1 = yexp1 - xexp1; diffexp = cond2 ? diffexp1 : diffexp; x = cond2 ? x1 : x; y = cond2 ? y1 : y; // General case: take absolute values of arguments double u = fabs(x); double v = fabs(y); // Swap u and v if necessary to obtain 0 < v < u. Compute v/u. int swap_vu = u < v; double uu = u; u = swap_vu ? v : u; v = swap_vu ? uu : v; double vbyu = v / u; double q1, q2; // General values of v/u. Use a look-up table and series expansion. { double val = vbyu > 0.0625 ? vbyu : 0.063; int index = convert_int(fma(256.0, val, 0.5)); double2 tv = USE_TABLE(atan_jby256_tbl, index - 16); q1 = tv.s0; q2 = tv.s1; double c = (double)index * 0x1.0p-8; // We're going to scale u and v by 2^(-u_exponent) to bring them close to 1 // u_exponent could be EMAX so we have to do it in 2 steps int m = -((int)(as_ulong(u) >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64); //double um = __amdil_ldexp_f64(u, m); //double vm = __amdil_ldexp_f64(v, m); double um = ldexp(u, m); double vm = ldexp(v, m); // 26 leading bits of u double u1 = as_double(as_ulong(um) & 0xfffffffff8000000UL); double u2 = um - u1; double r = MATH_DIVIDE(fma(-c, u2, fma(-c, u1, vm)), fma(c, vm, um)); // Polynomial approximation to atan(r) double s = r * r; q2 = q2 + fma((s * fma(-s, 0.19999918038989143496, 0.33333333333224095522)), -r, r); } double q3, q4; { q3 = 0.0; q4 = vbyu; } double q5, q6; { double u1 = as_double(as_ulong(u) & 0xffffffff00000000UL); double u2 = u - u1; double vu1 = as_double(as_ulong(vbyu) & 0xffffffff00000000UL); double vu2 = vbyu - vu1; q5 = 0.0; double s = vbyu * vbyu; q6 = vbyu + fma(-vbyu * s, fma(-s, fma(-s, fma(-s, fma(-s, 0.90029810285449784439E-01, 0.11110736283514525407), 0.14285713561807169030), 0.19999999999393223405), 0.33333333333333170500), MATH_DIVIDE(fma(-u, vu2, fma(-u2, vu1, fma(-u1, vu1, v))), u)); } q3 = vbyu < 0x1.d12ed0af1a27fp-27 ? q3 : q5; q4 = vbyu < 0x1.d12ed0af1a27fp-27 ? q4 : q6; q1 = vbyu > 0.0625 ? q1 : q3; q2 = vbyu > 0.0625 ? q2 : q4; // Tidy-up according to which quadrant the arguments lie in double res1, res2, res3, res4; q1 = swap_vu ? piby2_head - q1 : q1; q2 = swap_vu ? piby2_tail - q2 : q2; q1 = xneg ? pi_head - q1 : q1; q2 = xneg ? pi_tail - q2 : q2; q1 = q1 + q2; res4 = yneg ? -q1 : q1; res1 = yneg ? -three_piby4 : three_piby4; res2 = yneg ? -piby4 : piby4; res3 = xneg ? res1 : res2; res3 = isinf(x2) & isinf(y2) ? res3 : res4; res1 = yneg ? -pi : pi; // abs(x)/abs(y) > 2^56 and x < 0 res3 = (diffexp < -56 && xneg) ? res1 : res3; res4 = MATH_DIVIDE(y, x); // x positive and dominant over y by a factor of 2^28 res3 = diffexp < -28 & xneg == 0 ? res4 : res3; // abs(y)/abs(x) > 2^56 res4 = yneg ? -piby2 : piby2; // atan(y/x) is insignificant compared to piby2 res3 = diffexp > 56 ? res4 : res3; res3 = x2 == 0.0 ? res4 : res3; // Zero x gives +- pi/2 depending on sign of y res4 = xneg ? res1 : y2; res3 = y2 == 0.0 ? res4 : res3; // Zero y gives +-0 for positive x and +-pi for negative x res3 = isnan(y2) ? y2 : res3; res3 = isnan(x2) ? x2 : res3; return res3; } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, atan2, double, double); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/atan2pi.cl������������������������������������������������0000664�0000000�0000000�00000016120�13251554454�0021342�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float atan2pi(float y, float x) { const float pi = 0x1.921fb6p+1f; float ax = fabs(x); float ay = fabs(y); float v = min(ax, ay); float u = max(ax, ay); // Scale since u could be large, as in "regular" divide float s = u > 0x1.0p+96f ? 0x1.0p-32f : 1.0f; float vbyu = s * MATH_DIVIDE(v, s*u); float vbyu2 = vbyu * vbyu; float p = mad(vbyu2, mad(vbyu2, -0x1.7e1f78p-9f, -0x1.7d1b98p-3f), -0x1.5554d0p-2f) * vbyu2 * vbyu; float q = mad(vbyu2, mad(vbyu2, 0x1.1a714cp-2f, 0x1.287c56p+0f), 1.0f); // Octant 0 result float a = MATH_DIVIDE(mad(p, MATH_RECIP(q), vbyu), pi); // Fix up 3 other octants float at = 0.5f - a; a = ay > ax ? at : a; at = 1.0f - a; a = x < 0.0F ? at : a; // y == 0 => 0 for x >= 0, pi for x < 0 at = as_int(x) < 0 ? 1.0f : 0.0f; a = y == 0.0f ? at : a; // if (!FINITE_ONLY()) { // x and y are +- Inf at = x > 0.0f ? 0.25f : 0.75f; a = ax == INFINITY & ay == INFINITY ? at : a; // x or y is NaN a = isnan(x) | isnan(y) ? as_float(QNANBITPATT_SP32) : a; // } // Fixup sign and return return copysign(a, y); } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, atan2pi, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double atan2pi(double y, double x) { const double pi = 3.1415926535897932e+00; /* 0x400921fb54442d18 */ const double pi_head = 3.1415926218032836e+00; /* 0x400921fb50000000 */ const double pi_tail = 3.1786509547056392e-08; /* 0x3e6110b4611a6263 */ const double piby2_head = 1.5707963267948965e+00; /* 0x3ff921fb54442d18 */ const double piby2_tail = 6.1232339957367660e-17; /* 0x3c91a62633145c07 */ double x2 = x; int xneg = as_int2(x).hi < 0; int xexp = (as_int2(x).hi >> 20) & 0x7ff; double y2 = y; int yneg = as_int2(y).hi < 0; int yexp = (as_int2(y).hi >> 20) & 0x7ff; int cond2 = (xexp < 1021) & (yexp < 1021); int diffexp = yexp - xexp; // Scale up both x and y if they are both below 1/4 double x1 = ldexp(x, 1024); int xexp1 = (as_int2(x1).hi >> 20) & 0x7ff; double y1 = ldexp(y, 1024); int yexp1 = (as_int2(y1).hi >> 20) & 0x7ff; int diffexp1 = yexp1 - xexp1; diffexp = cond2 ? diffexp1 : diffexp; x = cond2 ? x1 : x; y = cond2 ? y1 : y; // General case: take absolute values of arguments double u = fabs(x); double v = fabs(y); // Swap u and v if necessary to obtain 0 < v < u. Compute v/u. int swap_vu = u < v; double uu = u; u = swap_vu ? v : u; v = swap_vu ? uu : v; double vbyu = v / u; double q1, q2; // General values of v/u. Use a look-up table and series expansion. { double val = vbyu > 0.0625 ? vbyu : 0.063; int index = convert_int(fma(256.0, val, 0.5)); double2 tv = USE_TABLE(atan_jby256_tbl, (index - 16)); q1 = tv.s0; q2 = tv.s1; double c = (double)index * 0x1.0p-8; // We're going to scale u and v by 2^(-u_exponent) to bring them close to 1 // u_exponent could be EMAX so we have to do it in 2 steps int m = -((int)(as_ulong(u) >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64); double um = ldexp(u, m); double vm = ldexp(v, m); // 26 leading bits of u double u1 = as_double(as_ulong(um) & 0xfffffffff8000000UL); double u2 = um - u1; double r = MATH_DIVIDE(fma(-c, u2, fma(-c, u1, vm)), fma(c, vm, um)); // Polynomial approximation to atan(r) double s = r * r; q2 = q2 + fma((s * fma(-s, 0.19999918038989143496, 0.33333333333224095522)), -r, r); } double q3, q4; { q3 = 0.0; q4 = vbyu; } double q5, q6; { double u1 = as_double(as_ulong(u) & 0xffffffff00000000UL); double u2 = u - u1; double vu1 = as_double(as_ulong(vbyu) & 0xffffffff00000000UL); double vu2 = vbyu - vu1; q5 = 0.0; double s = vbyu * vbyu; q6 = vbyu + fma(-vbyu * s, fma(-s, fma(-s, fma(-s, fma(-s, 0.90029810285449784439E-01, 0.11110736283514525407), 0.14285713561807169030), 0.19999999999393223405), 0.33333333333333170500), MATH_DIVIDE(fma(-u, vu2, fma(-u2, vu1, fma(-u1, vu1, v))), u)); } q3 = vbyu < 0x1.d12ed0af1a27fp-27 ? q3 : q5; q4 = vbyu < 0x1.d12ed0af1a27fp-27 ? q4 : q6; q1 = vbyu > 0.0625 ? q1 : q3; q2 = vbyu > 0.0625 ? q2 : q4; // Tidy-up according to which quadrant the arguments lie in double res1, res2, res3, res4; q1 = swap_vu ? piby2_head - q1 : q1; q2 = swap_vu ? piby2_tail - q2 : q2; q1 = xneg ? pi_head - q1 : q1; q2 = xneg ? pi_tail - q2 : q2; q1 = MATH_DIVIDE(q1 + q2, pi); res4 = yneg ? -q1 : q1; res1 = yneg ? -0.75 : 0.75; res2 = yneg ? -0.25 : 0.25; res3 = xneg ? res1 : res2; res3 = isinf(y2) & isinf(x2) ? res3 : res4; res1 = yneg ? -1.0 : 1.0; // abs(x)/abs(y) > 2^56 and x < 0 res3 = (diffexp < -56 && xneg) ? res1 : res3; res4 = MATH_DIVIDE(MATH_DIVIDE(y, x), pi); // x positive and dominant over y by a factor of 2^28 res3 = diffexp < -28 & xneg == 0 ? res4 : res3; // abs(y)/abs(x) > 2^56 res4 = yneg ? -0.5 : 0.5; // atan(y/x) is insignificant compared to piby2 res3 = diffexp > 56 ? res4 : res3; res3 = x2 == 0.0 ? res4 : res3; // Zero x gives +- pi/2 depending on sign of y res4 = xneg ? res1 : y2; res3 = y2 == 0.0 ? res4 : res3; // Zero y gives +-0 for positive x and +-pi for negative x res3 = isnan(y2) ? y2 : res3; res3 = isnan(x2) ? x2 : res3; return res3; } _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, atan2pi, double, double) #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/atanh.cl��������������������������������������������������0000664�0000000�0000000�00000007263�13251554454�0021107�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float atanh(float x) { uint ux = as_uint(x); uint ax = ux & EXSIGNBIT_SP32; uint xs = ux ^ ax; // |x| > 1 or NaN float z = as_float(QNANBITPATT_SP32); // |x| == 1 float t = as_float(xs | PINFBITPATT_SP32); z = ax == 0x3f800000U ? t : z; // 1/2 <= |x| < 1 t = as_float(ax); t = MATH_DIVIDE(2.0f*t, 1.0f - t); t = 0.5f * log1p(t); t = as_float(xs | as_uint(t)); z = ax < 0x3f800000U ? t : z; // |x| < 1/2 t = x * x; float a = mad(mad(0.92834212715e-2f, t, -0.28120347286e0f), t, 0.39453629046e0f); float b = mad(mad(0.45281890445e0f, t, -0.15537744551e1f), t, 0.11836088638e1f); float p = MATH_DIVIDE(a, b); t = mad(x*t, p, x); z = ax < 0x3f000000 ? t : z; // |x| < 2^-13 z = ax < 0x39000000U ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, atanh, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double atanh(double x) { double absx = fabs(x); double ret = absx == 1.0 ? as_double(PINFBITPATT_DP64) : as_double(QNANBITPATT_DP64); // |x| >= 0.5 // Note that atanh(x) = 0.5 * ln((1+x)/(1-x)) // For greater accuracy we use // ln((1+x)/(1-x)) = ln(1 + 2x/(1-x)) = log1p(2x/(1-x)). double r = 0.5 * log1p(2.0 * absx / (1.0 - absx)); ret = absx < 1.0 ? r : ret; r = -ret; ret = x < 0.0 ? r : ret; // Arguments up to 0.5 in magnitude are // approximated by a [5,5] minimax polynomial double t = x * x; double pn = fma(t, fma(t, fma(t, fma(t, fma(t, -0.10468158892753136958e-3, 0.28728638600548514553e-1), -0.28180210961780814148e0), 0.88468142536501647470e0), -0.11028356797846341457e1), 0.47482573589747356373e0); double pd = fma(t, fma(t, fma(t, fma(t, fma(t, -0.35861554370169537512e-1, 0.49561196555503101989e0), -0.22608883748988489342e1), 0.45414700626084508355e1), -0.41631933639693546274e1), 0.14244772076924206909e1); r = fma(x*t, pn/pd, x); ret = absx < 0.5 ? r : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, atanh, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/atanpi.cl�������������������������������������������������0000664�0000000�0000000�00000012575�13251554454�0021272�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float atanpi(float x) { const float pi = 3.1415926535897932f; uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; uint sx = ux ^ aux; float xbypi = MATH_DIVIDE(x, pi); float shalf = as_float(sx | as_uint(0.5f)); float v = as_float(aux); // Return for NaN float ret = x; // 2^26 <= |x| <= Inf => atan(x) is close to piby2 ret = aux <= PINFBITPATT_SP32 ? shalf : ret; // Reduce arguments 2^-19 <= |x| < 2^26 // 39/16 <= x < 2^26 x = -MATH_RECIP(v); float c = 1.57079632679489655800f; // atan(infinity) // 19/16 <= x < 39/16 int l = aux < 0x401c0000; float xx = MATH_DIVIDE(v - 1.5f, mad(v, 1.5f, 1.0f)); x = l ? xx : x; c = l ? 9.82793723247329054082e-01f : c; // atan(1.5) // 11/16 <= x < 19/16 l = aux < 0x3f980000U; xx = MATH_DIVIDE(v - 1.0f, 1.0f + v); x = l ? xx : x; c = l ? 7.85398163397448278999e-01f : c; // atan(1) // 7/16 <= x < 11/16 l = aux < 0x3f300000; xx = MATH_DIVIDE(mad(v, 2.0f, -1.0f), 2.0f + v); x = l ? xx : x; c = l ? 4.63647609000806093515e-01f : c; // atan(0.5) // 2^-19 <= x < 7/16 l = aux < 0x3ee00000; x = l ? v : x; c = l ? 0.0f : c; // Core approximation: Remez(2,2) on [-7/16,7/16] float s = x * x; float a = mad(s, mad(s, 0.470677934286149214138357545549e-2f, 0.192324546402108583211697690500f), 0.296528598819239217902158651186f); float b = mad(s, mad(s, 0.299309699959659728404442796915f, 0.111072499995399550138837673349e1f), 0.889585796862432286486651434570f); float q = x * s * MATH_DIVIDE(a, b); float z = c - (q - x); z = MATH_DIVIDE(z, pi); float zs = as_float(sx | as_uint(z)); ret = aux < 0x4c800000 ? zs : ret; // |x| < 2^-19 ret = aux < 0x36000000 ? xbypi : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, atanpi, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double atanpi(double x) { const double pi = 0x1.921fb54442d18p+1; double v = fabs(x); // 2^56 > v > 39/16 double a = -1.0; double b = v; // (chi + clo) = arctan(infinity) double chi = 1.57079632679489655800e+00; double clo = 6.12323399573676480327e-17; double ta = v - 1.5; double tb = 1.0 + 1.5 * v; int l = v <= 0x1.38p+1; // 39/16 > v > 19/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(1.5) chi = l ? 9.82793723247329054082e-01 : chi; clo = l ? 1.39033110312309953701e-17 : clo; ta = v - 1.0; tb = 1.0 + v; l = v <= 0x1.3p+0; // 19/16 > v > 11/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(1.) chi = l ? 7.85398163397448278999e-01 : chi; clo = l ? 3.06161699786838240164e-17 : clo; ta = 2.0 * v - 1.0; tb = 2.0 + v; l = v <= 0x1.6p-1; // 11/16 > v > 7/16 a = l ? ta : a; b = l ? tb : b; // (chi + clo) = arctan(0.5) chi = l ? 4.63647609000806093515e-01 : chi; clo = l ? 2.26987774529616809294e-17 : clo; l = v <= 0x1.cp-2; // v < 7/16 a = l ? v : a; b = l ? 1.0 : b;; chi = l ? 0.0 : chi; clo = l ? 0.0 : clo; // Core approximation: Remez(4,4) on [-7/16,7/16] double r = a / b; double s = r * r; double qn = fma(s, fma(s, fma(s, fma(s, 0.142316903342317766e-3, 0.304455919504853031e-1), 0.220638780716667420e0), 0.447677206805497472e0), 0.268297920532545909e0); double qd = fma(s, fma(s, fma(s, fma(s, 0.389525873944742195e-1, 0.424602594203847109e0), 0.141254259931958921e1), 0.182596787737507063e1), 0.804893761597637733e0); double q = r * s * qn / qd; r = (chi - ((q - clo) - r)) / pi; double vp = v / pi; double z = isnan(x) ? x : 0.5; z = v <= 0x1.0p+56 ? r : z; z = v < 0x1.0p-26 ? vp : z; return x == v ? z : -z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, atanpi, double) #endif �����������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/binary_impl.inc�������������������������������������������0000664�0000000�0000000�00000000746�13251554454�0022473�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, __CLC_GENTYPE y) { return FUNCTION_IMPL(x, y); } #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, float y) { __CLC_GENTYPE vec_y = (__CLC_GENTYPE) (y); return FUNCTION_IMPL(x, vec_y); } #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x, double y) { __CLC_GENTYPE vec_y = (__CLC_GENTYPE) (y); return FUNCTION_IMPL(x, vec_y); } #endif ��������������������������libclc-0.2.0+git20180312/generic/lib/math/cbrt.cl���������������������������������������������������0000664�0000000�0000000�00000011247�13251554454�0020743�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float cbrt(float x) { uint xi = as_uint(x); uint axi = xi & EXSIGNBIT_SP32; uint xsign = axi ^ xi; xi = axi; int m = (xi >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; // Treat subnormals uint xisub = as_uint(as_float(xi | 0x3f800000) - 1.0f); int msub = (xisub >> EXPSHIFTBITS_SP32) - 253; int c = m == -127; xi = c ? xisub : xi; m = c ? msub : m; int m3 = m / 3; int rem = m - m3*3; float mf = as_float((m3 + EXPBIAS_SP32) << EXPSHIFTBITS_SP32); uint indx = (xi & 0x007f0000) + ((xi & 0x00008000) << 1); float f = as_float((xi & MANTBITS_SP32) | 0x3f000000) - as_float(indx | 0x3f000000); indx >>= 16; float r = f * USE_TABLE(log_inv_tbl, indx); float poly = mad(mad(r, 0x1.f9add4p-5f, -0x1.c71c72p-4f), r*r, r * 0x1.555556p-2f); // This could also be done with a 5-element table float remH = 0x1.428000p-1f; float remT = 0x1.45f31ap-14f; remH = rem == -1 ? 0x1.964000p-1f : remH; remT = rem == -1 ? 0x1.fea53ep-13f : remT; remH = rem == 0 ? 0x1.000000p+0f : remH; remT = rem == 0 ? 0x0.000000p+0f : remT; remH = rem == 1 ? 0x1.428000p+0f : remH; remT = rem == 1 ? 0x1.45f31ap-13f : remT; remH = rem == 2 ? 0x1.964000p+0f : remH; remT = rem == 2 ? 0x1.fea53ep-12f : remT; float2 tv = USE_TABLE(cbrt_tbl, indx); float cbrtH = tv.s0; float cbrtT = tv.s1; float bH = cbrtH * remH; float bT = mad(cbrtH, remT, mad(cbrtT, remH, cbrtT*remT)); float z = mad(poly, bH, mad(poly, bT, bT)) + bH; z *= mf; z = as_float(as_uint(z) | xsign); c = axi >= EXPBITS_SP32 | axi == 0; z = c ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, cbrt, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double cbrt(double x) { int return_x = isinf(x) | isnan(x) | x == 0.0; ulong ux = as_ulong(fabs(x)); int m = (as_int2(ux).hi >> 20) - 1023; // Treat subnormals ulong uxs = as_ulong(as_double(0x3ff0000000000000UL | ux) - 1.0); int ms = m + (as_int2(uxs).hi >> 20) - 1022; int c = m == -1023; ux = c ? uxs : ux; m = c ? ms : m; int mby3 = m / 3; int rem = m - 3*mby3; double mf = as_double((ulong)(mby3 + 1023) << 52); ux &= 0x000fffffffffffffUL; double Y = as_double(0x3fe0000000000000UL | ux); // nearest integer int index = as_int2(ux).hi >> 11; index = (0x100 | (index >> 1)) + (index & 1); double F = (double)index * 0x1.0p-9; double f = Y - F; double r = f * USE_TABLE(cbrt_inv_tbl, index-256); double z = r * fma(r, fma(r, fma(r, fma(r, fma(r, -0x1.8090d6221a247p-6, 0x1.ee7113506ac13p-6), -0x1.511e8d2b3183bp-5), 0x1.f9add3c0ca458p-5), -0x1.c71c71c71c71cp-4), 0x1.5555555555555p-2); double2 tv = USE_TABLE(cbrt_rem_tbl, rem+2); double Rem_h = tv.s0; double Rem_t = tv.s1; tv = USE_TABLE(cbrt_dbl_tbl, index-256); double F_h = tv.s0; double F_t = tv.s1; double b_h = F_h * Rem_h; double b_t = fma(Rem_t, F_h, fma(F_t, Rem_h, F_t*Rem_t)); double ans = fma(z, b_h, fma(z, b_t, b_t)) + b_h; ans = copysign(ans*mf, x); return return_x ? x : ans; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, cbrt, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_ldexp.cl����������������������������������������������0000664�0000000�0000000�00000007432�13251554454�0021747�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "../clcmacro.h" #include "math.h" _CLC_DEF _CLC_OVERLOAD float __clc_ldexp(float x, int n) { if (!__clc_fp32_subnormals_supported()) { // This treats subnormals as zeros int i = as_int(x); int e = (i >> 23) & 0xff; int m = i & 0x007fffff; int s = i & 0x80000000; int v = add_sat(e, n); v = clamp(v, 0, 0xff); int mr = e == 0 | v == 0 | v == 0xff ? 0 : m; int c = e == 0xff; mr = c ? m : mr; int er = c ? e : v; er = e ? er : e; return as_float( s | (er << 23) | mr ); } /* supports denormal values */ const int multiplier = 24; float val_f; uint val_ui; uint sign; int exponent; val_ui = as_uint(x); sign = val_ui & 0x80000000; val_ui = val_ui & 0x7fffffff;/* remove the sign bit */ int val_x = val_ui; exponent = val_ui >> 23; /* get the exponent */ int dexp = exponent; /* denormal support */ int fbh = 127 - (as_uint((float)(as_float(val_ui | 0x3f800000) - 1.0f)) >> 23); int dexponent = 25 - fbh; uint dval_ui = (( (val_ui << fbh) & 0x007fffff) | (dexponent << 23)); int ex = dexponent + n - multiplier; dexponent = ex; uint val = sign | (ex << 23) | (dval_ui & 0x007fffff); int ex1 = dexponent + multiplier; ex1 = -ex1 +25; dval_ui = (((dval_ui & 0x007fffff )| 0x800000) >> ex1); dval_ui = dexponent > 0 ? val :dval_ui; dval_ui = dexponent > 254 ? 0x7f800000 :dval_ui; /*overflow*/ dval_ui = dexponent < -multiplier ? 0 : dval_ui; /*underflow*/ dval_ui = dval_ui | sign; val_f = as_float(dval_ui); exponent += n; val = sign | (exponent << 23) | (val_ui & 0x007fffff); ex1 = exponent + multiplier; ex1 = -ex1 +25; val_ui = (((val_ui & 0x007fffff )| 0x800000) >> ex1); val_ui = exponent > 0 ? val :val_ui; val_ui = exponent > 254 ? 0x7f800000 :val_ui; /*overflow*/ val_ui = exponent < -multiplier ? 0 : val_ui; /*underflow*/ val_ui = val_ui | sign; val_ui = dexp == 0? dval_ui : val_ui; val_f = as_float(val_ui); val_f = isnan(x) | isinf(x) | val_x == 0 ? x : val_f; return val_f; } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEF _CLC_OVERLOAD double __clc_ldexp(double x, int n) { long l = as_ulong(x); int e = (l >> 52) & 0x7ff; long s = l & 0x8000000000000000; ulong ux = as_ulong(x * 0x1.0p+53); int de = ((int)(ux >> 52) & 0x7ff) - 53; int c = e == 0; e = c ? de: e; ux = c ? ux : l; int v = e + n; v = clamp(v, -0x7ff, 0x7ff); ux &= ~EXPBITS_DP64; double mr = as_double(ux | ((ulong)(v+53) << 52)); mr = mr * 0x1.0p-53; mr = v > 0 ? as_double(ux | ((ulong)v << 52)) : mr; mr = v == 0x7ff ? as_double(s | PINFBITPATT_DP64) : mr; mr = v < -53 ? as_double(s) : mr; mr = ((n == 0) | isinf(x) | (x == 0) ) ? x : mr; return mr; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_nextafter.cl������������������������������������������0000664�0000000�0000000�00000003523�13251554454�0022630�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" // This file provides OpenCL C implementations of nextafter for // targets that don't support the clang builtin. #define AS_TYPE(x) as_##x #define NEXTAFTER(FLOAT_TYPE, UINT_TYPE, INT_TYPE) \ _CLC_OVERLOAD _CLC_DEF FLOAT_TYPE __clc_nextafter(FLOAT_TYPE x, FLOAT_TYPE y) { \ const UINT_TYPE sign_bit \ = (UINT_TYPE)1 << (sizeof(INT_TYPE) * 8 - 1); \ const UINT_TYPE sign_bit_mask = sign_bit - 1; \ INT_TYPE ix = AS_TYPE(INT_TYPE)(x); \ INT_TYPE ax = ix & sign_bit_mask; \ INT_TYPE mx = sign_bit - ix; \ mx = ix < 0 ? mx : ix; \ INT_TYPE iy = AS_TYPE(INT_TYPE)(y); \ INT_TYPE ay = iy & sign_bit_mask; \ INT_TYPE my = sign_bit - iy; \ my = iy < 0 ? my : iy; \ INT_TYPE t = mx + (mx < my ? 1 : -1); \ INT_TYPE r = sign_bit - t; \ r = t < 0 ? r : t; \ r = isnan(x) ? ix : r; \ r = isnan(y) ? iy : r; \ r = ((ax | ay) == 0 | ix == iy) ? iy : r; \ return AS_TYPE(FLOAT_TYPE)(r); \ } NEXTAFTER(float, uint, int) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __clc_nextafter, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable NEXTAFTER(double, ulong, long) _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __clc_nextafter, double, double) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_pow.cl������������������������������������������������0000664�0000000�0000000�00000034556�13251554454�0021447�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "math.h" #include "tables.h" #include "../clcmacro.h" /* compute pow using log and exp x^y = exp(y * log(x)) we take care not to lose precision in the intermediate steps When computing log, calculate it in splits, r = f * (p_invead + p_inv_tail) r = rh + rt calculate log polynomial using r, in end addition, do poly = poly + ((rh-r) + rt) lth = -r ltt = ((xexp * log2_t) - poly) + logT lt = lth + ltt lh = (xexp * log2_h) + logH l = lh + lt Calculate final log answer as gh and gt, gh = l & higher-half bits gt = (((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh)) yh = y & higher-half bits yt = y - yh Before entering computation of exp, vs = ((yt*gt + yt*gh) + yh*gt) v = vs + yh*gh vt = ((yh*gh - v) + vs) In calculation of exp, add vt to r that is used for poly At the end of exp, do ((((expT * poly) + expT) + expH*poly) + expH) */ _CLC_DEF _CLC_OVERLOAD float __clc_pow(float x, float y) { int ix = as_int(x); int ax = ix & EXSIGNBIT_SP32; int xpos = ix == ax; int iy = as_int(y); int ay = iy & EXSIGNBIT_SP32; int ypos = iy == ay; /* Extra precise log calculation * First handle case that x is close to 1 */ float r = 1.0f - as_float(ax); int near1 = fabs(r) < 0x1.0p-4f; float r2 = r*r; /* Coefficients are just 1/3, 1/4, 1/5 and 1/6 */ float poly = mad(r, mad(r, mad(r, mad(r, 0x1.24924ap-3f, 0x1.555556p-3f), 0x1.99999ap-3f), 0x1.000000p-2f), 0x1.555556p-2f); poly *= r2*r; float lth_near1 = -r2 * 0.5f; float ltt_near1 = -poly; float lt_near1 = lth_near1 + ltt_near1; float lh_near1 = -r; float l_near1 = lh_near1 + lt_near1; /* Computations for x not near 1 */ int m = (int)(ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float mf = (float)m; int ixs = as_int(as_float(ax | 0x3f800000) - 1.0f); float mfs = (float)((ixs >> EXPSHIFTBITS_SP32) - 253); int c = m == -127; int ixn = c ? ixs : ax; float mfn = c ? mfs : mf; int indx = (ixn & 0x007f0000) + ((ixn & 0x00008000) << 1); /* F - Y */ float f = as_float(0x3f000000 | indx) - as_float(0x3f000000 | (ixn & MANTBITS_SP32)); indx = indx >> 16; float2 tv = USE_TABLE(log_inv_tbl_ep, indx); float rh = f * tv.s0; float rt = f * tv.s1; r = rh + rt; poly = mad(r, mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) * (r*r); poly += (rh - r) + rt; const float LOG2_HEAD = 0x1.62e000p-1f; /* 0.693115234 */ const float LOG2_TAIL = 0x1.0bfbe8p-15f; /* 0.0000319461833 */ tv = USE_TABLE(loge_tbl, indx); float lth = -r; float ltt = mad(mfn, LOG2_TAIL, -poly) + tv.s1; float lt = lth + ltt; float lh = mad(mfn, LOG2_HEAD, tv.s0); float l = lh + lt; /* Select near 1 or not */ lth = near1 ? lth_near1 : lth; ltt = near1 ? ltt_near1 : ltt; lt = near1 ? lt_near1 : lt; lh = near1 ? lh_near1 : lh; l = near1 ? l_near1 : l; float gh = as_float(as_int(l) & 0xfffff000); float gt = ((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh); float yh = as_float(iy & 0xfffff000); float yt = y - yh; float ylogx_s = mad(gt, yh, mad(gh, yt, yt*gt)); float ylogx = mad(yh, gh, ylogx_s); float ylogx_t = mad(yh, gh, -ylogx) + ylogx_s; /* Extra precise exp of ylogx */ const float R_64_BY_LOG2 = 0x1.715476p+6f; /* 64/log2 : 92.332482616893657 */ int n = convert_int(ylogx * R_64_BY_LOG2); float nf = (float) n; int j = n & 0x3f; m = n >> 6; int m2 = m << EXPSHIFTBITS_SP32; const float R_LOG2_BY_64_LD = 0x1.620000p-7f; /* log2/64 lead: 0.0108032227 */ const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; /* log2/64 tail: 0.0000272020388 */ r = mad(nf, -R_LOG2_BY_64_TL, mad(nf, -R_LOG2_BY_64_LD, ylogx)) + ylogx_t; /* Truncated Taylor series for e^r */ poly = mad(mad(mad(r, 0x1.555556p-5f, 0x1.555556p-3f), r, 0x1.000000p-1f), r*r, r); tv = USE_TABLE(exp_tbl_ep, j); float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0; float sexpylogx; if (!__clc_fp32_subnormals_supported()) { int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127); m = (23-(m + 149)) == 0 ? 1: m; uint mantissa = ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149)); sexpylogx = as_float(mantissa); } else { sexpylogx = expylogx * as_float(0x1 << (m + 149)); } float texpylogx = as_float(as_int(expylogx) + m2); expylogx = m < -125 ? sexpylogx : texpylogx; /* Result is +-Inf if (ylogx + ylogx_t) > 128*log2 */ expylogx = (ylogx > 0x1.62e430p+6f) | (ylogx == 0x1.62e430p+6f & ylogx_t > -0x1.05c610p-22f) ? as_float(PINFBITPATT_SP32) : expylogx; /* Result is 0 if ylogx < -149*log2 */ expylogx = ylogx < -0x1.9d1da0p+6f ? 0.0f : expylogx; /* Classify y: * inty = 0 means not an integer. * inty = 1 means odd integer. * inty = 2 means even integer. */ int yexp = (int)(ay >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32 + 1; int mask = (1 << (24 - yexp)) - 1; int yodd = ((iy >> (24 - yexp)) & 0x1) != 0; int inty = yodd ? 1 : 2; inty = (iy & mask) != 0 ? 0 : inty; inty = yexp < 1 ? 0 : inty; inty = yexp > 24 ? 2 : inty; float signval = as_float((as_uint(expylogx) ^ SIGNBIT_SP32)); expylogx = ((inty == 1) & !xpos) ? signval : expylogx; int ret = as_int(expylogx); /* Corner case handling */ ret = (!xpos & (inty == 0)) ? QNANBITPATT_SP32 : ret; ret = ax < 0x3f800000 & iy == NINFBITPATT_SP32 ? PINFBITPATT_SP32 : ret; ret = ax > 0x3f800000 & iy == NINFBITPATT_SP32 ? 0 : ret; ret = ax < 0x3f800000 & iy == PINFBITPATT_SP32 ? 0 : ret; ret = ax > 0x3f800000 & iy == PINFBITPATT_SP32 ? PINFBITPATT_SP32 : ret; int xinf = xpos ? PINFBITPATT_SP32 : NINFBITPATT_SP32; ret = ((ax == 0) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0) & !ypos & (inty != 1)) ? PINFBITPATT_SP32 : ret; int xzero = xpos ? 0 : 0x80000000; ret = ((ax == 0) & ypos & (inty == 1)) ? xzero : ret; ret = ((ax == 0) & ypos & (inty != 1)) ? 0 : ret; ret = ((ax == 0) & (iy == NINFBITPATT_SP32)) ? PINFBITPATT_SP32 : ret; ret = ((ix == 0xbf800000) & (ay == PINFBITPATT_SP32)) ? 0x3f800000 : ret; ret = ((ix == NINFBITPATT_SP32) & !ypos & (inty == 1)) ? 0x80000000 : ret; ret = ((ix == NINFBITPATT_SP32) & !ypos & (inty != 1)) ? 0 : ret; ret = ((ix == NINFBITPATT_SP32) & ypos & (inty == 1)) ? NINFBITPATT_SP32 : ret; ret = ((ix == NINFBITPATT_SP32) & ypos & (inty != 1)) ? PINFBITPATT_SP32 : ret; ret = ((ix == PINFBITPATT_SP32) & !ypos) ? 0 : ret; ret = ((ix == PINFBITPATT_SP32) & ypos) ? PINFBITPATT_SP32 : ret; ret = (ax > PINFBITPATT_SP32) ? ix : ret; ret = (ay > PINFBITPATT_SP32) ? iy : ret; ret = ay == 0 ? 0x3f800000 : ret; ret = ix == 0x3f800000 ? 0x3f800000 : ret; return as_float(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_pow, float, float) #ifdef cl_khr_fp64 _CLC_DEF _CLC_OVERLOAD double __clc_pow(double x, double y) { const double real_log2_tail = 5.76999904754328540596e-08; const double real_log2_lead = 6.93147122859954833984e-01; long ux = as_long(x); long ax = ux & (~SIGNBIT_DP64); int xpos = ax == ux; long uy = as_long(y); long ay = uy & (~SIGNBIT_DP64); int ypos = ay == uy; // Extended precision log double v, vt; { int exp = (int)(ax >> 52) - 1023; int mask_exp_1023 = exp == -1023; double xexp = (double) exp; long mantissa = ax & 0x000FFFFFFFFFFFFFL; long temp_ux = as_long(as_double(0x3ff0000000000000L | mantissa) - 1.0); exp = ((temp_ux & 0x7FF0000000000000L) >> 52) - 2045; double xexp1 = (double) exp; long mantissa1 = temp_ux & 0x000FFFFFFFFFFFFFL; xexp = mask_exp_1023 ? xexp1 : xexp; mantissa = mask_exp_1023 ? mantissa1 : mantissa; long rax = (mantissa & 0x000ff00000000000) + ((mantissa & 0x0000080000000000) << 1); int index = rax >> 44; double F = as_double(rax | 0x3FE0000000000000L); double Y = as_double(mantissa | 0x3FE0000000000000L); double f = F - Y; double2 tv = USE_TABLE(log_f_inv_tbl, index); double log_h = tv.s0; double log_t = tv.s1; double f_inv = (log_h + log_t) * f; double r1 = as_double(as_long(f_inv) & 0xfffffffff8000000L); double r2 = fma(-F, r1, f) * (log_h + log_t); double r = r1 + r2; double poly = fma(r, fma(r, fma(r, fma(r, 1.0/7.0, 1.0/6.0), 1.0/5.0), 1.0/4.0), 1.0/3.0); poly = poly * r * r * r; double hr1r1 = 0.5*r1*r1; double poly0h = r1 + hr1r1; double poly0t = r1 - poly0h + hr1r1; poly = fma(r1, r2, fma(0.5*r2, r2, poly)) + r2 + poly0t; tv = USE_TABLE(powlog_tbl, index); log_h = tv.s0; log_t = tv.s1; double resT_t = fma(xexp, real_log2_tail, + log_t) - poly; double resT = resT_t - poly0h; double resH = fma(xexp, real_log2_lead, log_h); double resT_h = poly0h; double H = resT + resH; double H_h = as_double(as_long(H) & 0xfffffffff8000000L); double T = (resH - H + resT) + (resT_t - (resT + resT_h)) + (H - H_h); H = H_h; double y_head = as_double(uy & 0xfffffffff8000000L); double y_tail = y - y_head; double temp = fma(y_tail, H, fma(y_head, T, y_tail*T)); v = fma(y_head, H, temp); vt = fma(y_head, H, -v) + temp; } // Now calculate exp of (v,vt) double expv; { const double max_exp_arg = 709.782712893384; const double min_exp_arg = -745.1332191019411; const double sixtyfour_by_lnof2 = 92.33248261689366; const double lnof2_by_64_head = 0.010830424260348081; const double lnof2_by_64_tail = -4.359010638708991e-10; double temp = v * sixtyfour_by_lnof2; int n = (int)temp; double dn = (double)n; int j = n & 0x0000003f; int m = n >> 6; double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); double f1 = tv.s0; double f2 = tv.s1; double f = f1 + f2; double r1 = fma(dn, -lnof2_by_64_head, v); double r2 = dn * lnof2_by_64_tail; double r = (r1 + r2) + vt; double q = fma(r, fma(r, fma(r, fma(r, 1.38889490863777199667e-03, 8.33336798434219616221e-03), 4.16666666662260795726e-02), 1.66666666665260878863e-01), 5.00000000000000008883e-01); q = fma(r*r, q, r); expv = fma(f, q, f2) + f1; expv = ldexp(expv, m); expv = v > max_exp_arg ? as_double(0x7FF0000000000000L) : expv; expv = v < min_exp_arg ? 0.0 : expv; } // See whether y is an integer. // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty; { int yexp = (int)(ay >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64 + 1; inty = yexp < 1 ? 0 : 2; inty = yexp > 53 ? 2 : inty; long mask = (1L << (53 - yexp)) - 1L; int inty1 = (((ay & ~mask) >> (53 - yexp)) & 1L) == 1L ? 1 : 2; inty1 = (ay & mask) != 0 ? 0 : inty1; inty = !(yexp < 1) & !(yexp > 53) ? inty1 : inty; } expv *= (inty == 1) & !xpos ? -1.0 : 1.0; long ret = as_long(expv); // Now all the edge cases ret = !xpos & (inty == 0) ? QNANBITPATT_DP64 : ret; ret = ax < 0x3ff0000000000000L & uy == NINFBITPATT_DP64 ? PINFBITPATT_DP64 : ret; ret = ax > 0x3ff0000000000000L & uy == NINFBITPATT_DP64 ? 0L : ret; ret = ax < 0x3ff0000000000000L & uy == PINFBITPATT_DP64 ? 0L : ret; ret = ax > 0x3ff0000000000000L & uy == PINFBITPATT_DP64 ? PINFBITPATT_DP64 : ret; long xinf = xpos ? PINFBITPATT_DP64 : NINFBITPATT_DP64; ret = ((ax == 0L) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0L) & !ypos & (inty != 1)) ? PINFBITPATT_DP64 : ret; long xzero = xpos ? 0L : 0x8000000000000000L; ret = ((ax == 0L) & ypos & (inty == 1)) ? xzero : ret; ret = ((ax == 0L) & ypos & (inty != 1)) ? 0L : ret; ret = ((ax == 0L) & (uy == NINFBITPATT_DP64)) ? PINFBITPATT_DP64 : ret; ret = ((ux == 0xbff0000000000000L) & (ay == PINFBITPATT_DP64)) ? 0x3ff0000000000000L : ret; ret = ((ux == NINFBITPATT_DP64) & !ypos & (inty == 1)) ? 0x8000000000000000L : ret; ret = ((ux == NINFBITPATT_DP64) & !ypos & (inty != 1)) ? 0L : ret; ret = ((ux == NINFBITPATT_DP64) & ypos & (inty == 1)) ? NINFBITPATT_DP64 : ret; ret = ((ux == NINFBITPATT_DP64) & ypos & (inty != 1)) ? PINFBITPATT_DP64 : ret; ret = (ux == PINFBITPATT_DP64) & !ypos ? 0L : ret; ret = (ux == PINFBITPATT_DP64) & ypos ? PINFBITPATT_DP64 : ret; ret = ax > PINFBITPATT_DP64 ? ux : ret; ret = ay > PINFBITPATT_DP64 ? uy : ret; ret = ay == 0L ? 0x3ff0000000000000L : ret; ret = ux == 0x3ff0000000000000L ? 0x3ff0000000000000L : ret; return as_double(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_pow, double, double) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_pown.cl�����������������������������������������������0000664�0000000�0000000�00000031521�13251554454�0021612�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "math.h" #include "tables.h" #include "../clcmacro.h" // compute pow using log and exp // x^y = exp(y * log(x)) // // we take care not to lose precision in the intermediate steps // // When computing log, calculate it in splits, // // r = f * (p_invead + p_inv_tail) // r = rh + rt // // calculate log polynomial using r, in end addition, do // poly = poly + ((rh-r) + rt) // // lth = -r // ltt = ((xexp * log2_t) - poly) + logT // lt = lth + ltt // // lh = (xexp * log2_h) + logH // l = lh + lt // // Calculate final log answer as gh and gt, // gh = l & higher-half bits // gt = (((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh)) // // yh = y & higher-half bits // yt = y - yh // // Before entering computation of exp, // vs = ((yt*gt + yt*gh) + yh*gt) // v = vs + yh*gh // vt = ((yh*gh - v) + vs) // // In calculation of exp, add vt to r that is used for poly // At the end of exp, do // ((((expT * poly) + expT) + expH*poly) + expH) _CLC_DEF _CLC_OVERLOAD float __clc_pown(float x, int ny) { float y = (float)ny; int ix = as_int(x); int ax = ix & EXSIGNBIT_SP32; int xpos = ix == ax; int iy = as_int(y); int ay = iy & EXSIGNBIT_SP32; int ypos = iy == ay; // Extra precise log calculation // First handle case that x is close to 1 float r = 1.0f - as_float(ax); int near1 = fabs(r) < 0x1.0p-4f; float r2 = r*r; // Coefficients are just 1/3, 1/4, 1/5 and 1/6 float poly = mad(r, mad(r, mad(r, mad(r, 0x1.24924ap-3f, 0x1.555556p-3f), 0x1.99999ap-3f), 0x1.000000p-2f), 0x1.555556p-2f); poly *= r2*r; float lth_near1 = -r2 * 0.5f; float ltt_near1 = -poly; float lt_near1 = lth_near1 + ltt_near1; float lh_near1 = -r; float l_near1 = lh_near1 + lt_near1; // Computations for x not near 1 int m = (int)(ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float mf = (float)m; int ixs = as_int(as_float(ax | 0x3f800000) - 1.0f); float mfs = (float)((ixs >> EXPSHIFTBITS_SP32) - 253); int c = m == -127; int ixn = c ? ixs : ax; float mfn = c ? mfs : mf; int indx = (ixn & 0x007f0000) + ((ixn & 0x00008000) << 1); // F - Y float f = as_float(0x3f000000 | indx) - as_float(0x3f000000 | (ixn & MANTBITS_SP32)); indx = indx >> 16; float2 tv = USE_TABLE(log_inv_tbl_ep, indx); float rh = f * tv.s0; float rt = f * tv.s1; r = rh + rt; poly = mad(r, mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) * (r*r); poly += (rh - r) + rt; const float LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833 tv = USE_TABLE(loge_tbl, indx); float lth = -r; float ltt = mad(mfn, LOG2_TAIL, -poly) + tv.s1; float lt = lth + ltt; float lh = mad(mfn, LOG2_HEAD, tv.s0); float l = lh + lt; // Select near 1 or not lth = near1 ? lth_near1 : lth; ltt = near1 ? ltt_near1 : ltt; lt = near1 ? lt_near1 : lt; lh = near1 ? lh_near1 : lh; l = near1 ? l_near1 : l; float gh = as_float(as_int(l) & 0xfffff000); float gt = ((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh); float yh = as_float(iy & 0xfffff000); float yt = (float)(ny - (int)yh); float ylogx_s = mad(gt, yh, mad(gh, yt, yt*gt)); float ylogx = mad(yh, gh, ylogx_s); float ylogx_t = mad(yh, gh, -ylogx) + ylogx_s; // Extra precise exp of ylogx const float R_64_BY_LOG2 = 0x1.715476p+6f; // 64/log2 : 92.332482616893657 int n = convert_int(ylogx * R_64_BY_LOG2); float nf = (float) n; int j = n & 0x3f; m = n >> 6; int m2 = m << EXPSHIFTBITS_SP32; const float R_LOG2_BY_64_LD = 0x1.620000p-7f; // log2/64 lead: 0.0108032227 const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; // log2/64 tail: 0.0000272020388 r = mad(nf, -R_LOG2_BY_64_TL, mad(nf, -R_LOG2_BY_64_LD, ylogx)) + ylogx_t; // Truncated Taylor series for e^r poly = mad(mad(mad(r, 0x1.555556p-5f, 0x1.555556p-3f), r, 0x1.000000p-1f), r*r, r); tv = USE_TABLE(exp_tbl_ep, j); float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0; float sexpylogx; if (!__clc_fp32_subnormals_supported()) { int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127); m = (23-(m + 149)) == 0 ? 1: m; uint mantissa = ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149)); sexpylogx = as_float(mantissa); } else { sexpylogx = expylogx * as_float(0x1 << (m + 149)); } float texpylogx = as_float(as_int(expylogx) + m2); expylogx = m < -125 ? sexpylogx : texpylogx; // Result is +-Inf if (ylogx + ylogx_t) > 128*log2 expylogx = ((ylogx > 0x1.62e430p+6f) | (ylogx == 0x1.62e430p+6f & ylogx_t > -0x1.05c610p-22f)) ? as_float(PINFBITPATT_SP32) : expylogx; // Result is 0 if ylogx < -149*log2 expylogx = ylogx < -0x1.9d1da0p+6f ? 0.0f : expylogx; // Classify y: // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty = 2 - (ny & 1); float signval = as_float((as_uint(expylogx) ^ SIGNBIT_SP32)); expylogx = ((inty == 1) & !xpos) ? signval : expylogx; int ret = as_int(expylogx); // Corner case handling int xinf = xpos ? PINFBITPATT_SP32 : NINFBITPATT_SP32; ret = ((ax == 0) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0) & !ypos & (inty == 2)) ? PINFBITPATT_SP32 : ret; ret = ((ax == 0) & ypos & (inty == 2)) ? 0 : ret; int xzero = !xpos ? 0x80000000 : 0L; ret = ((ax == 0) & ypos & (inty == 1)) ? xzero : ret; ret = ((ix == NINFBITPATT_SP32) & !ypos & (inty == 1)) ? 0x80000000 : ret; ret = ((ix == NINFBITPATT_SP32) & !ypos & (inty != 1)) ? 0 : ret; ret = ((ix == NINFBITPATT_SP32) & ypos & (inty == 1)) ? NINFBITPATT_SP32 : ret; ret = ((ix == NINFBITPATT_SP32) & ypos & (inty != 1)) ? PINFBITPATT_SP32 : ret; ret = ((ix == PINFBITPATT_SP32) & !ypos) ? 0 : ret; ret = ((ix == PINFBITPATT_SP32) & ypos) ? PINFBITPATT_SP32 : ret; ret = ax > PINFBITPATT_SP32 ? ix : ret; ret = ny == 0 ? 0x3f800000 : ret; return as_float(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_pown, float, int) #ifdef cl_khr_fp64 _CLC_DEF _CLC_OVERLOAD double __clc_pown(double x, int ny) { const double real_log2_tail = 5.76999904754328540596e-08; const double real_log2_lead = 6.93147122859954833984e-01; double y = (double) ny; long ux = as_long(x); long ax = ux & (~SIGNBIT_DP64); int xpos = ax == ux; long uy = as_long(y); long ay = uy & (~SIGNBIT_DP64); int ypos = ay == uy; // Extended precision log double v, vt; { int exp = (int)(ax >> 52) - 1023; int mask_exp_1023 = exp == -1023; double xexp = (double) exp; long mantissa = ax & 0x000FFFFFFFFFFFFFL; long temp_ux = as_long(as_double(0x3ff0000000000000L | mantissa) - 1.0); exp = ((temp_ux & 0x7FF0000000000000L) >> 52) - 2045; double xexp1 = (double) exp; long mantissa1 = temp_ux & 0x000FFFFFFFFFFFFFL; xexp = mask_exp_1023 ? xexp1 : xexp; mantissa = mask_exp_1023 ? mantissa1 : mantissa; long rax = (mantissa & 0x000ff00000000000) + ((mantissa & 0x0000080000000000) << 1); int index = rax >> 44; double F = as_double(rax | 0x3FE0000000000000L); double Y = as_double(mantissa | 0x3FE0000000000000L); double f = F - Y; double2 tv = USE_TABLE(log_f_inv_tbl, index); double log_h = tv.s0; double log_t = tv.s1; double f_inv = (log_h + log_t) * f; double r1 = as_double(as_long(f_inv) & 0xfffffffff8000000L); double r2 = fma(-F, r1, f) * (log_h + log_t); double r = r1 + r2; double poly = fma(r, fma(r, fma(r, fma(r, 1.0/7.0, 1.0/6.0), 1.0/5.0), 1.0/4.0), 1.0/3.0); poly = poly * r * r * r; double hr1r1 = 0.5*r1*r1; double poly0h = r1 + hr1r1; double poly0t = r1 - poly0h + hr1r1; poly = fma(r1, r2, fma(0.5*r2, r2, poly)) + r2 + poly0t; tv = USE_TABLE(powlog_tbl, index); log_h = tv.s0; log_t = tv.s1; double resT_t = fma(xexp, real_log2_tail, + log_t) - poly; double resT = resT_t - poly0h; double resH = fma(xexp, real_log2_lead, log_h); double resT_h = poly0h; double H = resT + resH; double H_h = as_double(as_long(H) & 0xfffffffff8000000L); double T = (resH - H + resT) + (resT_t - (resT + resT_h)) + (H - H_h); H = H_h; double y_head = as_double(uy & 0xfffffffff8000000L); double y_tail = y - y_head; int mask_2_24 = ay > 0x4170000000000000; // 2^24 int nyh = convert_int(y_head); int nyt = ny - nyh; double y_tail1 = (double)nyt; y_tail = mask_2_24 ? y_tail1 : y_tail; double temp = fma(y_tail, H, fma(y_head, T, y_tail*T)); v = fma(y_head, H, temp); vt = fma(y_head, H, -v) + temp; } // Now calculate exp of (v,vt) double expv; { const double max_exp_arg = 709.782712893384; const double min_exp_arg = -745.1332191019411; const double sixtyfour_by_lnof2 = 92.33248261689366; const double lnof2_by_64_head = 0.010830424260348081; const double lnof2_by_64_tail = -4.359010638708991e-10; double temp = v * sixtyfour_by_lnof2; int n = (int)temp; double dn = (double)n; int j = n & 0x0000003f; int m = n >> 6; double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); double f1 = tv.s0; double f2 = tv.s1; double f = f1 + f2; double r1 = fma(dn, -lnof2_by_64_head, v); double r2 = dn * lnof2_by_64_tail; double r = (r1 + r2) + vt; double q = fma(r, fma(r, fma(r, fma(r, 1.38889490863777199667e-03, 8.33336798434219616221e-03), 4.16666666662260795726e-02), 1.66666666665260878863e-01), 5.00000000000000008883e-01); q = fma(r*r, q, r); expv = fma(f, q, f2) + f1; expv = ldexp(expv, m); expv = v > max_exp_arg ? as_double(0x7FF0000000000000L) : expv; expv = v < min_exp_arg ? 0.0 : expv; } // See whether y is an integer. // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty = 2 - (ny & 1); expv *= ((inty == 1) & !xpos) ? -1.0 : 1.0; long ret = as_long(expv); // Now all the edge cases long xinf = xpos ? PINFBITPATT_DP64 : NINFBITPATT_DP64; ret = ((ax == 0L) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0L) & !ypos & (inty == 2)) ? PINFBITPATT_DP64 : ret; ret = ((ax == 0L) & ypos & (inty == 2)) ? 0L : ret; long xzero = !xpos ? 0x8000000000000000L : 0L; ret = ((ax == 0L) & ypos & (inty == 1)) ? xzero : ret; ret = ((ux == NINFBITPATT_DP64) & !ypos & (inty == 1)) ? 0x8000000000000000L : ret; ret = ((ux == NINFBITPATT_DP64) & !ypos & (inty != 1)) ? 0L : ret; ret = ((ux == NINFBITPATT_DP64) & ypos & (inty == 1)) ? NINFBITPATT_DP64 : ret; ret = ((ux == NINFBITPATT_DP64) & ypos & (inty != 1)) ? PINFBITPATT_DP64 : ret; ret = ((ux == PINFBITPATT_DP64) & !ypos) ? 0L : ret; ret = ((ux == PINFBITPATT_DP64) & ypos) ? PINFBITPATT_DP64 : ret; ret = ax > PINFBITPATT_DP64 ? ux : ret; ret = ny == 0 ? 0x3ff0000000000000L : ret; return as_double(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_pown, double, int) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_powr.cl�����������������������������������������������0000664�0000000�0000000�00000033216�13251554454�0021621�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "math.h" #include "tables.h" #include "../clcmacro.h" // compute pow using log and exp // x^y = exp(y * log(x)) // // we take care not to lose precision in the intermediate steps // // When computing log, calculate it in splits, // // r = f * (p_invead + p_inv_tail) // r = rh + rt // // calculate log polynomial using r, in end addition, do // poly = poly + ((rh-r) + rt) // // lth = -r // ltt = ((xexp * log2_t) - poly) + logT // lt = lth + ltt // // lh = (xexp * log2_h) + logH // l = lh + lt // // Calculate final log answer as gh and gt, // gh = l & higher-half bits // gt = (((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh)) // // yh = y & higher-half bits // yt = y - yh // // Before entering computation of exp, // vs = ((yt*gt + yt*gh) + yh*gt) // v = vs + yh*gh // vt = ((yh*gh - v) + vs) // // In calculation of exp, add vt to r that is used for poly // At the end of exp, do // ((((expT * poly) + expT) + expH*poly) + expH) _CLC_DEF _CLC_OVERLOAD float __clc_powr(float x, float y) { int ix = as_int(x); int ax = ix & EXSIGNBIT_SP32; int xpos = ix == ax; int iy = as_int(y); int ay = iy & EXSIGNBIT_SP32; int ypos = iy == ay; // Extra precise log calculation // First handle case that x is close to 1 float r = 1.0f - as_float(ax); int near1 = fabs(r) < 0x1.0p-4f; float r2 = r*r; // Coefficients are just 1/3, 1/4, 1/5 and 1/6 float poly = mad(r, mad(r, mad(r, mad(r, 0x1.24924ap-3f, 0x1.555556p-3f), 0x1.99999ap-3f), 0x1.000000p-2f), 0x1.555556p-2f); poly *= r2*r; float lth_near1 = -r2 * 0.5f; float ltt_near1 = -poly; float lt_near1 = lth_near1 + ltt_near1; float lh_near1 = -r; float l_near1 = lh_near1 + lt_near1; // Computations for x not near 1 int m = (int)(ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float mf = (float)m; int ixs = as_int(as_float(ax | 0x3f800000) - 1.0f); float mfs = (float)((ixs >> EXPSHIFTBITS_SP32) - 253); int c = m == -127; int ixn = c ? ixs : ax; float mfn = c ? mfs : mf; int indx = (ixn & 0x007f0000) + ((ixn & 0x00008000) << 1); // F - Y float f = as_float(0x3f000000 | indx) - as_float(0x3f000000 | (ixn & MANTBITS_SP32)); indx = indx >> 16; float2 tv = USE_TABLE(log_inv_tbl_ep, indx); float rh = f * tv.s0; float rt = f * tv.s1; r = rh + rt; poly = mad(r, mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) * (r*r); poly += (rh - r) + rt; const float LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833 tv = USE_TABLE(loge_tbl, indx); float lth = -r; float ltt = mad(mfn, LOG2_TAIL, -poly) + tv.s1; float lt = lth + ltt; float lh = mad(mfn, LOG2_HEAD, tv.s0); float l = lh + lt; // Select near 1 or not lth = near1 ? lth_near1 : lth; ltt = near1 ? ltt_near1 : ltt; lt = near1 ? lt_near1 : lt; lh = near1 ? lh_near1 : lh; l = near1 ? l_near1 : l; float gh = as_float(as_int(l) & 0xfffff000); float gt = ((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh); float yh = as_float(iy & 0xfffff000); float yt = y - yh; float ylogx_s = mad(gt, yh, mad(gh, yt, yt*gt)); float ylogx = mad(yh, gh, ylogx_s); float ylogx_t = mad(yh, gh, -ylogx) + ylogx_s; // Extra precise exp of ylogx const float R_64_BY_LOG2 = 0x1.715476p+6f; // 64/log2 : 92.332482616893657 int n = convert_int(ylogx * R_64_BY_LOG2); float nf = (float) n; int j = n & 0x3f; m = n >> 6; int m2 = m << EXPSHIFTBITS_SP32; const float R_LOG2_BY_64_LD = 0x1.620000p-7f; // log2/64 lead: 0.0108032227 const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; // log2/64 tail: 0.0000272020388 r = mad(nf, -R_LOG2_BY_64_TL, mad(nf, -R_LOG2_BY_64_LD, ylogx)) + ylogx_t; // Truncated Taylor series for e^r poly = mad(mad(mad(r, 0x1.555556p-5f, 0x1.555556p-3f), r, 0x1.000000p-1f), r*r, r); tv = USE_TABLE(exp_tbl_ep, j); float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0; float sexpylogx; if (!__clc_fp32_subnormals_supported()) { int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127); m = (23-(m + 149)) == 0 ? 1: m; uint mantissa = ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149)); sexpylogx = as_float(mantissa); } else { sexpylogx = expylogx * as_float(0x1 << (m + 149)); } float texpylogx = as_float(as_int(expylogx) + m2); expylogx = m < -125 ? sexpylogx : texpylogx; // Result is +-Inf if (ylogx + ylogx_t) > 128*log2 expylogx = ((ylogx > 0x1.62e430p+6f) | (ylogx == 0x1.62e430p+6f & ylogx_t > -0x1.05c610p-22f)) ? as_float(PINFBITPATT_SP32) : expylogx; // Result is 0 if ylogx < -149*log2 expylogx = ylogx < -0x1.9d1da0p+6f ? 0.0f : expylogx; // Classify y: // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int yexp = (int)(ay >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32 + 1; int mask = (1 << (24 - yexp)) - 1; int yodd = ((iy >> (24 - yexp)) & 0x1) != 0; int inty = yodd ? 1 : 2; inty = (iy & mask) != 0 ? 0 : inty; inty = yexp < 1 ? 0 : inty; inty = yexp > 24 ? 2 : inty; float signval = as_float((as_uint(expylogx) ^ SIGNBIT_SP32)); expylogx = ((inty == 1) & !xpos) ? signval : expylogx; int ret = as_int(expylogx); // Corner case handling ret = ax < 0x3f800000 & iy == NINFBITPATT_SP32 ? PINFBITPATT_SP32 : ret; ret = ax < 0x3f800000 & iy == PINFBITPATT_SP32 ? 0 : ret; ret = ax == 0x3f800000 & ay < PINFBITPATT_SP32 ? 0x3f800000 : ret; ret = ax == 0x3f800000 & ay == PINFBITPATT_SP32 ? QNANBITPATT_SP32 : ret; ret = ax > 0x3f800000 & iy == NINFBITPATT_SP32 ? 0 : ret; ret = ax > 0x3f800000 & iy == PINFBITPATT_SP32 ? PINFBITPATT_SP32 : ret; ret = ((ix < PINFBITPATT_SP32) & (ay == 0)) ? 0x3f800000 : ret; ret = ((ax == PINFBITPATT_SP32) & !ypos) ? 0 : ret; ret = ((ax == PINFBITPATT_SP32) & ypos) ? PINFBITPATT_SP32 : ret; ret = ((ax == PINFBITPATT_SP32) & (iy == PINFBITPATT_SP32)) ? PINFBITPATT_SP32 : ret; ret = ((ax == PINFBITPATT_SP32) & (ay == 0)) ? QNANBITPATT_SP32 : ret; ret = ((ax == 0) & !ypos) ? PINFBITPATT_SP32 : ret; ret = ((ax == 0) & ypos) ? 0 : ret; ret = ((ax == 0) & (ay == 0)) ? QNANBITPATT_SP32 : ret; ret = ((ax != 0) & !xpos) ? QNANBITPATT_SP32 : ret; ret = ax > PINFBITPATT_SP32 ? ix : ret; ret = ay > PINFBITPATT_SP32 ? iy : ret; return as_float(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_powr, float, float) #ifdef cl_khr_fp64 _CLC_DEF _CLC_OVERLOAD double __clc_powr(double x, double y) { const double real_log2_tail = 5.76999904754328540596e-08; const double real_log2_lead = 6.93147122859954833984e-01; long ux = as_long(x); long ax = ux & (~SIGNBIT_DP64); int xpos = ax == ux; long uy = as_long(y); long ay = uy & (~SIGNBIT_DP64); int ypos = ay == uy; // Extended precision log double v, vt; { int exp = (int)(ax >> 52) - 1023; int mask_exp_1023 = exp == -1023; double xexp = (double) exp; long mantissa = ax & 0x000FFFFFFFFFFFFFL; long temp_ux = as_long(as_double(0x3ff0000000000000L | mantissa) - 1.0); exp = ((temp_ux & 0x7FF0000000000000L) >> 52) - 2045; double xexp1 = (double) exp; long mantissa1 = temp_ux & 0x000FFFFFFFFFFFFFL; xexp = mask_exp_1023 ? xexp1 : xexp; mantissa = mask_exp_1023 ? mantissa1 : mantissa; long rax = (mantissa & 0x000ff00000000000) + ((mantissa & 0x0000080000000000) << 1); int index = rax >> 44; double F = as_double(rax | 0x3FE0000000000000L); double Y = as_double(mantissa | 0x3FE0000000000000L); double f = F - Y; double2 tv = USE_TABLE(log_f_inv_tbl, index); double log_h = tv.s0; double log_t = tv.s1; double f_inv = (log_h + log_t) * f; double r1 = as_double(as_long(f_inv) & 0xfffffffff8000000L); double r2 = fma(-F, r1, f) * (log_h + log_t); double r = r1 + r2; double poly = fma(r, fma(r, fma(r, fma(r, 1.0/7.0, 1.0/6.0), 1.0/5.0), 1.0/4.0), 1.0/3.0); poly = poly * r * r * r; double hr1r1 = 0.5*r1*r1; double poly0h = r1 + hr1r1; double poly0t = r1 - poly0h + hr1r1; poly = fma(r1, r2, fma(0.5*r2, r2, poly)) + r2 + poly0t; tv = USE_TABLE(powlog_tbl, index); log_h = tv.s0; log_t = tv.s1; double resT_t = fma(xexp, real_log2_tail, + log_t) - poly; double resT = resT_t - poly0h; double resH = fma(xexp, real_log2_lead, log_h); double resT_h = poly0h; double H = resT + resH; double H_h = as_double(as_long(H) & 0xfffffffff8000000L); double T = (resH - H + resT) + (resT_t - (resT + resT_h)) + (H - H_h); H = H_h; double y_head = as_double(uy & 0xfffffffff8000000L); double y_tail = y - y_head; double temp = fma(y_tail, H, fma(y_head, T, y_tail*T)); v = fma(y_head, H, temp); vt = fma(y_head, H, -v) + temp; } // Now calculate exp of (v,vt) double expv; { const double max_exp_arg = 709.782712893384; const double min_exp_arg = -745.1332191019411; const double sixtyfour_by_lnof2 = 92.33248261689366; const double lnof2_by_64_head = 0.010830424260348081; const double lnof2_by_64_tail = -4.359010638708991e-10; double temp = v * sixtyfour_by_lnof2; int n = (int)temp; double dn = (double)n; int j = n & 0x0000003f; int m = n >> 6; double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); double f1 = tv.s0; double f2 = tv.s1; double f = f1 + f2; double r1 = fma(dn, -lnof2_by_64_head, v); double r2 = dn * lnof2_by_64_tail; double r = (r1 + r2) + vt; double q = fma(r, fma(r, fma(r, fma(r, 1.38889490863777199667e-03, 8.33336798434219616221e-03), 4.16666666662260795726e-02), 1.66666666665260878863e-01), 5.00000000000000008883e-01); q = fma(r*r, q, r); expv = fma(f, q, f2) + f1; expv = ldexp(expv, m); expv = v > max_exp_arg ? as_double(0x7FF0000000000000L) : expv; expv = v < min_exp_arg ? 0.0 : expv; } // See whether y is an integer. // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty; { int yexp = (int)(ay >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64 + 1; inty = yexp < 1 ? 0 : 2; inty = yexp > 53 ? 2 : inty; long mask = (1L << (53 - yexp)) - 1L; int inty1 = (((ay & ~mask) >> (53 - yexp)) & 1L) == 1L ? 1 : 2; inty1 = (ay & mask) != 0 ? 0 : inty1; inty = !(yexp < 1) & !(yexp > 53) ? inty1 : inty; } expv *= ((inty == 1) & !xpos) ? -1.0 : 1.0; long ret = as_long(expv); // Now all the edge cases ret = ax < 0x3ff0000000000000L & uy == NINFBITPATT_DP64 ? PINFBITPATT_DP64 : ret; ret = ax < 0x3ff0000000000000L & uy == PINFBITPATT_DP64 ? 0L : ret; ret = ax == 0x3ff0000000000000L & ay < PINFBITPATT_DP64 ? 0x3ff0000000000000L : ret; ret = ax == 0x3ff0000000000000L & ay == PINFBITPATT_DP64 ? QNANBITPATT_DP64 : ret; ret = ax > 0x3ff0000000000000L & uy == NINFBITPATT_DP64 ? 0L : ret; ret = ax > 0x3ff0000000000000L & uy == PINFBITPATT_DP64 ? PINFBITPATT_DP64 : ret; ret = ux < PINFBITPATT_DP64 & ay == 0L ? 0x3ff0000000000000L : ret; ret = ((ax == PINFBITPATT_DP64) & !ypos) ? 0L : ret; ret = ((ax == PINFBITPATT_DP64) & ypos) ? PINFBITPATT_DP64 : ret; ret = ((ax == PINFBITPATT_DP64) & (uy == PINFBITPATT_DP64)) ? PINFBITPATT_DP64 : ret; ret = ((ax == PINFBITPATT_DP64) & (ay == 0L)) ? QNANBITPATT_DP64 : ret; ret = ((ax == 0L) & !ypos) ? PINFBITPATT_DP64 : ret; ret = ((ax == 0L) & ypos) ? 0L : ret; ret = ((ax == 0L) & (ay == 0L)) ? QNANBITPATT_DP64 : ret; ret = ((ax != 0L) & !xpos) ? QNANBITPATT_DP64 : ret; ret = ax > PINFBITPATT_DP64 ? ux : ret; ret = ay > PINFBITPATT_DP64 ? uy : ret; return as_double(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_powr, double, double) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_rootn.cl����������������������������������������������0000664�0000000�0000000�00000031473�13251554454�0021776�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "math.h" #include "tables.h" #include "../clcmacro.h" // compute pow using log and exp // x^y = exp(y * log(x)) // // we take care not to lose precision in the intermediate steps // // When computing log, calculate it in splits, // // r = f * (p_invead + p_inv_tail) // r = rh + rt // // calculate log polynomial using r, in end addition, do // poly = poly + ((rh-r) + rt) // // lth = -r // ltt = ((xexp * log2_t) - poly) + logT // lt = lth + ltt // // lh = (xexp * log2_h) + logH // l = lh + lt // // Calculate final log answer as gh and gt, // gh = l & higher-half bits // gt = (((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh)) // // yh = y & higher-half bits // yt = y - yh // // Before entering computation of exp, // vs = ((yt*gt + yt*gh) + yh*gt) // v = vs + yh*gh // vt = ((yh*gh - v) + vs) // // In calculation of exp, add vt to r that is used for poly // At the end of exp, do // ((((expT * poly) + expT) + expH*poly) + expH) _CLC_DEF _CLC_OVERLOAD float __clc_rootn(float x, int ny) { float y = MATH_RECIP((float)ny); int ix = as_int(x); int ax = ix & EXSIGNBIT_SP32; int xpos = ix == ax; int iy = as_int(y); int ay = iy & EXSIGNBIT_SP32; int ypos = iy == ay; // Extra precise log calculation // First handle case that x is close to 1 float r = 1.0f - as_float(ax); int near1 = fabs(r) < 0x1.0p-4f; float r2 = r*r; // Coefficients are just 1/3, 1/4, 1/5 and 1/6 float poly = mad(r, mad(r, mad(r, mad(r, 0x1.24924ap-3f, 0x1.555556p-3f), 0x1.99999ap-3f), 0x1.000000p-2f), 0x1.555556p-2f); poly *= r2*r; float lth_near1 = -r2 * 0.5f; float ltt_near1 = -poly; float lt_near1 = lth_near1 + ltt_near1; float lh_near1 = -r; float l_near1 = lh_near1 + lt_near1; // Computations for x not near 1 int m = (int)(ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; float mf = (float)m; int ixs = as_int(as_float(ax | 0x3f800000) - 1.0f); float mfs = (float)((ixs >> EXPSHIFTBITS_SP32) - 253); int c = m == -127; int ixn = c ? ixs : ax; float mfn = c ? mfs : mf; int indx = (ixn & 0x007f0000) + ((ixn & 0x00008000) << 1); // F - Y float f = as_float(0x3f000000 | indx) - as_float(0x3f000000 | (ixn & MANTBITS_SP32)); indx = indx >> 16; float2 tv = USE_TABLE(log_inv_tbl_ep, indx); float rh = f * tv.s0; float rt = f * tv.s1; r = rh + rt; poly = mad(r, mad(r, 0x1.0p-2f, 0x1.555556p-2f), 0x1.0p-1f) * (r*r); poly += (rh - r) + rt; const float LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833 tv = USE_TABLE(loge_tbl, indx); float lth = -r; float ltt = mad(mfn, LOG2_TAIL, -poly) + tv.s1; float lt = lth + ltt; float lh = mad(mfn, LOG2_HEAD, tv.s0); float l = lh + lt; // Select near 1 or not lth = near1 ? lth_near1 : lth; ltt = near1 ? ltt_near1 : ltt; lt = near1 ? lt_near1 : lt; lh = near1 ? lh_near1 : lh; l = near1 ? l_near1 : l; float gh = as_float(as_int(l) & 0xfffff000); float gt = ((ltt - (lt - lth)) + ((lh - l) + lt)) + (l - gh); float yh = as_float(iy & 0xfffff000); float fny = (float)ny; float fnyh = as_float(as_int(fny) & 0xfffff000); float fnyt = (float)(ny - (int)fnyh); float yt = MATH_DIVIDE(mad(-fnyt, yh, mad(-fnyh, yh, 1.0f)), fny); float ylogx_s = mad(gt, yh, mad(gh, yt, yt*gt)); float ylogx = mad(yh, gh, ylogx_s); float ylogx_t = mad(yh, gh, -ylogx) + ylogx_s; // Extra precise exp of ylogx const float R_64_BY_LOG2 = 0x1.715476p+6f; // 64/log2 : 92.332482616893657 int n = convert_int(ylogx * R_64_BY_LOG2); float nf = (float) n; int j = n & 0x3f; m = n >> 6; int m2 = m << EXPSHIFTBITS_SP32; const float R_LOG2_BY_64_LD = 0x1.620000p-7f; // log2/64 lead: 0.0108032227 const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; // log2/64 tail: 0.0000272020388 r = mad(nf, -R_LOG2_BY_64_TL, mad(nf, -R_LOG2_BY_64_LD, ylogx)) + ylogx_t; // Truncated Taylor series for e^r poly = mad(mad(mad(r, 0x1.555556p-5f, 0x1.555556p-3f), r, 0x1.000000p-1f), r*r, r); tv = USE_TABLE(exp_tbl_ep, j); float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0; float sexpylogx; if (!__clc_fp32_subnormals_supported()) { int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127); m = (23-(m + 149)) == 0 ? 1: m; uint mantissa = ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149)); sexpylogx = as_float(mantissa); } else { sexpylogx = expylogx * as_float(0x1 << (m + 149)); } float texpylogx = as_float(as_int(expylogx) + m2); expylogx = m < -125 ? sexpylogx : texpylogx; // Result is +-Inf if (ylogx + ylogx_t) > 128*log2 expylogx = ((ylogx > 0x1.62e430p+6f) | (ylogx == 0x1.62e430p+6f & ylogx_t > -0x1.05c610p-22f)) ? as_float(PINFBITPATT_SP32) : expylogx; // Result is 0 if ylogx < -149*log2 expylogx = ylogx < -0x1.9d1da0p+6f ? 0.0f : expylogx; // Classify y: // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty = 2 - (ny & 1); float signval = as_float((as_uint(expylogx) ^ SIGNBIT_SP32)); expylogx = ((inty == 1) & !xpos) ? signval : expylogx; int ret = as_int(expylogx); // Corner case handling ret = (!xpos & (inty == 2)) ? QNANBITPATT_SP32 : ret; int xinf = xpos ? PINFBITPATT_SP32 : NINFBITPATT_SP32; ret = ((ax == 0) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0) & !ypos & (inty == 2)) ? PINFBITPATT_SP32 : ret; ret = ((ax == 0) & ypos & (inty == 2)) ? 0 : ret; int xzero = xpos ? 0 : 0x80000000; ret = ((ax == 0) & ypos & (inty == 1)) ? xzero : ret; ret = ((ix == NINFBITPATT_SP32) & ypos & (inty == 1)) ? NINFBITPATT_SP32 : ret; ret = ((ix == NINFBITPATT_SP32) & !ypos & (inty == 1)) ? 0x80000000 : ret; ret = ((ix == PINFBITPATT_SP32) & !ypos) ? 0 : ret; ret = ((ix == PINFBITPATT_SP32) & ypos) ? PINFBITPATT_SP32 : ret; ret = ax > PINFBITPATT_SP32 ? ix : ret; ret = ny == 0 ? QNANBITPATT_SP32 : ret; return as_float(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_rootn, float, int) #ifdef cl_khr_fp64 _CLC_DEF _CLC_OVERLOAD double __clc_rootn(double x, int ny) { const double real_log2_tail = 5.76999904754328540596e-08; const double real_log2_lead = 6.93147122859954833984e-01; double dny = (double)ny; double y = 1.0 / dny; long ux = as_long(x); long ax = ux & (~SIGNBIT_DP64); int xpos = ax == ux; long uy = as_long(y); long ay = uy & (~SIGNBIT_DP64); int ypos = ay == uy; // Extended precision log double v, vt; { int exp = (int)(ax >> 52) - 1023; int mask_exp_1023 = exp == -1023; double xexp = (double) exp; long mantissa = ax & 0x000FFFFFFFFFFFFFL; long temp_ux = as_long(as_double(0x3ff0000000000000L | mantissa) - 1.0); exp = ((temp_ux & 0x7FF0000000000000L) >> 52) - 2045; double xexp1 = (double) exp; long mantissa1 = temp_ux & 0x000FFFFFFFFFFFFFL; xexp = mask_exp_1023 ? xexp1 : xexp; mantissa = mask_exp_1023 ? mantissa1 : mantissa; long rax = (mantissa & 0x000ff00000000000) + ((mantissa & 0x0000080000000000) << 1); int index = rax >> 44; double F = as_double(rax | 0x3FE0000000000000L); double Y = as_double(mantissa | 0x3FE0000000000000L); double f = F - Y; double2 tv = USE_TABLE(log_f_inv_tbl, index); double log_h = tv.s0; double log_t = tv.s1; double f_inv = (log_h + log_t) * f; double r1 = as_double(as_long(f_inv) & 0xfffffffff8000000L); double r2 = fma(-F, r1, f) * (log_h + log_t); double r = r1 + r2; double poly = fma(r, fma(r, fma(r, fma(r, 1.0/7.0, 1.0/6.0), 1.0/5.0), 1.0/4.0), 1.0/3.0); poly = poly * r * r * r; double hr1r1 = 0.5*r1*r1; double poly0h = r1 + hr1r1; double poly0t = r1 - poly0h + hr1r1; poly = fma(r1, r2, fma(0.5*r2, r2, poly)) + r2 + poly0t; tv = USE_TABLE(powlog_tbl, index); log_h = tv.s0; log_t = tv.s1; double resT_t = fma(xexp, real_log2_tail, + log_t) - poly; double resT = resT_t - poly0h; double resH = fma(xexp, real_log2_lead, log_h); double resT_h = poly0h; double H = resT + resH; double H_h = as_double(as_long(H) & 0xfffffffff8000000L); double T = (resH - H + resT) + (resT_t - (resT + resT_h)) + (H - H_h); H = H_h; double y_head = as_double(uy & 0xfffffffff8000000L); double y_tail = y - y_head; double fnyh = as_double(as_long(dny) & 0xfffffffffff00000); double fnyt = (double)(ny - (int)fnyh); y_tail = fma(-fnyt, y_head, fma(-fnyh, y_head, 1.0))/ dny; double temp = fma(y_tail, H, fma(y_head, T, y_tail*T)); v = fma(y_head, H, temp); vt = fma(y_head, H, -v) + temp; } // Now calculate exp of (v,vt) double expv; { const double max_exp_arg = 709.782712893384; const double min_exp_arg = -745.1332191019411; const double sixtyfour_by_lnof2 = 92.33248261689366; const double lnof2_by_64_head = 0.010830424260348081; const double lnof2_by_64_tail = -4.359010638708991e-10; double temp = v * sixtyfour_by_lnof2; int n = (int)temp; double dn = (double)n; int j = n & 0x0000003f; int m = n >> 6; double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); double f1 = tv.s0; double f2 = tv.s1; double f = f1 + f2; double r1 = fma(dn, -lnof2_by_64_head, v); double r2 = dn * lnof2_by_64_tail; double r = (r1 + r2) + vt; double q = fma(r, fma(r, fma(r, fma(r, 1.38889490863777199667e-03, 8.33336798434219616221e-03), 4.16666666662260795726e-02), 1.66666666665260878863e-01), 5.00000000000000008883e-01); q = fma(r*r, q, r); expv = fma(f, q, f2) + f1; expv = ldexp(expv, m); expv = v > max_exp_arg ? as_double(0x7FF0000000000000L) : expv; expv = v < min_exp_arg ? 0.0 : expv; } // See whether y is an integer. // inty = 0 means not an integer. // inty = 1 means odd integer. // inty = 2 means even integer. int inty = 2 - (ny & 1); expv *= ((inty == 1) & !xpos) ? -1.0 : 1.0; long ret = as_long(expv); // Now all the edge cases ret = (!xpos & (inty == 2)) ? QNANBITPATT_DP64 : ret; long xinf = xpos ? PINFBITPATT_DP64 : NINFBITPATT_DP64; ret = ((ax == 0L) & !ypos & (inty == 1)) ? xinf : ret; ret = ((ax == 0L) & !ypos & (inty == 2)) ? PINFBITPATT_DP64 : ret; ret = ((ax == 0L) & ypos & (inty == 2)) ? 0L : ret; long xzero = xpos ? 0L : 0x8000000000000000L; ret = ((ax == 0L) & ypos & (inty == 1)) ? xzero : ret; ret = ((ux == NINFBITPATT_DP64) & ypos & (inty == 1)) ? NINFBITPATT_DP64 : ret; ret = ((ux == NINFBITPATT_DP64) & !ypos & (inty == 1)) ? 0x8000000000000000L : ret; ret = ((ux == PINFBITPATT_DP64) & !ypos) ? 0L : ret; ret = ((ux == PINFBITPATT_DP64) & ypos) ? PINFBITPATT_DP64 : ret; ret = ax > PINFBITPATT_DP64 ? ux : ret; ret = ny == 0 ? QNANBITPATT_DP64 : ret; return as_double(ret); } _CLC_BINARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_rootn, double, int) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_sqrt.cl�����������������������������������������������0000664�0000000�0000000�00000002651�13251554454�0021622�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include // Map the llvm sqrt intrinsic to an OpenCL function. #define __CLC_FUNCTION __clc_llvm_intr_sqrt #define __CLC_INTRINSIC "llvm.sqrt" #include #undef __CLC_FUNCTION #undef __CLC_INTRINSIC #define __CLC_BODY #include ���������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_sqrt_impl.inc�����������������������������������������0000664�0000000�0000000�00000002730�13251554454�0023014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #if __CLC_FPSIZE == 32 #define __CLC_NAN NAN #define ZERO 0.0f #elif __CLC_FPSIZE == 64 #define __CLC_NAN __builtin_nan("") #define ZERO 0.0 #else #error "Invalid value for __CLC_FPSIZE" #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_sqrt(__CLC_GENTYPE val) { return val < ZERO ? __CLC_NAN : __clc_llvm_intr_sqrt(val); } #undef __CLC_NAN #undef ZERO ����������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_sw_binary.inc�����������������������������������������0000664�0000000�0000000�00000000334�13251554454�0022775�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x, __CLC_GENTYPE y) { return __CLC_SW_FUNC(__CLC_FUNC)(x, y); } #undef __CLC_SW_FUNC ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_sw_unary.inc������������������������������������������0000664�0000000�0000000�00000000310�13251554454�0022641�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_SW_FUNC(x) __CLC_CONCAT(__clc_, x) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNC(__CLC_GENTYPE x) { return __CLC_SW_FUNC(__CLC_FUNC)(x); } #undef __CLC_SW_FUNC ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_tan.cl������������������������������������������������0000664�0000000�0000000�00000004434�13251554454�0021414�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincos_helpers.h" #include "../clcmacro.h" #include "tables.h" _CLC_DEF _CLC_OVERLOAD float __clc_tan(float x) { int ix = as_int(x); int ax = ix & 0x7fffffff; float dx = as_float(ax); float r0, r1; int regn = __clc_argReductionS(&r0, &r1, dx); float t = __clc_tanf_piby4(r0 + r1, regn); t = as_float(as_int(t) ^ (ix ^ ax)); t = ax >= PINFBITPATT_SP32 ? as_float(QNANBITPATT_SP32) : t; //Take care of subnormals t = (x == 0.0f) ? x : t; return t; } _CLC_UNARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_tan, float); #ifdef cl_khr_fp64 #include "sincosD_piby4.h" _CLC_DEF _CLC_OVERLOAD double __clc_tan(double x) { double y = fabs(x); double r, rr; int regn; if (y < 0x1.0p+30) __clc_remainder_piby2_medium(y, &r, &rr, ®n); else __clc_remainder_piby2_large(y, &r, &rr, ®n); double2 tt = __clc_tan_piby4(r, rr); int2 t = as_int2(regn & 1 ? tt.y : tt.x); t.hi ^= (x < 0.0) << 31; return isnan(x) || isinf(x) ? as_double(QNANBITPATT_DP64) : as_double(t); } _CLC_UNARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_tan, double); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/clc_tanpi.cl����������������������������������������������0000664�0000000�0000000�00000007664�13251554454�0021755�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincos_helpers.h" #include "../clcmacro.h" #include "tables.h" _CLC_DEF _CLC_OVERLOAD float __clc_tanpi(float x) { int ix = as_int(x); int xsgn = ix & 0x80000000; int xnsgn = xsgn ^ 0x80000000; ix ^= xsgn; float ax = as_float(ix); int iax = (int)ax; float r = ax - iax; int xodd = xsgn ^ (iax & 0x1 ? 0x80000000 : 0); // Initialize with return for +-Inf and NaN int ir = 0x7fc00000; // 2^24 <= |x| < Inf, the result is always even integer ir = ix < 0x7f800000 ? xsgn : ir; // 2^23 <= |x| < 2^24, the result is always integer ir = ix < 0x4b800000 ? xodd : ir; // 0x1.0p-7 <= |x| < 2^23, result depends on which 0.25 interval // r < 1.0 float a = 1.0f - r; int e = 0; int s = xnsgn; // r <= 0.75 int c = r <= 0.75f; a = c ? r - 0.5f : a; e = c ? 1 : e; s = c ? xsgn : s; // r < 0.5 c = r < 0.5f; a = c ? 0.5f - r : a; s = c ? xnsgn : s; // 0 < r <= 0.25 c = r <= 0.25f; a = c ? r : a; e = c ? 0 : e; s = c ? xsgn : s; float t = __clc_tanf_piby4(a * M_PI_F, 0); float tr = -native_recip(t); int jr = s ^ as_int(e ? tr : t); jr = r == 0.5f ? xodd | 0x7f800000 : jr; ir = ix < 0x4b000000 ? jr : ir; return as_float(ir); } _CLC_UNARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, float, __clc_tanpi, float); #ifdef cl_khr_fp64 #include "sincosD_piby4.h" _CLC_DEF _CLC_OVERLOAD double __clc_tanpi(double x) { long ix = as_long(x); long xsgn = ix & 0x8000000000000000L; long xnsgn = xsgn ^ 0x8000000000000000L; ix ^= xsgn; double ax = as_double(ix); long iax = (long)ax; double r = ax - iax; long xodd = xsgn ^ (iax & 0x1 ? 0x8000000000000000L : 0L); // Initialize with return for +-Inf and NaN long ir = 0x7ff8000000000000L; // 2^53 <= |x| < Inf, the result is always even integer ir = ix < 0x7ff0000000000000L ? xsgn : ir; // 2^52 <= |x| < 2^53, the result is always integer ir = ix < 0x4340000000000000L ? xodd : ir; // 0x1.0p-14 <= |x| < 2^53, result depends on which 0.25 interval // r < 1.0 double a = 1.0 - r; int e = 0; long s = xnsgn; // r <= 0.75 int c = r <= 0.75; double t = r - 0.5; a = c ? t : a; e = c ? 1 : e; s = c ? xsgn : s; // r < 0.5 c = r < 0.5; t = 0.5 - r; a = c ? t : a; s = c ? xnsgn : s; // r <= 0.25 c = r <= 0.25; a = c ? r : a; e = c ? 0 : e; s = c ? xsgn : s; double api = a * M_PI; double2 tt = __clc_tan_piby4(api, 0.0); long jr = s ^ as_long(e ? tt.hi : tt.lo); long si = xodd | 0x7ff0000000000000L; jr = r == 0.5 ? si : jr; ir = ix < 0x4330000000000000L ? jr : ir; return as_double(ir); } _CLC_UNARY_VECTORIZE(_CLC_DEF _CLC_OVERLOAD, double, __clc_tanpi, double); #endif ����������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/copysign.cl�����������������������������������������������0000664�0000000�0000000�00000000433�13251554454�0021637�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_DEFINE_BINARY_BUILTIN(float, copysign, __builtin_copysignf, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, copysign, __builtin_copysign, double, double) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/cos.cl����������������������������������������������������0000664�0000000�0000000�00000004471�13251554454�0020576�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincos_helpers.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float cos(float x) { int ix = as_int(x); int ax = ix & 0x7fffffff; float dx = as_float(ax); float r0, r1; int regn = __clc_argReductionS(&r0, &r1, dx); float ss = -__clc_sinf_piby4(r0, r1); float cc = __clc_cosf_piby4(r0, r1); float c = (regn & 1) != 0 ? ss : cc; c = as_float(as_int(c) ^ ((regn > 1) << 31)); c = ax >= PINFBITPATT_SP32 ? as_float(QNANBITPATT_SP32) : c; return c; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, cos, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double cos(double x) { x = fabs(x); double r, rr; int regn; if (x < 0x1.0p+47) __clc_remainder_piby2_medium(x, &r, &rr, ®n); else __clc_remainder_piby2_large(x, &r, &rr, ®n); double2 sc = __clc_sincos_piby4(r, rr); sc.lo = -sc.lo; int2 c = as_int2(regn & 1 ? sc.lo : sc.hi); c.hi ^= (regn > 1) << 31; return isnan(x) | isinf(x) ? as_double(QNANBITPATT_DP64) : as_double(c); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, cos, double); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/cosh.cl���������������������������������������������������0000664�0000000�0000000�00000015113�13251554454�0020741�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float cosh(float x) { // After dealing with special cases the computation is split into regions as follows. // abs(x) >= max_cosh_arg: // cosh(x) = sign(x)*Inf // abs(x) >= small_threshold: // cosh(x) = sign(x)*exp(abs(x))/2 computed using the // splitexp and scaleDouble functions as for exp_amd(). // abs(x) < small_threshold: // compute p = exp(y) - 1 and then z = 0.5*(p+(p/(p+1.0))) // cosh(x) is then z. const float max_cosh_arg = 0x1.65a9fap+6f; const float small_threshold = 0x1.0a2b24p+3f; uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; float y = as_float(aux); // Find the integer part y0 of y and the increment dy = y - y0. We then compute // z = sinh(y) = sinh(y0)cosh(dy) + cosh(y0)sinh(dy) // z = cosh(y) = cosh(y0)cosh(dy) + sinh(y0)sinh(dy) // where sinh(y0) and cosh(y0) are tabulated above. int ind = (int)y; ind = (uint)ind > 36U ? 0 : ind; float dy = y - ind; float dy2 = dy * dy; float sdy = mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, 0.7746188980094184251527126e-12f, 0.160576793121939886190847e-9f), 0.250521176994133472333666e-7f), 0.275573191913636406057211e-5f), 0.198412698413242405162014e-3f), 0.833333333333329931873097e-2f), 0.166666666666666667013899e0f); sdy = mad(sdy, dy*dy2, dy); float cdy = mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, 0.1163921388172173692062032e-10f, 0.208744349831471353536305e-8f), 0.275573350756016588011357e-6f), 0.248015872460622433115785e-4f), 0.138888888889814854814536e-2f), 0.416666666666660876512776e-1f), 0.500000000000000005911074e0f); cdy = mad(cdy, dy2, 1.0f); float2 tv = USE_TABLE(sinhcosh_tbl, ind); float z = mad(tv.s0, sdy, tv.s1 * cdy); // When exp(-x) is insignificant compared to exp(x), return exp(x)/2 float t = exp(y - 0x1.62e500p-1f); float zsmall = mad(0x1.a0210ep-18f, t, t); z = y >= small_threshold ? zsmall : z; // Corner cases z = y >= max_cosh_arg ? as_float(PINFBITPATT_SP32) : z; z = aux > PINFBITPATT_SP32 ? as_float(QNANBITPATT_SP32) : z; z = aux < 0x38800000 ? 1.0f : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, cosh, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double cosh(double x) { // After dealing with special cases the computation is split into // regions as follows: // // abs(x) >= max_cosh_arg: // cosh(x) = sign(x)*Inf // // abs(x) >= small_threshold: // cosh(x) = sign(x)*exp(abs(x))/2 computed using the // splitexp and scaleDouble functions as for exp_amd(). // // abs(x) < small_threshold: // compute p = exp(y) - 1 and then z = 0.5*(p+(p/(p+1.0))) // cosh(x) is then sign(x)*z. // This is ln(2^1025) const double max_cosh_arg = 7.10475860073943977113e+02; // 0x408633ce8fb9f87e // This is where exp(-x) is insignificant compared to exp(x) = ln(2^27) const double small_threshold = 0x1.2b708872320e2p+4; double y = fabs(x); // In this range we find the integer part y0 of y // and the increment dy = y - y0. We then compute // z = cosh(y) = cosh(y0)cosh(dy) + sinh(y0)sinh(dy) // where sinh(y0) and cosh(y0) are tabulated above. int ind = min((int)y, 36); double dy = y - ind; double dy2 = dy * dy; double sdy = dy * dy2 * fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, 0.7746188980094184251527126e-12, 0.160576793121939886190847e-9), 0.250521176994133472333666e-7), 0.275573191913636406057211e-5), 0.198412698413242405162014e-3), 0.833333333333329931873097e-2), 0.166666666666666667013899e0); double cdy = dy2 * fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, 0.1163921388172173692062032e-10, 0.208744349831471353536305e-8), 0.275573350756016588011357e-6), 0.248015872460622433115785e-4), 0.138888888889814854814536e-2), 0.416666666666660876512776e-1), 0.500000000000000005911074e0); // At this point sinh(dy) is approximated by dy + sdy, // and cosh(dy) is approximated by 1 + cdy. double2 tv = USE_TABLE(cosh_tbl, ind); double cl = tv.s0; double ct = tv.s1; tv = USE_TABLE(sinh_tbl, ind); double sl = tv.s0; double st = tv.s1; double z = fma(sl, dy, fma(sl, sdy, fma(cl, cdy, fma(st, dy, fma(st, sdy, ct*cdy)) + ct))) + cl; // Other cases z = y < 0x1.0p-28 ? 1.0 : z; double t = exp(y - 0x1.62e42fefa3800p-1); t = fma(t, -0x1.ef35793c76641p-45, t); z = y >= small_threshold ? t : z; z = y >= max_cosh_arg ? as_double(PINFBITPATT_DP64) : z; z = isinf(x) | isnan(x) ? y : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, cosh, double) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/cospi.cl��������������������������������������������������0000664�0000000�0000000�00000007233�13251554454�0021126�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincos_helpers.h" #include "sincospiF_piby4.h" #include "../clcmacro.h" #ifdef cl_khr_fp64 #include "sincosD_piby4.h" #endif _CLC_OVERLOAD _CLC_DEF float cospi(float x) { int ix = as_int(x) & 0x7fffffff; float ax = as_float(ix); int iax = (int)ax; float r = ax - iax; int xodd = iax & 0x1 ? 0x80000000 : 0; // Initialize with return for +-Inf and NaN int ir = 0x7fc00000; // 2^24 <= |x| < Inf, the result is always even integer ir = ix < 0x7f800000 ? 0x3f800000 : ir; // 2^23 <= |x| < 2^24, the result is always integer ir = ix < 0x4b800000 ? xodd | 0x3f800000 : ir; // 0x1.0p-7 <= |x| < 2^23, result depends on which 0.25 interval // r < 1.0 float a = 1.0f - r; int e = 1; int s = xodd ^ 0x80000000; // r <= 0.75 int c = r <= 0.75f; a = c ? r - 0.5f : a; e = c ? 0 : e; // r < 0.5 c = r < 0.5f; a = c ? 0.5f - r : a; s = c ? xodd : s; // r <= 0.25 c = r <= 0.25f; a = c ? r : a; e = c ? 1 : e; float2 t = __libclc__sincosf_piby4(a * M_PI_F); int jr = s ^ as_int(e ? t.hi : t.lo); ir = ix < 0x4b000000 ? jr : ir; return as_float(ir); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, cospi, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double cospi(double x) { long ix = as_long(x) & 0x7fffffffffffffffL; double ax = as_double(ix); long iax = (long)ax; double r = ax - (double)iax; long xodd = iax & 0x1L ? 0x8000000000000000L : 0L; // Initialize with return for +-Inf and NaN long ir = 0x7ff8000000000000L; // 2^53 <= |x| < Inf, the result is always even integer ir = ix < 0x7ff0000000000000 ? 0x3ff0000000000000L : ir; // 2^52 <= |x| < 2^53, the result is always integer ir = ax < 0x1.0p+53 ? xodd | 0x3ff0000000000000L : ir; // 0x1.0p-7 <= |x| < 2^52, result depends on which 0.25 interval // r < 1.0 double a = 1.0 - r; int e = 1; long s = xodd ^ 0x8000000000000000L; // r <= 0.75 int c = r <= 0.75; double t = r - 0.5; a = c ? t : a; e = c ? 0 : e; // r < 0.5 c = r < 0.5; t = 0.5 - r; a = c ? t : a; s = c ? xodd : s; // r <= 0.25 c = r <= 0.25; a = c ? r : a; e = c ? 1 : e; double2 sc = __libclc__sincos_piby4(a * M_PI, 0.0); long jr = s ^ as_long(e ? sc.hi : sc.lo); ir = ax < 0x1.0p+52 ? jr : ir; return as_double(ir); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, cospi, double); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/ep_log.cl�������������������������������������������������0000664�0000000�0000000�00000006172�13251554454�0021257�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef cl_khr_fp64 #include #include "ep_log.h" #include "math.h" #include "tables.h" #pragma OPENCL EXTENSION cl_khr_fp64 : enable #define LN0 8.33333333333317923934e-02 #define LN1 1.25000000037717509602e-02 #define LN2 2.23213998791944806202e-03 #define LN3 4.34887777707614552256e-04 #define LF0 8.33333333333333593622e-02 #define LF1 1.24999999978138668903e-02 #define LF2 2.23219810758559851206e-03 _CLC_DEF void __clc_ep_log(double x, int *xexp, double *r1, double *r2) { // Computes natural log(x). Algorithm based on: // Ping-Tak Peter Tang // "Table-driven implementation of the logarithm function in IEEE // floating-point arithmetic" // ACM Transactions on Mathematical Software (TOMS) // Volume 16, Issue 4 (December 1990) int near_one = x >= 0x1.e0faap-1 & x <= 0x1.1082cp+0; ulong ux = as_ulong(x); ulong uxs = as_ulong(as_double(0x03d0000000000000UL | ux) - 0x1.0p-962); int c = ux < IMPBIT_DP64; ux = c ? uxs : ux; int expadjust = c ? 60 : 0; // Store the exponent of x in xexp and put f into the range [0.5,1) int xexp1 = ((as_int2(ux).hi >> 20) & 0x7ff) - EXPBIAS_DP64 - expadjust; double f = as_double(HALFEXPBITS_DP64 | (ux & MANTBITS_DP64)); *xexp = near_one ? 0 : xexp1; double r = x - 1.0; double u1 = MATH_DIVIDE(r, 2.0 + r); double ru1 = -r * u1; u1 = u1 + u1; int index = as_int2(ux).hi >> 13; index = ((0x80 | (index & 0x7e)) >> 1) + (index & 0x1); double f1 = index * 0x1.0p-7; double f2 = f - f1; double u2 = MATH_DIVIDE(f2, fma(0.5, f2, f1)); double2 tv = USE_TABLE(ln_tbl, (index - 64)); double z1 = tv.s0; double q = tv.s1; z1 = near_one ? r : z1; q = near_one ? 0.0 : q; double u = near_one ? u1 : u2; double v = u*u; double cc = near_one ? ru1 : u2; double z21 = fma(v, fma(v, fma(v, LN3, LN2), LN1), LN0); double z22 = fma(v, fma(v, LF2, LF1), LF0); double z2 = near_one ? z21 : z22; z2 = fma(u*v, z2, cc) + q; *r1 = z1; *r2 = z2; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/ep_log.h��������������������������������������������������0000664�0000000�0000000�00000002403�13251554454�0021101�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DECL void __clc_ep_log(double x, int *xexp, double *r1, double *r2); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/erf.cl����������������������������������������������������0000664�0000000�0000000�00000036014�13251554454�0020564�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #define erx 8.4506291151e-01f /* 0x3f58560b */ // Coefficients for approximation to erf on [00.84375] #define efx 1.2837916613e-01f /* 0x3e0375d4 */ #define efx8 1.0270333290e+00f /* 0x3f8375d4 */ #define pp0 1.2837916613e-01f /* 0x3e0375d4 */ #define pp1 -3.2504209876e-01f /* 0xbea66beb */ #define pp2 -2.8481749818e-02f /* 0xbce9528f */ #define pp3 -5.7702702470e-03f /* 0xbbbd1489 */ #define pp4 -2.3763017452e-05f /* 0xb7c756b1 */ #define qq1 3.9791721106e-01f /* 0x3ecbbbce */ #define qq2 6.5022252500e-02f /* 0x3d852a63 */ #define qq3 5.0813062117e-03f /* 0x3ba68116 */ #define qq4 1.3249473704e-04f /* 0x390aee49 */ #define qq5 -3.9602282413e-06f /* 0xb684e21a */ // Coefficients for approximation to erf in [0.843751.25] #define pa0 -2.3621185683e-03f /* 0xbb1acdc6 */ #define pa1 4.1485610604e-01f /* 0x3ed46805 */ #define pa2 -3.7220788002e-01f /* 0xbebe9208 */ #define pa3 3.1834661961e-01f /* 0x3ea2fe54 */ #define pa4 -1.1089469492e-01f /* 0xbde31cc2 */ #define pa5 3.5478305072e-02f /* 0x3d1151b3 */ #define pa6 -2.1663755178e-03f /* 0xbb0df9c0 */ #define qa1 1.0642088205e-01f /* 0x3dd9f331 */ #define qa2 5.4039794207e-01f /* 0x3f0a5785 */ #define qa3 7.1828655899e-02f /* 0x3d931ae7 */ #define qa4 1.2617121637e-01f /* 0x3e013307 */ #define qa5 1.3637083583e-02f /* 0x3c5f6e13 */ #define qa6 1.1984500103e-02f /* 0x3c445aa3 */ // Coefficients for approximation to erfc in [1.251/0.35] #define ra0 -9.8649440333e-03f /* 0xbc21a093 */ #define ra1 -6.9385856390e-01f /* 0xbf31a0b7 */ #define ra2 -1.0558626175e+01f /* 0xc128f022 */ #define ra3 -6.2375331879e+01f /* 0xc2798057 */ #define ra4 -1.6239666748e+02f /* 0xc322658c */ #define ra5 -1.8460508728e+02f /* 0xc3389ae7 */ #define ra6 -8.1287437439e+01f /* 0xc2a2932b */ #define ra7 -9.8143291473e+00f /* 0xc11d077e */ #define sa1 1.9651271820e+01f /* 0x419d35ce */ #define sa2 1.3765776062e+02f /* 0x4309a863 */ #define sa3 4.3456588745e+02f /* 0x43d9486f */ #define sa4 6.4538726807e+02f /* 0x442158c9 */ #define sa5 4.2900814819e+02f /* 0x43d6810b */ #define sa6 1.0863500214e+02f /* 0x42d9451f */ #define sa7 6.5702495575e+00f /* 0x40d23f7c */ #define sa8 -6.0424413532e-02f /* 0xbd777f97 */ // Coefficients for approximation to erfc in [1/.3528] #define rb0 -9.8649431020e-03f /* 0xbc21a092 */ #define rb1 -7.9928326607e-01f /* 0xbf4c9dd4 */ #define rb2 -1.7757955551e+01f /* 0xc18e104b */ #define rb3 -1.6063638306e+02f /* 0xc320a2ea */ #define rb4 -6.3756646729e+02f /* 0xc41f6441 */ #define rb5 -1.0250950928e+03f /* 0xc480230b */ #define rb6 -4.8351919556e+02f /* 0xc3f1c275 */ #define sb1 3.0338060379e+01f /* 0x41f2b459 */ #define sb2 3.2579251099e+02f /* 0x43a2e571 */ #define sb3 1.5367296143e+03f /* 0x44c01759 */ #define sb4 3.1998581543e+03f /* 0x4547fdbb */ #define sb5 2.5530502930e+03f /* 0x451f90ce */ #define sb6 4.7452853394e+02f /* 0x43ed43a7 */ #define sb7 -2.2440952301e+01f /* 0xc1b38712 */ _CLC_OVERLOAD _CLC_DEF float erf(float x) { int hx = as_uint(x); int ix = hx & 0x7fffffff; float absx = as_float(ix); float x2 = absx * absx; float t = 1.0f / x2; float tt = absx - 1.0f; t = absx < 1.25f ? tt : t; t = absx < 0.84375f ? x2 : t; float u, v, tu, tv; // |x| < 6 u = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, rb6, rb5), rb4), rb3), rb2), rb1), rb0); v = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, sb7, sb6), sb5), sb4), sb3), sb2), sb1); tu = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, ra7, ra6), ra5), ra4), ra3), ra2), ra1), ra0); tv = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, sa8, sa7), sa6), sa5), sa4), sa3), sa2), sa1); u = absx < 0x1.6db6dcp+1f ? tu : u; v = absx < 0x1.6db6dcp+1f ? tv : v; tu = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, pa6, pa5), pa4), pa3), pa2), pa1), pa0); tv = mad(t, mad(t, mad(t, mad(t, mad(t, qa6, qa5), qa4), qa3), qa2), qa1); u = absx < 1.25f ? tu : u; v = absx < 1.25f ? tv : v; tu = mad(t, mad(t, mad(t, mad(t, pp4, pp3), pp2), pp1), pp0); tv = mad(t, mad(t, mad(t, mad(t, qq5, qq4), qq3), qq2), qq1); u = absx < 0.84375f ? tu : u; v = absx < 0.84375f ? tv : v; v = mad(t, v, 1.0f); float q = MATH_DIVIDE(u, v); float ret = 1.0f; // |x| < 6 float z = as_float(ix & 0xfffff000); float r = exp(mad(-z, z, -0.5625f)) * exp(mad(z-absx, z+absx, q)); r = 1.0f - MATH_DIVIDE(r, absx); ret = absx < 6.0f ? r : ret; r = erx + q; ret = absx < 1.25f ? r : ret; ret = as_float((hx & 0x80000000) | as_int(ret)); r = mad(x, q, x); ret = absx < 0.84375f ? r : ret; // Prevent underflow r = 0.125f * mad(8.0f, x, efx8 * x); ret = absx < 0x1.0p-28f ? r : ret; ret = isnan(x) ? x : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, erf, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* double erf(double x) * double erfc(double x) * x * 2 |\ * erf(x) = --------- | exp(-t*t)dt * sqrt(pi) \| * 0 * * erfc(x) = 1-erf(x) * Note that * erf(-x) = -erf(x) * erfc(-x) = 2 - erfc(x) * * Method: * 1. For |x| in [0, 0.84375] * erf(x) = x + x*R(x^2) * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] * where R = P/Q where P is an odd poly of degree 8 and * Q is an odd poly of degree 10. * -57.90 * | R - (erf(x)-x)/x | <= 2 * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) * and that * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 * is close to one. The interval is chosen because the fix * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is * near 0.6174), and by some experiment, 0.84375 is chosen to * guarantee the error is less than one ulp for erf. * * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and * c = 0.84506291151 rounded to single (24 bits) * erf(x) = sign(x) * (c + P1(s)/Q1(s)) * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 * 1+(c+P1(s)/Q1(s)) if x < 0 * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 * Remark: here we use the taylor series expansion at x=1. * erf(1+s) = erf(1) + s*Poly(s) * = 0.845.. + P1(s)/Q1(s) * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * * 3. For x in [1.25,1/0.35(~2.857143)], * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) * erf(x) = 1 - erfc(x) * where * R1(z) = degree 7 poly in z, (z=1/x^2) * S1(z) = degree 8 poly in z * * 4. For x in [1/0.35,28] * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 * erf(x) = sign(x) *(1 - tiny) (raise inexact) * erfc(x) = tiny*tiny (raise underflow) if x > 0 * = 2 - tiny if x<0 * * 7. Special case: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ #define AU0 -9.86494292470009928597e-03 #define AU1 -7.99283237680523006574e-01 #define AU2 -1.77579549177547519889e+01 #define AU3 -1.60636384855821916062e+02 #define AU4 -6.37566443368389627722e+02 #define AU5 -1.02509513161107724954e+03 #define AU6 -4.83519191608651397019e+02 #define AV1 3.03380607434824582924e+01 #define AV2 3.25792512996573918826e+02 #define AV3 1.53672958608443695994e+03 #define AV4 3.19985821950859553908e+03 #define AV5 2.55305040643316442583e+03 #define AV6 4.74528541206955367215e+02 #define AV7 -2.24409524465858183362e+01 #define BU0 -9.86494403484714822705e-03 #define BU1 -6.93858572707181764372e-01 #define BU2 -1.05586262253232909814e+01 #define BU3 -6.23753324503260060396e+01 #define BU4 -1.62396669462573470355e+02 #define BU5 -1.84605092906711035994e+02 #define BU6 -8.12874355063065934246e+01 #define BU7 -9.81432934416914548592e+00 #define BV1 1.96512716674392571292e+01 #define BV2 1.37657754143519042600e+02 #define BV3 4.34565877475229228821e+02 #define BV4 6.45387271733267880336e+02 #define BV5 4.29008140027567833386e+02 #define BV6 1.08635005541779435134e+02 #define BV7 6.57024977031928170135e+00 #define BV8 -6.04244152148580987438e-02 #define CU0 -2.36211856075265944077e-03 #define CU1 4.14856118683748331666e-01 #define CU2 -3.72207876035701323847e-01 #define CU3 3.18346619901161753674e-01 #define CU4 -1.10894694282396677476e-01 #define CU5 3.54783043256182359371e-02 #define CU6 -2.16637559486879084300e-03 #define CV1 1.06420880400844228286e-01 #define CV2 5.40397917702171048937e-01 #define CV3 7.18286544141962662868e-02 #define CV4 1.26171219808761642112e-01 #define CV5 1.36370839120290507362e-02 #define CV6 1.19844998467991074170e-02 #define DU0 1.28379167095512558561e-01 #define DU1 -3.25042107247001499370e-01 #define DU2 -2.84817495755985104766e-02 #define DU3 -5.77027029648944159157e-03 #define DU4 -2.37630166566501626084e-05 #define DV1 3.97917223959155352819e-01 #define DV2 6.50222499887672944485e-02 #define DV3 5.08130628187576562776e-03 #define DV4 1.32494738004321644526e-04 #define DV5 -3.96022827877536812320e-06 _CLC_OVERLOAD _CLC_DEF double erf(double y) { double x = fabs(y); double x2 = x * x; double xm1 = x - 1.0; // Poly variable double t = 1.0 / x2; t = x < 1.25 ? xm1 : t; t = x < 0.84375 ? x2 : t; double u, ut, v, vt; // Evaluate rational poly // XXX We need to see of we can grab 16 coefficents from a table // faster than evaluating 3 of the poly pairs // if (x < 6.0) u = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, AU6, AU5), AU4), AU3), AU2), AU1), AU0); v = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, AV7, AV6), AV5), AV4), AV3), AV2), AV1); ut = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, BU7, BU6), BU5), BU4), BU3), BU2), BU1), BU0); vt = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, BV8, BV7), BV6), BV5), BV4), BV3), BV2), BV1); u = x < 0x1.6db6ep+1 ? ut : u; v = x < 0x1.6db6ep+1 ? vt : v; ut = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, CU6, CU5), CU4), CU3), CU2), CU1), CU0); vt = fma(t, fma(t, fma(t, fma(t, fma(t, CV6, CV5), CV4), CV3), CV2), CV1); u = x < 1.25 ? ut : u; v = x < 1.25 ? vt : v; ut = fma(t, fma(t, fma(t, fma(t, DU4, DU3), DU2), DU1), DU0); vt = fma(t, fma(t, fma(t, fma(t, DV5, DV4), DV3), DV2), DV1); u = x < 0.84375 ? ut : u; v = x < 0.84375 ? vt : v; v = fma(t, v, 1.0); // Compute rational approximation double q = u / v; // Compute results double z = as_double(as_long(x) & 0xffffffff00000000L); double r = exp(-z * z - 0.5625) * exp((z - x) * (z + x) + q); r = 1.0 - r / x; double ret = x < 6.0 ? r : 1.0; r = 8.45062911510467529297e-01 + q; ret = x < 1.25 ? r : ret; q = x < 0x1.0p-28 ? 1.28379167095512586316e-01 : q; r = fma(x, q, x); ret = x < 0.84375 ? r : ret; ret = isnan(x) ? x : ret; return y < 0.0 ? -ret : ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, erf, double); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/erfc.cl���������������������������������������������������0000664�0000000�0000000�00000036522�13251554454�0020733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #define erx_f 8.4506291151e-01f /* 0x3f58560b */ // Coefficients for approximation to erf on [00.84375] #define efx 1.2837916613e-01f /* 0x3e0375d4 */ #define efx8 1.0270333290e+00f /* 0x3f8375d4 */ #define pp0 1.2837916613e-01f /* 0x3e0375d4 */ #define pp1 -3.2504209876e-01f /* 0xbea66beb */ #define pp2 -2.8481749818e-02f /* 0xbce9528f */ #define pp3 -5.7702702470e-03f /* 0xbbbd1489 */ #define pp4 -2.3763017452e-05f /* 0xb7c756b1 */ #define qq1 3.9791721106e-01f /* 0x3ecbbbce */ #define qq2 6.5022252500e-02f /* 0x3d852a63 */ #define qq3 5.0813062117e-03f /* 0x3ba68116 */ #define qq4 1.3249473704e-04f /* 0x390aee49 */ #define qq5 -3.9602282413e-06f /* 0xb684e21a */ // Coefficients for approximation to erf in [0.843751.25] #define pa0 -2.3621185683e-03f /* 0xbb1acdc6 */ #define pa1 4.1485610604e-01f /* 0x3ed46805 */ #define pa2 -3.7220788002e-01f /* 0xbebe9208 */ #define pa3 3.1834661961e-01f /* 0x3ea2fe54 */ #define pa4 -1.1089469492e-01f /* 0xbde31cc2 */ #define pa5 3.5478305072e-02f /* 0x3d1151b3 */ #define pa6 -2.1663755178e-03f /* 0xbb0df9c0 */ #define qa1 1.0642088205e-01f /* 0x3dd9f331 */ #define qa2 5.4039794207e-01f /* 0x3f0a5785 */ #define qa3 7.1828655899e-02f /* 0x3d931ae7 */ #define qa4 1.2617121637e-01f /* 0x3e013307 */ #define qa5 1.3637083583e-02f /* 0x3c5f6e13 */ #define qa6 1.1984500103e-02f /* 0x3c445aa3 */ // Coefficients for approximation to erfc in [1.251/0.35] #define ra0 -9.8649440333e-03f /* 0xbc21a093 */ #define ra1 -6.9385856390e-01f /* 0xbf31a0b7 */ #define ra2 -1.0558626175e+01f /* 0xc128f022 */ #define ra3 -6.2375331879e+01f /* 0xc2798057 */ #define ra4 -1.6239666748e+02f /* 0xc322658c */ #define ra5 -1.8460508728e+02f /* 0xc3389ae7 */ #define ra6 -8.1287437439e+01f /* 0xc2a2932b */ #define ra7 -9.8143291473e+00f /* 0xc11d077e */ #define sa1 1.9651271820e+01f /* 0x419d35ce */ #define sa2 1.3765776062e+02f /* 0x4309a863 */ #define sa3 4.3456588745e+02f /* 0x43d9486f */ #define sa4 6.4538726807e+02f /* 0x442158c9 */ #define sa5 4.2900814819e+02f /* 0x43d6810b */ #define sa6 1.0863500214e+02f /* 0x42d9451f */ #define sa7 6.5702495575e+00f /* 0x40d23f7c */ #define sa8 -6.0424413532e-02f /* 0xbd777f97 */ // Coefficients for approximation to erfc in [1/.3528] #define rb0 -9.8649431020e-03f /* 0xbc21a092 */ #define rb1 -7.9928326607e-01f /* 0xbf4c9dd4 */ #define rb2 -1.7757955551e+01f /* 0xc18e104b */ #define rb3 -1.6063638306e+02f /* 0xc320a2ea */ #define rb4 -6.3756646729e+02f /* 0xc41f6441 */ #define rb5 -1.0250950928e+03f /* 0xc480230b */ #define rb6 -4.8351919556e+02f /* 0xc3f1c275 */ #define sb1 3.0338060379e+01f /* 0x41f2b459 */ #define sb2 3.2579251099e+02f /* 0x43a2e571 */ #define sb3 1.5367296143e+03f /* 0x44c01759 */ #define sb4 3.1998581543e+03f /* 0x4547fdbb */ #define sb5 2.5530502930e+03f /* 0x451f90ce */ #define sb6 4.7452853394e+02f /* 0x43ed43a7 */ #define sb7 -2.2440952301e+01f /* 0xc1b38712 */ _CLC_OVERLOAD _CLC_DEF float erfc(float x) { int hx = as_int(x); int ix = hx & 0x7fffffff; float absx = as_float(ix); // Argument for polys float x2 = absx * absx; float t = 1.0f / x2; float tt = absx - 1.0f; t = absx < 1.25f ? tt : t; t = absx < 0.84375f ? x2 : t; // Evaluate polys float tu, tv, u, v; u = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, rb6, rb5), rb4), rb3), rb2), rb1), rb0); v = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, sb7, sb6), sb5), sb4), sb3), sb2), sb1); tu = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, ra7, ra6), ra5), ra4), ra3), ra2), ra1), ra0); tv = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, sa8, sa7), sa6), sa5), sa4), sa3), sa2), sa1); u = absx < 0x1.6db6dap+1f ? tu : u; v = absx < 0x1.6db6dap+1f ? tv : v; tu = mad(t, mad(t, mad(t, mad(t, mad(t, mad(t, pa6, pa5), pa4), pa3), pa2), pa1), pa0); tv = mad(t, mad(t, mad(t, mad(t, mad(t, qa6, qa5), qa4), qa3), qa2), qa1); u = absx < 1.25f ? tu : u; v = absx < 1.25f ? tv : v; tu = mad(t, mad(t, mad(t, mad(t, pp4, pp3), pp2), pp1), pp0); tv = mad(t, mad(t, mad(t, mad(t, qq5, qq4), qq3), qq2), qq1); u = absx < 0.84375f ? tu : u; v = absx < 0.84375f ? tv : v; v = mad(t, v, 1.0f); float q = MATH_DIVIDE(u, v); float ret = 0.0f; float z = as_float(ix & 0xfffff000); float r = exp(mad(-z, z, -0.5625f)) * exp(mad(z - absx, z + absx, q)); r = MATH_DIVIDE(r, absx); t = 2.0f - r; r = x < 0.0f ? t : r; ret = absx < 28.0f ? r : ret; r = 1.0f - erx_f - q; t = erx_f + q + 1.0f; r = x < 0.0f ? t : r; ret = absx < 1.25f ? r : ret; r = 0.5f - mad(x, q, x - 0.5f); ret = absx < 0.84375f ? r : ret; ret = x < -6.0f ? 2.0f : ret; ret = isnan(x) ? x : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, erfc, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* double erf(double x) * double erfc(double x) * x * 2 |\ * erf(x) = --------- | exp(-t*t)dt * sqrt(pi) \| * 0 * * erfc(x) = 1-erf(x) * Note that * erf(-x) = -erf(x) * erfc(-x) = 2 - erfc(x) * * Method: * 1. For |x| in [0, 0.84375] * erf(x) = x + x*R(x^2) * erfc(x) = 1 - erf(x) if x in [-.84375,0.25] * = 0.5 + ((0.5-x)-x*R) if x in [0.25,0.84375] * where R = P/Q where P is an odd poly of degree 8 and * Q is an odd poly of degree 10. * -57.90 * | R - (erf(x)-x)/x | <= 2 * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) * and that * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 * is close to one. The interval is chosen because the fix * point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is * near 0.6174), and by some experiment, 0.84375 is chosen to * guarantee the error is less than one ulp for erf. * * 2. For |x| in [0.84375,1.25], let s = |x| - 1, and * c = 0.84506291151 rounded to single (24 bits) * erf(x) = sign(x) * (c + P1(s)/Q1(s)) * erfc(x) = (1-c) - P1(s)/Q1(s) if x > 0 * 1+(c+P1(s)/Q1(s)) if x < 0 * |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06 * Remark: here we use the taylor series expansion at x=1. * erf(1+s) = erf(1) + s*Poly(s) * = 0.845.. + P1(s)/Q1(s) * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * * 3. For x in [1.25,1/0.35(~2.857143)], * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) * erf(x) = 1 - erfc(x) * where * R1(z) = degree 7 poly in z, (z=1/x^2) * S1(z) = degree 8 poly in z * * 4. For x in [1/0.35,28] * erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0 * = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6 x >= 28 * erf(x) = sign(x) *(1 - tiny) (raise inexact) * erfc(x) = tiny*tiny (raise underflow) if x > 0 * = 2 - tiny if x<0 * * 7. Special case: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ #define AU0 -9.86494292470009928597e-03 #define AU1 -7.99283237680523006574e-01 #define AU2 -1.77579549177547519889e+01 #define AU3 -1.60636384855821916062e+02 #define AU4 -6.37566443368389627722e+02 #define AU5 -1.02509513161107724954e+03 #define AU6 -4.83519191608651397019e+02 #define AV0 3.03380607434824582924e+01 #define AV1 3.25792512996573918826e+02 #define AV2 1.53672958608443695994e+03 #define AV3 3.19985821950859553908e+03 #define AV4 2.55305040643316442583e+03 #define AV5 4.74528541206955367215e+02 #define AV6 -2.24409524465858183362e+01 #define BU0 -9.86494403484714822705e-03 #define BU1 -6.93858572707181764372e-01 #define BU2 -1.05586262253232909814e+01 #define BU3 -6.23753324503260060396e+01 #define BU4 -1.62396669462573470355e+02 #define BU5 -1.84605092906711035994e+02 #define BU6 -8.12874355063065934246e+01 #define BU7 -9.81432934416914548592e+00 #define BV0 1.96512716674392571292e+01 #define BV1 1.37657754143519042600e+02 #define BV2 4.34565877475229228821e+02 #define BV3 6.45387271733267880336e+02 #define BV4 4.29008140027567833386e+02 #define BV5 1.08635005541779435134e+02 #define BV6 6.57024977031928170135e+00 #define BV7 -6.04244152148580987438e-02 #define CU0 -2.36211856075265944077e-03 #define CU1 4.14856118683748331666e-01 #define CU2 -3.72207876035701323847e-01 #define CU3 3.18346619901161753674e-01 #define CU4 -1.10894694282396677476e-01 #define CU5 3.54783043256182359371e-02 #define CU6 -2.16637559486879084300e-03 #define CV0 1.06420880400844228286e-01 #define CV1 5.40397917702171048937e-01 #define CV2 7.18286544141962662868e-02 #define CV3 1.26171219808761642112e-01 #define CV4 1.36370839120290507362e-02 #define CV5 1.19844998467991074170e-02 #define DU0 1.28379167095512558561e-01 #define DU1 -3.25042107247001499370e-01 #define DU2 -2.84817495755985104766e-02 #define DU3 -5.77027029648944159157e-03 #define DU4 -2.37630166566501626084e-05 #define DV0 3.97917223959155352819e-01 #define DV1 6.50222499887672944485e-02 #define DV2 5.08130628187576562776e-03 #define DV3 1.32494738004321644526e-04 #define DV4 -3.96022827877536812320e-06 _CLC_OVERLOAD _CLC_DEF double erfc(double x) { long lx = as_long(x); long ax = lx & 0x7fffffffffffffffL; double absx = as_double(ax); int xneg = lx != ax; // Poly arg double x2 = x * x; double xm1 = absx - 1.0; double t = 1.0 / x2; t = absx < 1.25 ? xm1 : t; t = absx < 0.84375 ? x2 : t; // Evaluate rational poly // XXX Need to evaluate if we can grab the 14 coefficients from a // table faster than evaluating 3 pairs of polys double tu, tv, u, v; // |x| < 28 u = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, AU6, AU5), AU4), AU3), AU2), AU1), AU0); v = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, AV6, AV5), AV4), AV3), AV2), AV1), AV0); tu = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, BU7, BU6), BU5), BU4), BU3), BU2), BU1), BU0); tv = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, BV7, BV6), BV5), BV4), BV3), BV2), BV1), BV0); u = absx < 0x1.6db6dp+1 ? tu : u; v = absx < 0x1.6db6dp+1 ? tv : v; tu = fma(t, fma(t, fma(t, fma(t, fma(t, fma(t, CU6, CU5), CU4), CU3), CU2), CU1), CU0); tv = fma(t, fma(t, fma(t, fma(t, fma(t, CV5, CV4), CV3), CV2), CV1), CV0); u = absx < 1.25 ? tu : u; v = absx < 1.25 ? tv : v; tu = fma(t, fma(t, fma(t, fma(t, DU4, DU3), DU2), DU1), DU0); tv = fma(t, fma(t, fma(t, fma(t, DV4, DV3), DV2), DV1), DV0); u = absx < 0.84375 ? tu : u; v = absx < 0.84375 ? tv : v; v = fma(t, v, 1.0); double q = u / v; // Evaluate return value // |x| < 28 double z = as_double(ax & 0xffffffff00000000UL); double ret = exp(-z * z - 0.5625) * exp((z - absx) * (z + absx) + q) / absx; t = 2.0 - ret; ret = xneg ? t : ret; const double erx = 8.45062911510467529297e-01; z = erx + q + 1.0; t = 1.0 - erx - q; t = xneg ? z : t; ret = absx < 1.25 ? t : ret; // z = 1.0 - fma(x, q, x); // t = 0.5 - fma(x, q, x - 0.5); // t = xneg == 1 | absx < 0.25 ? z : t; t = fma(-x, q, 1.0 - x); ret = absx < 0.84375 ? t : ret; ret = x >= 28.0 ? 0.0 : ret; ret = x <= -6.0 ? 2.0 : ret; ret = ax > 0x7ff0000000000000UL ? x : ret; return ret; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, erfc, double); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp.cl����������������������������������������������������0000664�0000000�0000000�00000006221�13251554454�0020601�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float exp(float x) { // Reduce x const float ln2HI = 0x1.62e300p-1f; const float ln2LO = 0x1.2fefa2p-17f; const float invln2 = 0x1.715476p+0f; float fhalF = x < 0.0f ? -0.5f : 0.5f; int p = mad(x, invln2, fhalF); float fp = (float)p; float hi = mad(fp, -ln2HI, x); // t*ln2HI is exact here float lo = -fp*ln2LO; // Evaluate poly float t = hi + lo; float tt = t*t; float v = mad(tt, -mad(tt, mad(tt, mad(tt, mad(tt, 0x1.637698p-25f, -0x1.bbd41cp-20f), 0x1.1566aap-14f), -0x1.6c16c2p-9f), 0x1.555556p-3f), t); float y = 1.0f - (((-lo) - MATH_DIVIDE(t * v, 2.0f - v)) - hi); // Scale by 2^p float r = as_float(as_int(y) + (p << 23)); const float ulim = 0x1.62e430p+6f; // ln(largest_normal) = 88.72283905206835305366 const float llim = -0x1.5d589ep+6f; // ln(smallest_normal) = -87.33654475055310898657 r = x < llim ? 0.0f : r; r = x < ulim ? r : as_float(0x7f800000); return isnan(x) ? x : r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, exp, float) #ifdef cl_khr_fp64 #include "exp_helper.h" #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double exp(double x) { const double X_MIN = -0x1.74910d52d3051p+9; // -1075*ln(2) const double X_MAX = 0x1.62e42fefa39efp+9; // 1024*ln(2) const double R_64_BY_LOG2 = 0x1.71547652b82fep+6; // 64/ln(2) const double R_LOG2_BY_64_LD = 0x1.62e42fefa0000p-7; // head ln(2)/64 const double R_LOG2_BY_64_TL = 0x1.cf79abc9e3b39p-46; // tail ln(2)/64 int n = convert_int(x * R_64_BY_LOG2); double r = fma(-R_LOG2_BY_64_TL, (double)n, fma(-R_LOG2_BY_64_LD, (double)n, x)); return __clc_exp_helper(x, X_MIN, X_MAX, r, n); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, exp, double) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp10.cl��������������������������������������������������0000664�0000000�0000000�00000000125�13251554454�0020737�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp10.inc�������������������������������������������������0000664�0000000�0000000�00000000375�13251554454�0021121�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE exp10(__CLC_GENTYPE val) { // exp10(x) = exp2(x * log2(10)) #if __CLC_FPSIZE == 32 return exp2(val * M_LOG210_F); #elif __CLC_FPSIZE == 64 return exp2(val * M_LOG210); #else #error unknown _CLC_FPSIZE #endif } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp2.cl���������������������������������������������������0000664�0000000�0000000�00000005140�13251554454�0020662�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float exp2(float x) { // Reduce x const float ln2HI = 0x1.62e300p-1f; const float ln2LO = 0x1.2fefa2p-17f; float t = rint(x); int p = (int)t; float tt = x - t; float hi = tt * ln2HI; float lo = tt * ln2LO; // Evaluate poly t = hi + lo; tt = t*t; float v = mad(tt, -mad(tt, mad(tt, mad(tt, mad(tt, 0x1.637698p-25f, -0x1.bbd41cp-20f), 0x1.1566aap-14f), -0x1.6c16c2p-9f), 0x1.555556p-3f), t); float y = 1.0f - (((-lo) - MATH_DIVIDE(t * v, 2.0f - v)) - hi); // Scale by 2^p float r = as_float(as_int(y) + (p << 23)); const float ulim = 128.0f; const float llim = -126.0f; r = x < llim ? 0.0f : r; r = x < ulim ? r : as_float(0x7f800000); return isnan(x) ? x : r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, exp2, float) #ifdef cl_khr_fp64 #include "exp_helper.h" #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double exp2(double x) { const double R_LN2 = 0x1.62e42fefa39efp-1; // ln(2) const double R_1_BY_64 = 1.0 / 64.0; int n = convert_int(x * 64.0); double r = R_LN2 * fma(-R_1_BY_64, (double)n, x); return __clc_exp_helper(x, -1074.0, 1024.0, r, n); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, exp2, double) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp_helper.cl���������������������������������������������0000664�0000000�0000000�00000004317�13251554454�0022144�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEF double __clc_exp_helper(double x, double x_min, double x_max, double r, int n) { int j = n & 0x3f; int m = n >> 6; // 6 term tail of Taylor expansion of e^r double z2 = r * fma(r, fma(r, fma(r, fma(r, fma(r, 0x1.6c16c16c16c17p-10, 0x1.1111111111111p-7), 0x1.5555555555555p-5), 0x1.5555555555555p-3), 0x1.0000000000000p-1), 1.0); double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); z2 = fma(tv.s0 + tv.s1, z2, tv.s1) + tv.s0; int small_value = (m < -1022) || ((m == -1022) && (z2 < 1.0)); int n1 = m >> 2; int n2 = m-n1; double z3= z2 * as_double(((long)n1 + 1023) << 52); z3 *= as_double(((long)n2 + 1023) << 52); z2 = ldexp(z2, m); z2 = small_value ? z3: z2; z2 = isnan(x) ? x : z2; z2 = x > x_max ? as_double(PINFBITPATT_DP64) : z2; z2 = x < x_min ? 0.0 : z2; return z2; } #endif // cl_khr_fp64 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/exp_helper.h����������������������������������������������0000664�0000000�0000000�00000002431�13251554454�0021770�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DECL double __clc_exp_helper(double x, double x_min, double x_max, double r, int n); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/expm1.cl��������������������������������������������������0000664�0000000�0000000�00000010776�13251554454�0021051�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "math.h" #include "tables.h" #include "../clcmacro.h" /* Refer to the exp routine for the underlying algorithm */ _CLC_OVERLOAD _CLC_DEF float expm1(float x) { const float X_MAX = 0x1.62e42ep+6f; // 128*log2 : 88.722839111673 const float X_MIN = -0x1.9d1da0p+6f; // -149*log2 : -103.27892990343184 const float R_64_BY_LOG2 = 0x1.715476p+6f; // 64/log2 : 92.332482616893657 const float R_LOG2_BY_64_LD = 0x1.620000p-7f; // log2/64 lead: 0.0108032227 const float R_LOG2_BY_64_TL = 0x1.c85fdep-16f; // log2/64 tail: 0.0000272020388 uint xi = as_uint(x); int n = (int)(x * R_64_BY_LOG2); float fn = (float)n; int j = n & 0x3f; int m = n >> 6; float r = mad(fn, -R_LOG2_BY_64_TL, mad(fn, -R_LOG2_BY_64_LD, x)); // Truncated Taylor series float z2 = mad(r*r, mad(r, mad(r, 0x1.555556p-5f, 0x1.555556p-3f), 0.5f), r); float m2 = as_float((m + EXPBIAS_SP32) << EXPSHIFTBITS_SP32); float2 tv = USE_TABLE(exp_tbl_ep, j); float two_to_jby64_h = tv.s0 * m2; float two_to_jby64_t = tv.s1 * m2; float two_to_jby64 = two_to_jby64_h + two_to_jby64_t; z2 = mad(z2, two_to_jby64, two_to_jby64_t) + (two_to_jby64_h - 1.0f); //Make subnormals work z2 = x == 0.f ? x : z2; z2 = x < X_MIN | m < -24 ? -1.0f : z2; z2 = x > X_MAX ? as_float(PINFBITPATT_SP32) : z2; z2 = isnan(x) ? x : z2; return z2; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, expm1, float) #ifdef cl_khr_fp64 #include "exp_helper.h" #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double expm1(double x) { const double max_expm1_arg = 709.8; const double min_expm1_arg = -37.42994775023704; const double log_OnePlus_OneByFour = 0.22314355131420976; //0x3FCC8FF7C79A9A22 = log(1+1/4) const double log_OneMinus_OneByFour = -0.28768207245178096; //0xBFD269621134DB93 = log(1-1/4) const double sixtyfour_by_lnof2 = 92.33248261689366; //0x40571547652b82fe const double lnof2_by_64_head = 0.010830424696223417; //0x3f862e42fefa0000 const double lnof2_by_64_tail = 2.5728046223276688e-14; //0x3d1cf79abc9e3b39 // First, assume log(1-1/4) < x < log(1+1/4) i.e -0.28768 < x < 0.22314 double u = as_double(as_ulong(x) & 0xffffffffff000000UL); double v = x - u; double y = u * u * 0.5; double z = v * (x + u) * 0.5; double q = fma(x, fma(x, fma(x, fma(x, fma(x, fma(x, fma(x, fma(x,2.4360682937111612e-8, 2.7582184028154370e-7), 2.7558212415361945e-6), 2.4801576918453420e-5), 1.9841269447671544e-4), 1.3888888890687830e-3), 8.3333333334012270e-3), 4.1666666666665560e-2), 1.6666666666666632e-1); q *= x * x * x; double z1g = (u + y) + (q + (v + z)); double z1 = x + (y + (q + z)); z1 = y >= 0x1.0p-7 ? z1g : z1; // Now assume outside interval around 0 int n = (int)(x * sixtyfour_by_lnof2); int j = n & 0x3f; int m = n >> 6; double2 tv = USE_TABLE(two_to_jby64_ep_tbl, j); double f1 = tv.s0; double f2 = tv.s1; double f = f1 + f2; double dn = -n; double r = fma(dn, lnof2_by_64_tail, fma(dn, lnof2_by_64_head, x)); q = fma(r, fma(r, fma(r, fma(r, 1.38889490863777199667e-03, 8.33336798434219616221e-03), 4.16666666662260795726e-02), 1.66666666665260878863e-01), 5.00000000000000008883e-01); q = fma(r*r, q, r); double twopm = as_double((long)(m + EXPBIAS_DP64) << EXPSHIFTBITS_DP64); double twopmm = as_double((long)(EXPBIAS_DP64 - m) << EXPSHIFTBITS_DP64); // Computations for m > 52, including where result is close to Inf ulong uval = as_ulong(0x1.0p+1023 * (f1 + (f * q + (f2)))); int e = (int)(uval >> EXPSHIFTBITS_DP64) + 1; double zme1024 = as_double(((long)e << EXPSHIFTBITS_DP64) | (uval & MANTBITS_DP64)); zme1024 = e == 2047 ? as_double(PINFBITPATT_DP64) : zme1024; double zmg52 = twopm * (f1 + fma(f, q, f2 - twopmm)); zmg52 = m == 1024 ? zme1024 : zmg52; // For m < 53 double zml53 = twopm * ((f1 - twopmm) + fma(f1, q, f2*(1.0 + q))); // For m < -7 double zmln7 = fma(twopm, f1 + fma(f, q, f2), -1.0); z = m < 53 ? zml53 : zmg52; z = m < -7 ? zmln7 : z; z = x > log_OneMinus_OneByFour & x < log_OnePlus_OneByFour ? z1 : z; z = x > max_expm1_arg ? as_double(PINFBITPATT_DP64) : z; z = x < min_expm1_arg ? -1.0 : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, expm1, double) #endif ��libclc-0.2.0+git20180312/generic/lib/math/fdim.cl���������������������������������������������������0000664�0000000�0000000�00000000147�13251554454�0020725�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "math.h" #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fdim.inc��������������������������������������������������0000664�0000000�0000000�00000005446�13251554454�0021107�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * Copyright (c) 2016 Aaron Watry * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #if __CLC_FPSIZE == 32 #ifdef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fdim(__CLC_GENTYPE x, __CLC_GENTYPE y) { if (__builtin_isnan(x) || __builtin_isnan(y)) return as_float(QNANBITPATT_SP32); return fmax(x - y, 0.0f); } #define __CLC_FDIM_VEC(width) \ _CLC_OVERLOAD _CLC_DEF float##width fdim(float##width x, float##width y) { \ /* Determine if x or y is NaN. */ \ /* Vector true is -1, i.e. all-bits-set, and NaN==NaN is false. */ \ /* If either is NaN, then ~((x==x) & (y==y)) will be 0 (e.g. ~(-1)), as will n. */ \ int##width n = ~((x == x) & (y == y)) & QNANBITPATT_SP32; \ /* Calculate x-y if x>y, otherwise positive 0, again taking */ \ /* advantage of vector true being all-bits-set. */ \ int##width r = (x > y) & as_int##width(x - y); \ return as_float##width(n | r); \ } __CLC_FDIM_VEC(2) __CLC_FDIM_VEC(3) __CLC_FDIM_VEC(4) __CLC_FDIM_VEC(8) __CLC_FDIM_VEC(16) #undef __CLC_FDIM_VEC #endif #endif #if __CLC_FPSIZE == 64 #ifdef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fdim(__CLC_GENTYPE x, private __CLC_GENTYPE y) { long n = -(isnan(x) | isnan(y)) & QNANBITPATT_DP64; long r = -(x > y) & as_long(x - y); return as_double(n | r); } #define __CLC_FDIM_VEC(width) \ _CLC_OVERLOAD _CLC_DEF double##width fdim(double##width x, double##width y) { \ /* See comment in float implementation for explanation. */ \ long##width n = ~((x == x) & (y == y)) & QNANBITPATT_DP64; \ long##width r = (x > y) & as_long##width(x - y); \ return as_double##width(n | r); \ } __CLC_FDIM_VEC(2) __CLC_FDIM_VEC(3) __CLC_FDIM_VEC(4) __CLC_FDIM_VEC(8) __CLC_FDIM_VEC(16) #undef __CLC_FDIM_VEC #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fmax.cl���������������������������������������������������0000664�0000000�0000000�00000000515�13251554454�0020740�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_DEFINE_BINARY_BUILTIN(float, fmax, __builtin_fmaxf, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, fmax, __builtin_fmax, double, double); #endif #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fmax.inc��������������������������������������������������0000664�0000000�0000000�00000000651�13251554454�0021114�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #if !defined(__CLC_SCALAR) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmax(__CLC_GENTYPE x, float y) { return fmax(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y)); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmax(__CLC_GENTYPE x, double y) { return fmax(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y)); } #endif // ifdef cl_khr_fp64 #endif // !defined(__CLC_SCALAR) ���������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fmin.cl���������������������������������������������������0000664�0000000�0000000�00000000515�13251554454�0020736�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_DEFINE_BINARY_BUILTIN(float, fmin, __builtin_fminf, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, fmin, __builtin_fmin, double, double); #endif #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fmin.inc��������������������������������������������������0000664�0000000�0000000�00000000651�13251554454�0021112�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #if !defined(__CLC_SCALAR) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmin(__CLC_GENTYPE x, float y) { return fmin(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y)); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmin(__CLC_GENTYPE x, double y) { return fmin(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y)); } #endif // ifdef cl_khr_fp64 #endif // !defined(__CLC_SCALAR) ���������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fmod.cl���������������������������������������������������0000664�0000000�0000000�00000000413�13251554454�0020727�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_DEFINE_BINARY_BUILTIN(float, fmod, __builtin_fmodf, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, fmod, __builtin_fmod, double, double) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fract.cl��������������������������������������������������0000664�0000000�0000000�00000002303�13251554454�0021101�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/fract.inc�������������������������������������������������0000664�0000000�0000000�00000003407�13251554454�0021262�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #if __CLC_FPSIZE == 32 #define MIN_CONSTANT 0x1.fffffep-1f #else #define MIN_CONSTANT 0x1.fffffffffffffp-1 #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fract(__CLC_GENTYPE x, private __CLC_GENTYPE *iptr) { *iptr = floor(x); __CLC_GENTYPE r = fmin(x - *iptr, MIN_CONSTANT); r = isinf(x) ? 0.0f : r; r = isnan(x) ? x : r; return r; } #define FRACT_DEF(addrspace) \ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fract(__CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) { \ __CLC_GENTYPE private_iptr; \ __CLC_GENTYPE ret = fract(x, &private_iptr); \ *iptr = private_iptr; \ return ret; \ } FRACT_DEF(local); FRACT_DEF(global); #undef MIN_CONSTANT ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/frexp.cl��������������������������������������������������0000664�0000000�0000000�00000000642�13251554454�0021132�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #define __CLC_ADDRESS_SPACE private #include #undef __CLC_ADDRESS_SPACE #define __CLC_BODY #define __CLC_ADDRESS_SPACE global #include #undef __CLC_ADDRESS_SPACE #define __CLC_BODY #define __CLC_ADDRESS_SPACE local #include #undef __CLC_ADDRESS_SPACE ����������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/frexp.inc�������������������������������������������������0000664�0000000�0000000�00000006244�13251554454�0021311�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * Copyright (c) 2016 Aaron Watry * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE) #define __CLC_AS_INTN __CLC_XCONCAT(as_, __CLC_INTN) #if __CLC_FPSIZE == 32 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) { __CLC_INTN i = __CLC_AS_INTN(x); __CLC_INTN ai = i & 0x7fffffff; __CLC_INTN d = ai > 0 & ai < 0x00800000; /* scale subnormal by 2^26 without multiplying */ __CLC_GENTYPE s = __CLC_AS_GENTYPE(ai | 0x0d800000) - 0x1.0p-100f; ai = select(ai, __CLC_AS_INTN(s), d); __CLC_INTN e = (ai >> 23) - 126 - select((__CLC_INTN)0, (__CLC_INTN)26, d); __CLC_INTN t = ai == (__CLC_INTN)0 | e == (__CLC_INTN)129; i = (i & (__CLC_INTN)0x80000000) | (__CLC_INTN)0x3f000000 | (ai & 0x007fffff); *ep = select(e, (__CLC_INTN)0, t); return select(__CLC_AS_GENTYPE(i), x, t); } #endif #if __CLC_FPSIZE == 64 #ifdef __CLC_SCALAR #define __CLC_AS_LONGN as_long #define __CLC_LONGN long #define __CLC_CONVERT_INTN convert_int #else #define __CLC_AS_LONGN __CLC_XCONCAT(as_long, __CLC_VECSIZE) #define __CLC_LONGN __CLC_XCONCAT(long, __CLC_VECSIZE) #define __CLC_CONVERT_INTN __CLC_XCONCAT(convert_int, __CLC_VECSIZE) #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE frexp(__CLC_GENTYPE x, __CLC_ADDRESS_SPACE __CLC_INTN *ep) { __CLC_LONGN i = __CLC_AS_LONGN(x); __CLC_LONGN ai = i & 0x7fffffffffffffffL; __CLC_LONGN d = ai > 0 & ai < 0x0010000000000000L; // scale subnormal by 2^54 without multiplying __CLC_GENTYPE s = __CLC_AS_GENTYPE(ai | 0x0370000000000000L) - 0x1.0p-968; ai = select(ai, __CLC_AS_LONGN(s), d); __CLC_LONGN e = (ai >> 52) - (__CLC_LONGN)1022 - select((__CLC_LONGN)0, (__CLC_LONGN)54, d); __CLC_LONGN t = ai == 0 | e == 1025; i = (i & (__CLC_LONGN)0x8000000000000000L) | (__CLC_LONGN)0x3fe0000000000000L | (ai & (__CLC_LONGN)0x000fffffffffffffL); *ep = __CLC_CONVERT_INTN(select(e, 0L, t)); return select(__CLC_AS_GENTYPE(i), x, t); } #undef __CLC_AS_LONGN #undef __CLC_LONGN #undef __CLC_CONVERT_INTN #endif #undef __CLC_AS_GENTYPE #undef __CLC_AS_INTN ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_binary.inc�������������������������������������������0000664�0000000�0000000�00000000341�13251554454�0022433�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE x, __CLC_GENTYPE y) { return __CLC_FUNC(x, y); } #undef __CLC_HALF_FUNC �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_cos.cl�����������������������������������������������0000664�0000000�0000000�00000000206�13251554454�0021560�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC cos #define __CLC_BODY #define __FLOAT_ONLY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_divide.cl��������������������������������������������0000664�0000000�0000000�00000000263�13251554454�0022243�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define divide(x,y) (x/y) #define __CLC_FUNC divide #define __CLC_BODY #define __FLOAT_ONLY #include #undef divide ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_exp.cl�����������������������������������������������0000664�0000000�0000000�00000000206�13251554454�0021570�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC exp #define __CLC_BODY #define __FLOAT_ONLY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_exp10.cl���������������������������������������������0000664�0000000�0000000�00000000210�13251554454�0021724�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC exp10 #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_exp2.cl����������������������������������������������0000664�0000000�0000000�00000000207�13251554454�0021653�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC exp2 #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_log.cl�����������������������������������������������0000664�0000000�0000000�00000000206�13251554454�0021555�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC log #define __CLC_BODY #define __FLOAT_ONLY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_log10.cl���������������������������������������������0000664�0000000�0000000�00000000210�13251554454�0021711�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC log10 #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_log2.cl����������������������������������������������0000664�0000000�0000000�00000000207�13251554454�0021640�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC log2 #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_powr.cl����������������������������������������������0000664�0000000�0000000�00000000210�13251554454�0021756�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC powr #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_recip.cl���������������������������������������������0000664�0000000�0000000�00000000261�13251554454�0022077�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define recip(x) (1.0f/x) #define __CLC_FUNC recip #define __CLC_BODY #define __FLOAT_ONLY #include #undef recip �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_rsqrt.cl���������������������������������������������0000664�0000000�0000000�00000000210�13251554454�0022142�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC rsqrt #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_sin.cl�����������������������������������������������0000664�0000000�0000000�00000000206�13251554454�0021565�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC sin #define __CLC_BODY #define __FLOAT_ONLY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_sqrt.cl����������������������������������������������0000664�0000000�0000000�00000000207�13251554454�0021766�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC sqrt #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_tan.cl�����������������������������������������������0000664�0000000�0000000�00000000206�13251554454�0021556�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_FUNC tan #define __CLC_BODY #define __FLOAT_ONLY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/half_unary.inc��������������������������������������������0000664�0000000�0000000�00000000321�13251554454�0022303�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE val) { return __CLC_FUNC(val); } #undef __CLC_HALF_FUNC ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/hypot.cl��������������������������������������������������0000664�0000000�0000000�00000000125�13251554454�0021145�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/hypot.inc�������������������������������������������������0000664�0000000�0000000�00000000153�13251554454�0021321�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE hypot(__CLC_GENTYPE x, __CLC_GENTYPE y) { return sqrt(x*x + y*y); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/ilogb.cl��������������������������������������������������0000664�0000000�0000000�00000004253�13251554454�0021104�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * Copyright (c) 2016 Aaron Watry * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" #include "math.h" _CLC_OVERLOAD _CLC_DEF int ilogb(float x) { uint ux = as_uint(x); uint ax = ux & EXSIGNBIT_SP32; int rs = -118 - (int) clz(ux & MANTBITS_SP32); int r = (int) (ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; r = ax < 0x00800000U ? rs : r; r = ax > EXPBITS_SP32 | ax == 0 ? 0x80000000 : r; r = ax == EXPBITS_SP32 ? 0x7fffffff : r; return r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, ilogb, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF int ilogb(double x) { ulong ux = as_ulong(x); ulong ax = ux & ~SIGNBIT_DP64; int r = (int) (ax >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64; int rs = -1011 - (int) clz(ax & MANTBITS_DP64); r = ax < 0x0010000000000000UL ? rs : r; r = ax > 0x7ff0000000000000UL | ax == 0UL ? 0x80000000 : r; r = ax == 0x7ff0000000000000UL ? 0x7fffffff : r; return r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, ilogb, double); #endif // cl_khr_fp64 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/ldexp.cl��������������������������������������������������0000664�0000000�0000000�00000003046�13251554454�0021123�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" #include "../clcmacro.h" #include "math.h" #include "math/clc_ldexp.h" _CLC_DEFINE_BINARY_BUILTIN(float, ldexp, __clc_ldexp, float, int) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, ldexp, __clc_ldexp, double, int) #endif // This defines all the ldexp(GENTYPE, int) variants #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/ldexp.inc�������������������������������������������������0000664�0000000�0000000�00000002365�13251554454�0021301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE ldexp(__CLC_GENTYPE x, int n) { return ldexp(x, (__CLC_INTN)n); } #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/lgamma.cl�������������������������������������������������0000664�0000000�0000000�00000003130�13251554454�0021237�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2016 Aaron Watry * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float lgamma(float x) { int s; return lgamma_r(x, &s); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, lgamma, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double lgamma(double x) { int s; return lgamma_r(x, &s); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, lgamma, double) #endif����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/lgamma_r.cl�����������������������������������������������0000664�0000000�0000000�00000046214�13251554454�0021572�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * Copyright (c) 2016 Aaron Watry * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" #include "math.h" /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #define pi_f 3.1415927410e+00f /* 0x40490fdb */ #define a0_f 7.7215664089e-02f /* 0x3d9e233f */ #define a1_f 3.2246702909e-01f /* 0x3ea51a66 */ #define a2_f 6.7352302372e-02f /* 0x3d89f001 */ #define a3_f 2.0580807701e-02f /* 0x3ca89915 */ #define a4_f 7.3855509982e-03f /* 0x3bf2027e */ #define a5_f 2.8905137442e-03f /* 0x3b3d6ec6 */ #define a6_f 1.1927076848e-03f /* 0x3a9c54a1 */ #define a7_f 5.1006977446e-04f /* 0x3a05b634 */ #define a8_f 2.2086278477e-04f /* 0x39679767 */ #define a9_f 1.0801156895e-04f /* 0x38e28445 */ #define a10_f 2.5214456400e-05f /* 0x37d383a2 */ #define a11_f 4.4864096708e-05f /* 0x383c2c75 */ #define tc_f 1.4616321325e+00f /* 0x3fbb16c3 */ #define tf_f -1.2148628384e-01f /* 0xbdf8cdcd */ /* tt -(tail of tf) */ #define tt_f 6.6971006518e-09f /* 0x31e61c52 */ #define t0_f 4.8383611441e-01f /* 0x3ef7b95e */ #define t1_f -1.4758771658e-01f /* 0xbe17213c */ #define t2_f 6.4624942839e-02f /* 0x3d845a15 */ #define t3_f -3.2788541168e-02f /* 0xbd064d47 */ #define t4_f 1.7970675603e-02f /* 0x3c93373d */ #define t5_f -1.0314224288e-02f /* 0xbc28fcfe */ #define t6_f 6.1005386524e-03f /* 0x3bc7e707 */ #define t7_f -3.6845202558e-03f /* 0xbb7177fe */ #define t8_f 2.2596477065e-03f /* 0x3b141699 */ #define t9_f -1.4034647029e-03f /* 0xbab7f476 */ #define t10_f 8.8108185446e-04f /* 0x3a66f867 */ #define t11_f -5.3859531181e-04f /* 0xba0d3085 */ #define t12_f 3.1563205994e-04f /* 0x39a57b6b */ #define t13_f -3.1275415677e-04f /* 0xb9a3f927 */ #define t14_f 3.3552918467e-04f /* 0x39afe9f7 */ #define u0_f -7.7215664089e-02f /* 0xbd9e233f */ #define u1_f 6.3282704353e-01f /* 0x3f2200f4 */ #define u2_f 1.4549225569e+00f /* 0x3fba3ae7 */ #define u3_f 9.7771751881e-01f /* 0x3f7a4bb2 */ #define u4_f 2.2896373272e-01f /* 0x3e6a7578 */ #define u5_f 1.3381091878e-02f /* 0x3c5b3c5e */ #define v1_f 2.4559779167e+00f /* 0x401d2ebe */ #define v2_f 2.1284897327e+00f /* 0x4008392d */ #define v3_f 7.6928514242e-01f /* 0x3f44efdf */ #define v4_f 1.0422264785e-01f /* 0x3dd572af */ #define v5_f 3.2170924824e-03f /* 0x3b52d5db */ #define s0_f -7.7215664089e-02f /* 0xbd9e233f */ #define s1_f 2.1498242021e-01f /* 0x3e5c245a */ #define s2_f 3.2577878237e-01f /* 0x3ea6cc7a */ #define s3_f 1.4635047317e-01f /* 0x3e15dce6 */ #define s4_f 2.6642270386e-02f /* 0x3cda40e4 */ #define s5_f 1.8402845599e-03f /* 0x3af135b4 */ #define s6_f 3.1947532989e-05f /* 0x3805ff67 */ #define r1_f 1.3920053244e+00f /* 0x3fb22d3b */ #define r2_f 7.2193557024e-01f /* 0x3f38d0c5 */ #define r3_f 1.7193385959e-01f /* 0x3e300f6e */ #define r4_f 1.8645919859e-02f /* 0x3c98bf54 */ #define r5_f 7.7794247773e-04f /* 0x3a4beed6 */ #define r6_f 7.3266842264e-06f /* 0x36f5d7bd */ #define w0_f 4.1893854737e-01f /* 0x3ed67f1d */ #define w1_f 8.3333335817e-02f /* 0x3daaaaab */ #define w2_f -2.7777778450e-03f /* 0xbb360b61 */ #define w3_f 7.9365057172e-04f /* 0x3a500cfd */ #define w4_f -5.9518753551e-04f /* 0xba1c065c */ #define w5_f 8.3633989561e-04f /* 0x3a5b3dd2 */ #define w6_f -1.6309292987e-03f /* 0xbad5c4e8 */ _CLC_OVERLOAD _CLC_DEF float lgamma_r(float x, private int *signp) { int hx = as_int(x); int ix = hx & 0x7fffffff; float absx = as_float(ix); if (ix >= 0x7f800000) { *signp = 1; return x; } if (absx < 0x1.0p-70f) { *signp = hx < 0 ? -1 : 1; return -log(absx); } float r; if (absx == 1.0f | absx == 2.0f) r = 0.0f; else if (absx < 2.0f) { float y = 2.0f - absx; int i = 0; int c = absx < 0x1.bb4c30p+0f; float yt = absx - tc_f; y = c ? yt : y; i = c ? 1 : i; c = absx < 0x1.3b4c40p+0f; yt = absx - 1.0f; y = c ? yt : y; i = c ? 2 : i; r = -log(absx); yt = 1.0f - absx; c = absx <= 0x1.ccccccp-1f; r = c ? r : 0.0f; y = c ? yt : y; i = c ? 0 : i; c = absx < 0x1.769440p-1f; yt = absx - (tc_f - 1.0f); y = c ? yt : y; i = c ? 1 : i; c = absx < 0x1.da6610p-3f; y = c ? absx : y; i = c ? 2 : i; float z, w, p1, p2, p3, p; switch (i) { case 0: z = y * y; p1 = mad(z, mad(z, mad(z, mad(z, mad(z, a10_f, a8_f), a6_f), a4_f), a2_f), a0_f); p2 = z * mad(z, mad(z, mad(z, mad(z, mad(z, a11_f, a9_f), a7_f), a5_f), a3_f), a1_f); p = mad(y, p1, p2); r += mad(y, -0.5f, p); break; case 1: z = y * y; w = z * y; p1 = mad(w, mad(w, mad(w, mad(w, t12_f, t9_f), t6_f), t3_f), t0_f); p2 = mad(w, mad(w, mad(w, mad(w, t13_f, t10_f), t7_f), t4_f), t1_f); p3 = mad(w, mad(w, mad(w, mad(w, t14_f, t11_f), t8_f), t5_f), t2_f); p = mad(z, p1, -mad(w, -mad(y, p3, p2), tt_f)); r += tf_f + p; break; case 2: p1 = y * mad(y, mad(y, mad(y, mad(y, mad(y, u5_f, u4_f), u3_f), u2_f), u1_f), u0_f); p2 = mad(y, mad(y, mad(y, mad(y, mad(y, v5_f, v4_f), v3_f), v2_f), v1_f), 1.0f); r += mad(y, -0.5f, MATH_DIVIDE(p1, p2)); break; } } else if (absx < 8.0f) { int i = (int) absx; float y = absx - (float) i; float p = y * mad(y, mad(y, mad(y, mad(y, mad(y, mad(y, s6_f, s5_f), s4_f), s3_f), s2_f), s1_f), s0_f); float q = mad(y, mad(y, mad(y, mad(y, mad(y, mad(y, r6_f, r5_f), r4_f), r3_f), r2_f), r1_f), 1.0f); r = mad(y, 0.5f, MATH_DIVIDE(p, q)); float y6 = y + 6.0f; float y5 = y + 5.0f; float y4 = y + 4.0f; float y3 = y + 3.0f; float y2 = y + 2.0f; float z = 1.0f; z *= i > 6 ? y6 : 1.0f; z *= i > 5 ? y5 : 1.0f; z *= i > 4 ? y4 : 1.0f; z *= i > 3 ? y3 : 1.0f; z *= i > 2 ? y2 : 1.0f; r += log(z); } else if (absx < 0x1.0p+58f) { float z = 1.0f / absx; float y = z * z; float w = mad(z, mad(y, mad(y, mad(y, mad(y, mad(y, w6_f, w5_f), w4_f), w3_f), w2_f), w1_f), w0_f); r = mad(absx - 0.5f, log(absx) - 1.0f, w); } else // 2**58 <= x <= Inf r = absx * (log(absx) - 1.0f); int s = 1; if (x < 0.0f) { float t = sinpi(x); r = log(pi_f / fabs(t * x)) - r; r = t == 0.0f ? as_float(PINFBITPATT_SP32) : r; s = t < 0.0f ? -1 : s; } *signp = s; return r; } _CLC_V_V_VP_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, lgamma_r, float, private, int) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // ==================================================== // Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. // // Developed at SunPro, a Sun Microsystems, Inc. business. // Permission to use, copy, modify, and distribute this // software is freely granted, provided that this notice // is preserved. // ==================================================== // lgamma_r(x, i) // Reentrant version of the logarithm of the Gamma function // with user provide pointer for the sign of Gamma(x). // // Method: // 1. Argument Reduction for 0 < x <= 8 // Since gamma(1+s)=s*gamma(s), for x in [0,8], we may // reduce x to a number in [1.5,2.5] by // lgamma(1+s) = log(s) + lgamma(s) // for example, // lgamma(7.3) = log(6.3) + lgamma(6.3) // = log(6.3*5.3) + lgamma(5.3) // = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) // 2. Polynomial approximation of lgamma around its // minimun ymin=1.461632144968362245 to maintain monotonicity. // On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use // Let z = x-ymin; // lgamma(x) = -1.214862905358496078218 + z^2*poly(z) // where // poly(z) is a 14 degree polynomial. // 2. Rational approximation in the primary interval [2,3] // We use the following approximation: // s = x-2.0; // lgamma(x) = 0.5*s + s*P(s)/Q(s) // with accuracy // |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 // Our algorithms are based on the following observation // // zeta(2)-1 2 zeta(3)-1 3 // lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... // 2 3 // // where Euler = 0.5771... is the Euler constant, which is very // close to 0.5. // // 3. For x>=8, we have // lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... // (better formula: // lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) // Let z = 1/x, then we approximation // f(z) = lgamma(x) - (x-0.5)(log(x)-1) // by // 3 5 11 // w = w0 + w1*z + w2*z + w3*z + ... + w6*z // where // |w - f(z)| < 2**-58.74 // // 4. For negative x, since (G is gamma function) // -x*G(-x)*G(x) = pi/sin(pi*x), // we have // G(x) = pi/(sin(pi*x)*(-x)*G(-x)) // since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 // Hence, for x<0, signgam = sign(sin(pi*x)) and // lgamma(x) = log(|Gamma(x)|) // = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); // Note: one should avoid compute pi*(-x) directly in the // computation of sin(pi*(-x)). // // 5. Special Cases // lgamma(2+s) ~ s*(1-Euler) for tiny s // lgamma(1)=lgamma(2)=0 // lgamma(x) ~ -log(x) for tiny x // lgamma(0) = lgamma(inf) = inf // lgamma(-integer) = +-inf // #define pi 3.14159265358979311600e+00 /* 0x400921FB, 0x54442D18 */ #define a0 7.72156649015328655494e-02 /* 0x3FB3C467, 0xE37DB0C8 */ #define a1 3.22467033424113591611e-01 /* 0x3FD4A34C, 0xC4A60FAD */ #define a2 6.73523010531292681824e-02 /* 0x3FB13E00, 0x1A5562A7 */ #define a3 2.05808084325167332806e-02 /* 0x3F951322, 0xAC92547B */ #define a4 7.38555086081402883957e-03 /* 0x3F7E404F, 0xB68FEFE8 */ #define a5 2.89051383673415629091e-03 /* 0x3F67ADD8, 0xCCB7926B */ #define a6 1.19270763183362067845e-03 /* 0x3F538A94, 0x116F3F5D */ #define a7 5.10069792153511336608e-04 /* 0x3F40B6C6, 0x89B99C00 */ #define a8 2.20862790713908385557e-04 /* 0x3F2CF2EC, 0xED10E54D */ #define a9 1.08011567247583939954e-04 /* 0x3F1C5088, 0x987DFB07 */ #define a10 2.52144565451257326939e-05 /* 0x3EFA7074, 0x428CFA52 */ #define a11 4.48640949618915160150e-05 /* 0x3F07858E, 0x90A45837 */ #define tc 1.46163214496836224576e+00 /* 0x3FF762D8, 0x6356BE3F */ #define tf -1.21486290535849611461e-01 /* 0xBFBF19B9, 0xBCC38A42 */ #define tt -3.63867699703950536541e-18 /* 0xBC50C7CA, 0xA48A971F */ #define t0 4.83836122723810047042e-01 /* 0x3FDEF72B, 0xC8EE38A2 */ #define t1 -1.47587722994593911752e-01 /* 0xBFC2E427, 0x8DC6C509 */ #define t2 6.46249402391333854778e-02 /* 0x3FB08B42, 0x94D5419B */ #define t3 -3.27885410759859649565e-02 /* 0xBFA0C9A8, 0xDF35B713 */ #define t4 1.79706750811820387126e-02 /* 0x3F9266E7, 0x970AF9EC */ #define t5 -1.03142241298341437450e-02 /* 0xBF851F9F, 0xBA91EC6A */ #define t6 6.10053870246291332635e-03 /* 0x3F78FCE0, 0xE370E344 */ #define t7 -3.68452016781138256760e-03 /* 0xBF6E2EFF, 0xB3E914D7 */ #define t8 2.25964780900612472250e-03 /* 0x3F6282D3, 0x2E15C915 */ #define t9 -1.40346469989232843813e-03 /* 0xBF56FE8E, 0xBF2D1AF1 */ #define t10 8.81081882437654011382e-04 /* 0x3F4CDF0C, 0xEF61A8E9 */ #define t11 -5.38595305356740546715e-04 /* 0xBF41A610, 0x9C73E0EC */ #define t12 3.15632070903625950361e-04 /* 0x3F34AF6D, 0x6C0EBBF7 */ #define t13 -3.12754168375120860518e-04 /* 0xBF347F24, 0xECC38C38 */ #define t14 3.35529192635519073543e-04 /* 0x3F35FD3E, 0xE8C2D3F4 */ #define u0 -7.72156649015328655494e-02 /* 0xBFB3C467, 0xE37DB0C8 */ #define u1 6.32827064025093366517e-01 /* 0x3FE4401E, 0x8B005DFF */ #define u2 1.45492250137234768737e+00 /* 0x3FF7475C, 0xD119BD6F */ #define u3 9.77717527963372745603e-01 /* 0x3FEF4976, 0x44EA8450 */ #define u4 2.28963728064692451092e-01 /* 0x3FCD4EAE, 0xF6010924 */ #define u5 1.33810918536787660377e-02 /* 0x3F8B678B, 0xBF2BAB09 */ #define v1 2.45597793713041134822e+00 /* 0x4003A5D7, 0xC2BD619C */ #define v2 2.12848976379893395361e+00 /* 0x40010725, 0xA42B18F5 */ #define v3 7.69285150456672783825e-01 /* 0x3FE89DFB, 0xE45050AF */ #define v4 1.04222645593369134254e-01 /* 0x3FBAAE55, 0xD6537C88 */ #define v5 3.21709242282423911810e-03 /* 0x3F6A5ABB, 0x57D0CF61 */ #define s0 -7.72156649015328655494e-02 /* 0xBFB3C467, 0xE37DB0C8 */ #define s1 2.14982415960608852501e-01 /* 0x3FCB848B, 0x36E20878 */ #define s2 3.25778796408930981787e-01 /* 0x3FD4D98F, 0x4F139F59 */ #define s3 1.46350472652464452805e-01 /* 0x3FC2BB9C, 0xBEE5F2F7 */ #define s4 2.66422703033638609560e-02 /* 0x3F9B481C, 0x7E939961 */ #define s5 1.84028451407337715652e-03 /* 0x3F5E26B6, 0x7368F239 */ #define s6 3.19475326584100867617e-05 /* 0x3F00BFEC, 0xDD17E945 */ #define r1 1.39200533467621045958e+00 /* 0x3FF645A7, 0x62C4AB74 */ #define r2 7.21935547567138069525e-01 /* 0x3FE71A18, 0x93D3DCDC */ #define r3 1.71933865632803078993e-01 /* 0x3FC601ED, 0xCCFBDF27 */ #define r4 1.86459191715652901344e-02 /* 0x3F9317EA, 0x742ED475 */ #define r5 7.77942496381893596434e-04 /* 0x3F497DDA, 0xCA41A95B */ #define r6 7.32668430744625636189e-06 /* 0x3EDEBAF7, 0xA5B38140 */ #define w0 4.18938533204672725052e-01 /* 0x3FDACFE3, 0x90C97D69 */ #define w1 8.33333333333329678849e-02 /* 0x3FB55555, 0x5555553B */ #define w2 -2.77777777728775536470e-03 /* 0xBF66C16C, 0x16B02E5C */ #define w3 7.93650558643019558500e-04 /* 0x3F4A019F, 0x98CF38B6 */ #define w4 -5.95187557450339963135e-04 /* 0xBF4380CB, 0x8C0FE741 */ #define w5 8.36339918996282139126e-04 /* 0x3F4B67BA, 0x4CDAD5D1 */ #define w6 -1.63092934096575273989e-03 /* 0xBF5AB89D, 0x0B9E43E4 */ _CLC_OVERLOAD _CLC_DEF double lgamma_r(double x, private int *ip) { ulong ux = as_ulong(x); ulong ax = ux & EXSIGNBIT_DP64; double absx = as_double(ax); if (ax >= 0x7ff0000000000000UL) { // +-Inf, NaN *ip = 1; return absx; } if (absx < 0x1.0p-70) { *ip = ax == ux ? 1 : -1; return -log(absx); } // Handle rest of range double r; if (absx < 2.0) { int i = 0; double y = 2.0 - absx; int c = absx < 0x1.bb4c3p+0; double t = absx - tc; i = c ? 1 : i; y = c ? t : y; c = absx < 0x1.3b4c4p+0; t = absx - 1.0; i = c ? 2 : i; y = c ? t : y; c = absx <= 0x1.cccccp-1; t = -log(absx); r = c ? t : 0.0; t = 1.0 - absx; i = c ? 0 : i; y = c ? t : y; c = absx < 0x1.76944p-1; t = absx - (tc - 1.0); i = c ? 1 : i; y = c ? t : y; c = absx < 0x1.da661p-3; i = c ? 2 : i; y = c ? absx : y; double p, q; switch (i) { case 0: p = fma(y, fma(y, fma(y, fma(y, a11, a10), a9), a8), a7); p = fma(y, fma(y, fma(y, fma(y, p, a6), a5), a4), a3); p = fma(y, fma(y, fma(y, p, a2), a1), a0); r = fma(y, p - 0.5, r); break; case 1: p = fma(y, fma(y, fma(y, fma(y, t14, t13), t12), t11), t10); p = fma(y, fma(y, fma(y, fma(y, fma(y, p, t9), t8), t7), t6), t5); p = fma(y, fma(y, fma(y, fma(y, fma(y, p, t4), t3), t2), t1), t0); p = fma(y*y, p, -tt); r += (tf + p); break; case 2: p = y * fma(y, fma(y, fma(y, fma(y, fma(y, u5, u4), u3), u2), u1), u0); q = fma(y, fma(y, fma(y, fma(y, fma(y, v5, v4), v3), v2), v1), 1.0); r += fma(-0.5, y, p / q); } } else if (absx < 8.0) { int i = absx; double y = absx - (double) i; double p = y * fma(y, fma(y, fma(y, fma(y, fma(y, fma(y, s6, s5), s4), s3), s2), s1), s0); double q = fma(y, fma(y, fma(y, fma(y, fma(y, fma(y, r6, r5), r4), r3), r2), r1), 1.0); r = fma(0.5, y, p / q); double z = 1.0; // lgamma(1+s) = log(s) + lgamma(s) double y6 = y + 6.0; double y5 = y + 5.0; double y4 = y + 4.0; double y3 = y + 3.0; double y2 = y + 2.0; z *= i > 6 ? y6 : 1.0; z *= i > 5 ? y5 : 1.0; z *= i > 4 ? y4 : 1.0; z *= i > 3 ? y3 : 1.0; z *= i > 2 ? y2 : 1.0; r += log(z); } else { double z = 1.0 / absx; double z2 = z * z; double w = fma(z, fma(z2, fma(z2, fma(z2, fma(z2, fma(z2, w6, w5), w4), w3), w2), w1), w0); r = (absx - 0.5) * (log(absx) - 1.0) + w; } if (x < 0.0) { double t = sinpi(x); r = log(pi / fabs(t * x)) - r; r = t == 0.0 ? as_double(PINFBITPATT_DP64) : r; *ip = t < 0.0 ? -1 : 1; } else *ip = 1; return r; } _CLC_V_V_VP_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, lgamma_r, double, private, int) #endif #define __CLC_ADDRSPACE global #define __CLC_BODY #include #undef __CLC_ADDRSPACE #define __CLC_ADDRSPACE local #define __CLC_BODY #include #undef __CLC_ADDRSPACE ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/lgamma_r.inc����������������������������������������������0000664�0000000�0000000�00000002604�13251554454�0021740�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * Copyright (c) 2016 Aaron Watry * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE lgamma_r(__CLC_GENTYPE x, __CLC_ADDRSPACE __CLC_INTN *iptr) { __CLC_INTN private_iptr; __CLC_GENTYPE ret = lgamma_r(x, &private_iptr); *iptr = private_iptr; return ret; } ����������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/log.cl����������������������������������������������������0000664�0000000�0000000�00000000746�13251554454�0020574�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" /* *log(x) = log2(x) * (1/log2(e)) */ _CLC_OVERLOAD _CLC_DEF float log(float x) { return log2(x) * (1.0f / M_LOG2E_F); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, log, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double log(double x) { return log2(x) * (1.0 / M_LOG2E); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, log, double); #endif // cl_khr_fp64 ��������������������������libclc-0.2.0+git20180312/generic/lib/math/log10.cl��������������������������������������������������0000664�0000000�0000000�00000000125�13251554454�0020724�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/log10.inc�������������������������������������������������0000664�0000000�0000000�00000000675�13251554454�0021111�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE log10(__CLC_GENTYPE val) { // log10(x) = log2(x) / log2(10) // 1 / log2(10) = 0.30102999566 = log10(2) // SP representation is 0.30103 (0x1.344136p-2) // DP representation is 0.301029995659999993762312442414(0x1.34413509E61D8p-2) #if __CLC_FPSIZE == 32 return log2(val) * 0x1.344136p-2f; #elif __CLC_FPSIZE == 64 return log2(val) * 0x1.34413509E61D8p-2; #else #error unknown _CLC_FPSIZE #endif } �������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/log1p.cl��������������������������������������������������0000664�0000000�0000000�00000013474�13251554454�0021037�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float log1p(float x) { float w = x; uint ux = as_uint(x); uint ax = ux & EXSIGNBIT_SP32; // |x| < 2^-4 float u2 = MATH_DIVIDE(x, 2.0f + x); float u = u2 + u2; float v = u * u; // 2/(5 * 2^5), 2/(3 * 2^3) float zsmall = mad(-u2, x, mad(v, 0x1.99999ap-7f, 0x1.555556p-4f) * v * u) + x; // |x| >= 2^-4 ux = as_uint(x + 1.0f); int m = (int)((ux >> EXPSHIFTBITS_SP32) & 0xff) - EXPBIAS_SP32; float mf = (float)m; uint indx = (ux & 0x007f0000) + ((ux & 0x00008000) << 1); float F = as_float(indx | 0x3f000000); // x > 2^24 float fg24 = F - as_float(0x3f000000 | (ux & MANTBITS_SP32)); // x <= 2^24 uint xhi = ux & 0xffff8000; float xh = as_float(xhi); float xt = (1.0f - xh) + w; uint xnm = ((~(xhi & 0x7f800000)) - 0x00800000) & 0x7f800000; xt = xt * as_float(xnm) * 0.5f; float fl24 = F - as_float(0x3f000000 | (xhi & MANTBITS_SP32)) - xt; float f = mf > 24.0f ? fg24 : fl24; indx = indx >> 16; float r = f * USE_TABLE(log_inv_tbl, indx); // 1/3, 1/2 float poly = mad(mad(r, 0x1.555556p-2f, 0x1.0p-1f), r*r, r); const float LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833 float2 tv = USE_TABLE(loge_tbl, indx); float z1 = mad(mf, LOG2_HEAD, tv.s0); float z2 = mad(mf, LOG2_TAIL, -poly) + tv.s1; float z = z1 + z2; z = ax < 0x3d800000U ? zsmall : z; // Edge cases z = ax >= PINFBITPATT_SP32 ? w : z; z = w < -1.0f ? as_float(QNANBITPATT_SP32) : z; z = w == -1.0f ? as_float(NINFBITPATT_SP32) : z; //fix subnormals z = ax < 0x33800000 ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, log1p, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double log1p(double x) { // Computes natural log(1+x). Algorithm based on: // Ping-Tak Peter Tang // "Table-driven implementation of the logarithm function in IEEE // floating-point arithmetic" // ACM Transactions on Mathematical Software (TOMS) // Volume 16, Issue 4 (December 1990) // Note that we use a lookup table of size 64 rather than 128, // and compensate by having extra terms in the minimax polynomial // for the kernel approximation. // Process Inside the threshold now ulong ux = as_ulong(1.0 + x); int xexp = ((as_int2(ux).hi >> 20) & 0x7ff) - EXPBIAS_DP64; double f = as_double(ONEEXPBITS_DP64 | (ux & MANTBITS_DP64)); int j = as_int2(ux).hi >> 13; j = ((0x80 | (j & 0x7e)) >> 1) + (j & 0x1); double f1 = (double)j * 0x1.0p-6; j -= 64; double f2temp = f - f1; double m2 = as_double(convert_ulong(0x3ff - xexp) << EXPSHIFTBITS_DP64); double f2l = fma(m2, x, m2 - f1); double f2g = fma(m2, x, -f1) + m2; double f2 = xexp <= MANTLENGTH_DP64-1 ? f2l : f2g; f2 = (xexp <= -2) | (xexp >= MANTLENGTH_DP64+8) ? f2temp : f2; double2 tv = USE_TABLE(ln_tbl, j); double z1 = tv.s0; double q = tv.s1; double u = MATH_DIVIDE(f2, fma(0.5, f2, f1)); double v = u * u; double poly = v * fma(v, fma(v, 2.23219810758559851206e-03, 1.24999999978138668903e-02), 8.33333333333333593622e-02); // log2_lead and log2_tail sum to an extra-precise version of log(2) const double log2_lead = 6.93147122859954833984e-01; /* 0x3fe62e42e0000000 */ const double log2_tail = 5.76999904754328540596e-08; /* 0x3e6efa39ef35793c */ double z2 = q + fma(u, poly, u); double dxexp = (double)xexp; double r1 = fma(dxexp, log2_lead, z1); double r2 = fma(dxexp, log2_tail, z2); double result1 = r1 + r2; // Process Outside the threshold now double r = x; u = r / (2.0 + r); double correction = r * u; u = u + u; v = u * u; r1 = r; poly = fma(v, fma(v, fma(v, 4.34887777707614552256e-04, 2.23213998791944806202e-03), 1.25000000037717509602e-02), 8.33333333333317923934e-02); r2 = fma(u*v, poly, -correction); // The values exp(-1/16)-1 and exp(1/16)-1 const double log1p_thresh1 = -0x1.f0540438fd5c3p-5; const double log1p_thresh2 = 0x1.082b577d34ed8p-4; double result2 = r1 + r2; result2 = x < log1p_thresh1 | x > log1p_thresh2 ? result1 : result2; result2 = isinf(x) ? x : result2; result2 = x < -1.0 ? as_double(QNANBITPATT_DP64) : result2; result2 = x == -1.0 ? as_double(NINFBITPATT_DP64) : result2; return result2; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, log1p, double); #endif // cl_khr_fp64 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/log2.cl���������������������������������������������������0000664�0000000�0000000�00000002775�13251554454�0020662�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" #include "tables.h" #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable #endif // cl_khr_fp64 #define COMPILING_LOG2 #include "log_base.h" #undef COMPILING_LOG2 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, log2, float); #ifdef cl_khr_fp64 _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, log2, double); #endif // cl_khr_fp64 ���libclc-0.2.0+git20180312/generic/lib/math/log_base.h������������������������������������������������0000664�0000000�0000000�00000023163�13251554454�0021415�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "math.h" /* Algorithm: Based on: Ping-Tak Peter Tang "Table-driven implementation of the logarithm function in IEEE floating-point arithmetic" ACM Transactions on Mathematical Software (TOMS) Volume 16, Issue 4 (December 1990) x very close to 1.0 is handled differently, for x everywhere else a brief explanation is given below x = (2^m)*A x = (2^m)*(G+g) with (1 <= G < 2) and (g <= 2^(-8)) x = (2^m)*2*(G/2+g/2) x = (2^m)*2*(F+f) with (0.5 <= F < 1) and (f <= 2^(-9)) Y = (2^(-1))*(2^(-m))*(2^m)*A Now, range of Y is: 0.5 <= Y < 1 F = 0x80 + (first 7 mantissa bits) + (8th mantissa bit) Now, range of F is: 128 <= F <= 256 F = F / 256 Now, range of F is: 0.5 <= F <= 1 f = -(Y-F), with (f <= 2^(-9)) log(x) = m*log(2) + log(2) + log(F-f) log(x) = m*log(2) + log(2) + log(F) + log(1-(f/F)) log(x) = m*log(2) + log(2*F) + log(1-r) r = (f/F), with (r <= 2^(-8)) r = f*(1/F) with (1/F) precomputed to avoid division log(x) = m*log(2) + log(G) - poly log(G) is precomputed poly = (r + (r^2)/2 + (r^3)/3 + (r^4)/4) + (r^5)/5)) log(2) and log(G) need to be maintained in extra precision to avoid losing precision in the calculations For x close to 1.0, we employ the following technique to ensure faster convergence. log(x) = log((1+s)/(1-s)) = 2*s + (2/3)*s^3 + (2/5)*s^5 + (2/7)*s^7 x = ((1+s)/(1-s)) x = 1 + r s = r/(2+r) */ _CLC_OVERLOAD _CLC_DEF float #if defined(COMPILING_LOG2) log2(float x) #elif defined(COMPILING_LOG10) log10(float x) #else log(float x) #endif { #if defined(COMPILING_LOG2) const float LOG2E = 0x1.715476p+0f; // 1.4426950408889634 const float LOG2E_HEAD = 0x1.700000p+0f; // 1.4375 const float LOG2E_TAIL = 0x1.547652p-8f; // 0.00519504072 #elif defined(COMPILING_LOG10) USE_TABLE(float2, p_log, LOG10_TBL); const float LOG10E = 0x1.bcb7b2p-2f; // 0.43429448190325182 const float LOG10E_HEAD = 0x1.bc0000p-2f; // 0.43359375 const float LOG10E_TAIL = 0x1.6f62a4p-11f; // 0.0007007319 const float LOG10_2_HEAD = 0x1.340000p-2f; // 0.30078125 const float LOG10_2_TAIL = 0x1.04d426p-12f; // 0.000248745637 #else USE_TABLE(float2, p_log, LOGE_TBL); const float LOG2_HEAD = 0x1.62e000p-1f; // 0.693115234 const float LOG2_TAIL = 0x1.0bfbe8p-15f; // 0.0000319461833 #endif uint xi = as_uint(x); uint ax = xi & EXSIGNBIT_SP32; // Calculations for |x-1| < 2^-4 float r = x - 1.0f; int near1 = fabs(r) < 0x1.0p-4f; float u2 = MATH_DIVIDE(r, 2.0f + r); float corr = u2 * r; float u = u2 + u2; float v = u * u; float znear1, z1, z2; // 2/(5 * 2^5), 2/(3 * 2^3) z2 = mad(u, mad(v, 0x1.99999ap-7f, 0x1.555556p-4f)*v, -corr); #if defined(COMPILING_LOG2) z1 = as_float(as_int(r) & 0xffff0000); z2 = z2 + (r - z1); znear1 = mad(z1, LOG2E_HEAD, mad(z2, LOG2E_HEAD, mad(z1, LOG2E_TAIL, z2*LOG2E_TAIL))); #elif defined(COMPILING_LOG10) z1 = as_float(as_int(r) & 0xffff0000); z2 = z2 + (r - z1); znear1 = mad(z1, LOG10E_HEAD, mad(z2, LOG10E_HEAD, mad(z1, LOG10E_TAIL, z2*LOG10E_TAIL))); #else znear1 = z2 + r; #endif // Calculations for x not near 1 int m = (int)(xi >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; // Normalize subnormal uint xis = as_uint(as_float(xi | 0x3f800000) - 1.0f); int ms = (int)(xis >> EXPSHIFTBITS_SP32) - 253; int c = m == -127; m = c ? ms : m; uint xin = c ? xis : xi; float mf = (float)m; uint indx = (xin & 0x007f0000) + ((xin & 0x00008000) << 1); // F - Y float f = as_float(0x3f000000 | indx) - as_float(0x3f000000 | (xin & MANTBITS_SP32)); indx = indx >> 16; r = f * USE_TABLE(log_inv_tbl, indx); // 1/3, 1/2 float poly = mad(mad(r, 0x1.555556p-2f, 0.5f), r*r, r); #if defined(COMPILING_LOG2) float2 tv = USE_TABLE(log2_tbl, indx); z1 = tv.s0 + mf; z2 = mad(poly, -LOG2E, tv.s1); #elif defined(COMPILING_LOG10) float2 tv = p_log[indx]; z1 = mad(mf, LOG10_2_HEAD, tv.s0); z2 = mad(poly, -LOG10E, mf*LOG10_2_TAIL) + tv.s1; #else float2 tv = p_log[indx]; z1 = mad(mf, LOG2_HEAD, tv.s0); z2 = mad(mf, LOG2_TAIL, -poly) + tv.s1; #endif float z = z1 + z2; z = near1 ? znear1 : z; // Corner cases z = ax >= PINFBITPATT_SP32 ? x : z; z = xi != ax ? as_float(QNANBITPATT_SP32) : z; z = ax == 0 ? as_float(NINFBITPATT_SP32) : z; return z; } #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DEF double #if defined(COMPILING_LOG2) log2(double x) #elif defined(COMPILING_LOG10) log10(double x) #else log(double x) #endif { #ifndef COMPILING_LOG2 // log2_lead and log2_tail sum to an extra-precise version of ln(2) const double log2_lead = 6.93147122859954833984e-01; /* 0x3fe62e42e0000000 */ const double log2_tail = 5.76999904754328540596e-08; /* 0x3e6efa39ef35793c */ #endif #if defined(COMPILING_LOG10) // log10e_lead and log10e_tail sum to an extra-precision version of log10(e) (19 bits in lead) const double log10e_lead = 4.34293746948242187500e-01; /* 0x3fdbcb7800000000 */ const double log10e_tail = 7.3495500964015109100644e-7; /* 0x3ea8a93728719535 */ #elif defined(COMPILING_LOG2) // log2e_lead and log2e_tail sum to an extra-precision version of log2(e) (19 bits in lead) const double log2e_lead = 1.44269180297851562500E+00; /* 0x3FF7154400000000 */ const double log2e_tail = 3.23791044778235969970E-06; /* 0x3ECB295C17F0BBBE */ #endif // log_thresh1 = 9.39412117004394531250e-1 = 0x3fee0faa00000000 // log_thresh2 = 1.06449508666992187500 = 0x3ff1082c00000000 const double log_thresh1 = 0x1.e0faap-1; const double log_thresh2 = 0x1.1082cp+0; int is_near = x >= log_thresh1 & x <= log_thresh2; // Near 1 code double r = x - 1.0; double u = r / (2.0 + r); double correction = r * u; u = u + u; double v = u * u; double r1 = r; const double ca_1 = 8.33333333333317923934e-02; /* 0x3fb55555555554e6 */ const double ca_2 = 1.25000000037717509602e-02; /* 0x3f89999999bac6d4 */ const double ca_3 = 2.23213998791944806202e-03; /* 0x3f62492307f1519f */ const double ca_4 = 4.34887777707614552256e-04; /* 0x3f3c8034c85dfff0 */ double r2 = fma(u*v, fma(v, fma(v, fma(v, ca_4, ca_3), ca_2), ca_1), -correction); #if defined(COMPILING_LOG10) r = r1; r1 = as_double(as_ulong(r1) & 0xffffffff00000000); r2 = r2 + (r - r1); double ret_near = fma(log10e_lead, r1, fma(log10e_lead, r2, fma(log10e_tail, r1, log10e_tail * r2))); #elif defined(COMPILING_LOG2) r = r1; r1 = as_double(as_ulong(r1) & 0xffffffff00000000); r2 = r2 + (r - r1); double ret_near = fma(log2e_lead, r1, fma(log2e_lead, r2, fma(log2e_tail, r1, log2e_tail*r2))); #else double ret_near = r1 + r2; #endif // This is the far from 1 code // Deal with subnormal ulong ux = as_ulong(x); ulong uxs = as_ulong(as_double(0x03d0000000000000UL | ux) - 0x1.0p-962); int c = ux < IMPBIT_DP64; ux = c ? uxs : ux; int expadjust = c ? 60 : 0; int xexp = ((as_int2(ux).hi >> 20) & 0x7ff) - EXPBIAS_DP64 - expadjust; double f = as_double(HALFEXPBITS_DP64 | (ux & MANTBITS_DP64)); int index = as_int2(ux).hi >> 13; index = ((0x80 | (index & 0x7e)) >> 1) + (index & 0x1); double2 tv = USE_TABLE(ln_tbl, index - 64); double z1 = tv.s0; double q = tv.s1; double f1 = index * 0x1.0p-7; double f2 = f - f1; u = f2 / fma(f2, 0.5, f1); v = u * u; const double cb_1 = 8.33333333333333593622e-02; /* 0x3fb5555555555557 */ const double cb_2 = 1.24999999978138668903e-02; /* 0x3f89999999865ede */ const double cb_3 = 2.23219810758559851206e-03; /* 0x3f6249423bd94741 */ double poly = v * fma(v, fma(v, cb_3, cb_2), cb_1); double z2 = q + fma(u, poly, u); double dxexp = (double)xexp; #if defined (COMPILING_LOG10) // Add xexp * log(2) to z1,z2 to get log(x) r1 = fma(dxexp, log2_lead, z1); r2 = fma(dxexp, log2_tail, z2); double ret_far = fma(log10e_lead, r1, fma(log10e_lead, r2, fma(log10e_tail, r1, log10e_tail*r2))); #elif defined(COMPILING_LOG2) r1 = fma(log2e_lead, z1, dxexp); r2 = fma(log2e_lead, z2, fma(log2e_tail, z1, log2e_tail*z2)); double ret_far = r1 + r2; #else r1 = fma(dxexp, log2_lead, z1); r2 = fma(dxexp, log2_tail, z2); double ret_far = r1 + r2; #endif double ret = is_near ? ret_near : ret_far; ret = isinf(x) ? as_double(PINFBITPATT_DP64) : ret; ret = isnan(x) | (x < 0.0) ? as_double(QNANBITPATT_DP64) : ret; ret = x == 0.0 ? as_double(NINFBITPATT_DP64) : ret; return ret; } #endif // cl_khr_fp64 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/logb.cl���������������������������������������������������0000664�0000000�0000000�00000001660�13251554454�0020732�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float logb(float x) { int ax = as_int(x) & EXSIGNBIT_SP32; float s = -118 - clz(ax); float r = (ax >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32; r = ax >= PINFBITPATT_SP32 ? as_float(ax) : r; r = ax < 0x00800000 ? s : r; r = ax == 0 ? as_float(NINFBITPATT_SP32) : r; return r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, logb, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double logb(double x) { long ax = as_long(x) & EXSIGNBIT_DP64; double s = -1011L - clz(ax); double r = (int) (ax >> EXPSHIFTBITS_DP64) - EXPBIAS_DP64; r = ax >= PINFBITPATT_DP64 ? as_double(ax) : r; r = ax < 0x0010000000000000L ? s : r; r = ax == 0L ? as_double(NINFBITPATT_DP64) : r; return r; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, logb, double) #endif ��������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/mad.cl����������������������������������������������������0000664�0000000�0000000�00000000123�13251554454�0020541�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/mad.inc���������������������������������������������������0000664�0000000�0000000�00000000164�13251554454�0020721�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE mad(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c) { return a * b + c; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/math.h����������������������������������������������������0000664�0000000�0000000�00000006321�13251554454�0020570�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define SNAN 0x001 #define QNAN 0x002 #define NINF 0x004 #define NNOR 0x008 #define NSUB 0x010 #define NZER 0x020 #define PZER 0x040 #define PSUB 0x080 #define PNOR 0x100 #define PINF 0x200 #if (defined __AMDGCN__ || defined __R600__) && !defined __HAS_FMAF__ #define HAVE_HW_FMA32() (0) #else #define HAVE_HW_FMA32() (1) #endif #define HAVE_BITALIGN() (0) #define HAVE_FAST_FMA32() (0) #define MATH_DIVIDE(X, Y) ((X) / (Y)) #define MATH_RECIP(X) (1.0f / (X)) #define MATH_SQRT(X) sqrt(X) #define SIGNBIT_SP32 0x80000000 #define EXSIGNBIT_SP32 0x7fffffff #define EXPBITS_SP32 0x7f800000 #define MANTBITS_SP32 0x007fffff #define ONEEXPBITS_SP32 0x3f800000 #define TWOEXPBITS_SP32 0x40000000 #define HALFEXPBITS_SP32 0x3f000000 #define IMPBIT_SP32 0x00800000 #define QNANBITPATT_SP32 0x7fc00000 #define INDEFBITPATT_SP32 0xffc00000 #define PINFBITPATT_SP32 0x7f800000 #define NINFBITPATT_SP32 0xff800000 #define EXPBIAS_SP32 127 #define EXPSHIFTBITS_SP32 23 #define BIASEDEMIN_SP32 1 #define EMIN_SP32 -126 #define BIASEDEMAX_SP32 254 #define EMAX_SP32 127 #define LAMBDA_SP32 1.0e30 #define MANTLENGTH_SP32 24 #define BASEDIGITS_SP32 7 #ifdef cl_khr_fp64 #define SIGNBIT_DP64 0x8000000000000000L #define EXSIGNBIT_DP64 0x7fffffffffffffffL #define EXPBITS_DP64 0x7ff0000000000000L #define MANTBITS_DP64 0x000fffffffffffffL #define ONEEXPBITS_DP64 0x3ff0000000000000L #define TWOEXPBITS_DP64 0x4000000000000000L #define HALFEXPBITS_DP64 0x3fe0000000000000L #define IMPBIT_DP64 0x0010000000000000L #define QNANBITPATT_DP64 0x7ff8000000000000L #define INDEFBITPATT_DP64 0xfff8000000000000L #define PINFBITPATT_DP64 0x7ff0000000000000L #define NINFBITPATT_DP64 0xfff0000000000000L #define EXPBIAS_DP64 1023 #define EXPSHIFTBITS_DP64 52 #define BIASEDEMIN_DP64 1 #define EMIN_DP64 -1022 #define BIASEDEMAX_DP64 2046 /* 0x7fe */ #define EMAX_DP64 1023 /* 0x3ff */ #define LAMBDA_DP64 1.0e300 #define MANTLENGTH_DP64 53 #define BASEDIGITS_DP64 15 #endif // cl_khr_fp64 #define ALIGNED(x) __attribute__((aligned(x))) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/maxmag.cl�������������������������������������������������0000664�0000000�0000000�00000000151�13251554454�0021253�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/maxmag.inc������������������������������������������������0000664�0000000�0000000�00000001265�13251554454�0021435�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_long, __CLC_VECSIZE) #elif __CLC_FPSIZE == 32 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_int, __CLC_VECSIZE) #elif __CLC_FPSIZE == 16 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_short, __CLC_VECSIZE) #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE maxmag(__CLC_GENTYPE x, __CLC_GENTYPE y) { const __CLC_GENTYPE res = select(y, x, __CLC_CONVERT_NATN(isgreater(fabs(x), fabs(y)))); return select(res, fmax(x, y), __CLC_CONVERT_NATN(isnan(x) | isnan(y) | isequal(fabs(x), fabs(y)))); } #undef __CLC_CONVERT_NATN #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/minmag.cl�������������������������������������������������0000664�0000000�0000000�00000000151�13251554454�0021251�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/minmag.inc������������������������������������������������0000664�0000000�0000000�00000001262�13251554454�0021430�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_long, __CLC_VECSIZE) #elif __CLC_FPSIZE == 32 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_int, __CLC_VECSIZE) #elif __CLC_FPSIZE == 16 #define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_short, __CLC_VECSIZE) #endif _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE minmag(__CLC_GENTYPE x, __CLC_GENTYPE y) { const __CLC_GENTYPE res = select(y, x, __CLC_CONVERT_NATN(isless(fabs(x), fabs(y)))); return select(res, fmin(x, y), __CLC_CONVERT_NATN(isnan(x) | isnan(y) | isequal(fabs(x), fabs(y)))); } #undef __CLC_CONVERT_NATN #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/modf.cl���������������������������������������������������0000664�0000000�0000000�00000002325�13251554454�0020733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #define __CLC_BODY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/modf.inc��������������������������������������������������0000664�0000000�0000000�00000003060�13251554454�0021103�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE modf(__CLC_GENTYPE x, __CLC_GENTYPE *iptr) { *iptr = trunc(x); return copysign(isinf(x) ? 0.0f : x - *iptr, x); } #define MODF_DEF(addrspace) \ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE modf(__CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) { \ __CLC_GENTYPE private_iptr; \ __CLC_GENTYPE ret = modf(x, &private_iptr); \ *iptr = private_iptr; \ return ret; \ } MODF_DEF(local); MODF_DEF(global); ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/nan.cl����������������������������������������������������0000664�0000000�0000000�00000000241�13251554454�0020555�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "utils.h" #define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE) #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/nan.inc���������������������������������������������������0000664�0000000�0000000�00000000631�13251554454�0020733�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE nan(__CLC_XCONCAT(ulong, __CLC_VECSIZE) code) { return __CLC_AS_GENTYPE(code | 0x7ff0000000000000ul); } #else _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE nan(__CLC_XCONCAT(uint, __CLC_VECSIZE) code) { return __CLC_AS_GENTYPE(code | 0x7fc00000); } #endif #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif �������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_cos.cl���������������������������������������������0000664�0000000�0000000�00000000237�13251554454�0022140�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC cos #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_divide.cl������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0022615�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_divide.inc�����������������������������������������0000664�0000000�0000000�00000000151�13251554454�0022766�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_divide(__CLC_GENTYPE x, __CLC_GENTYPE y) { return x / y; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_exp.cl���������������������������������������������0000664�0000000�0000000�00000000237�13251554454�0022150�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC exp #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_exp10.cl�������������������������������������������0000664�0000000�0000000�00000000161�13251554454�0022305�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_exp10.inc������������������������������������������0000664�0000000�0000000�00000000161�13251554454�0022460�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_exp10(__CLC_GENTYPE val) { return native_exp2(val * M_LOG210_F); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_exp2.cl��������������������������������������������0000664�0000000�0000000�00000000240�13251554454�0022224�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC exp2 #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_log.cl���������������������������������������������0000664�0000000�0000000�00000002422�13251554454�0022133�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #define __CLC_NATIVE_INTRINSIC log #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_log10.cl�������������������������������������������0000664�0000000�0000000�00000000241�13251554454�0022271�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC log10 #define __CLC_BODY #define __FLOAT_ONLY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_log2.cl��������������������������������������������0000664�0000000�0000000�00000002422�13251554454�0022215�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #define __CLC_NATIVE_INTRINSIC log2 #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_powr.cl��������������������������������������������0000664�0000000�0000000�00000000160�13251554454�0022336�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_powr.inc�������������������������������������������0000664�0000000�0000000�00000000331�13251554454�0022511�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_powr(__CLC_GENTYPE x, __CLC_GENTYPE y) { // x^y == 2^{log2 x^y} == 2^{y * log2 x} // for x < 0 propagate nan created by log2 return native_exp2(y * native_log2(x)); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_recip.cl�������������������������������������������0000664�0000000�0000000�00000000161�13251554454�0022452�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_recip.inc������������������������������������������0000664�0000000�0000000�00000000136�13251554454�0022627�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_recip(__CLC_GENTYPE val) { return 1.0f / val; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_rsqrt.cl�������������������������������������������0000664�0000000�0000000�00000000161�13251554454�0022523�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_rsqrt.inc������������������������������������������0000664�0000000�0000000�00000000153�13251554454�0022677�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_rsqrt(__CLC_GENTYPE val) { return 1.0f / native_sqrt(val); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_sin.cl���������������������������������������������0000664�0000000�0000000�00000000237�13251554454�0022145�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC sin #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_sqrt.cl��������������������������������������������0000664�0000000�0000000�00000000240�13251554454�0022337�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_NATIVE_INTRINSIC sqrt #define __CLC_BODY #define __FLOAT_ONLY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_tan.cl���������������������������������������������0000664�0000000�0000000�00000000157�13251554454�0022137�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #define __FLOAT_ONLY #include �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_tan.inc��������������������������������������������0000664�0000000�0000000�00000000163�13251554454�0022307�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_tan(__CLC_GENTYPE val) { return native_sin(val) / native_cos(val); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/native_unary_intrinsic.inc��������������������������������0000664�0000000�0000000�00000003131�13251554454�0024743�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #ifdef __CLC_SCALAR #define __CLC_FUNCTION __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC) #define __CLC_INTRINSIC "llvm." __CLC_XSTR(__CLC_NATIVE_INTRINSIC) #undef cl_khr_fp64 #include #endif #define __CLC_FUNCTION __CLC_XCONCAT(native_, __CLC_NATIVE_INTRINSIC) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE val) { return __CLC_XCONCAT(__clc_native_, __CLC_NATIVE_INTRINSIC)(val); } #undef __CLC_FUNCTION ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/nextafter.cl����������������������������������������������0000664�0000000�0000000�00000000437�13251554454�0022010�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../clcmacro.h" _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __builtin_nextafterf, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, nextafter, __builtin_nextafter, double, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/pow.cl����������������������������������������������������0000664�0000000�0000000�00000000217�13251554454�0020611�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_FUNC pow #define __CLC_BODY #include ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/pown.cl���������������������������������������������������0000664�0000000�0000000�00000000160�13251554454�0020764�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/pown.inc��������������������������������������������������0000664�0000000�0000000�00000000150�13251554454�0021136�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE pown(__CLC_GENTYPE x, __CLC_INTN y) { return __clc_pown(x, y); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/powr.cl���������������������������������������������������0000664�0000000�0000000�00000000221�13251554454�0020766�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_FUNC powr #define __CLC_BODY #include �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/rootn.cl��������������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0021144�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #include ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/rootn.inc�������������������������������������������������0000664�0000000�0000000�00000000152�13251554454�0021316�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE rootn(__CLC_GENTYPE x, __CLC_INTN y) { return __clc_rootn(x, y); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sin.cl����������������������������������������������������0000664�0000000�0000000�00000004571�13251554454�0020604�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincos_helpers.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float sin(float x) { int ix = as_int(x); int ax = ix & 0x7fffffff; float dx = as_float(ax); float r0, r1; int regn = __clc_argReductionS(&r0, &r1, dx); float ss = __clc_sinf_piby4(r0, r1); float cc = __clc_cosf_piby4(r0, r1); float s = (regn & 1) != 0 ? cc : ss; s = as_float(as_int(s) ^ ((regn > 1) << 31) ^ (ix ^ ax)); s = ax >= PINFBITPATT_SP32 ? as_float(QNANBITPATT_SP32) : s; //Subnormals s = x == 0.0f ? x : s; return s; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, sin, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double sin(double x) { double y = fabs(x); double r, rr; int regn; if (y < 0x1.0p+47) __clc_remainder_piby2_medium(y, &r, &rr, ®n); else __clc_remainder_piby2_large(y, &r, &rr, ®n); double2 sc = __clc_sincos_piby4(r, rr); int2 s = as_int2(regn & 1 ? sc.hi : sc.lo); s.hi ^= ((regn > 1) << 31) ^ ((x < 0.0) << 31); return isinf(x) | isnan(x) ? as_double(QNANBITPATT_DP64) : as_double(s); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sin, double); #endif ���������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincos.cl�������������������������������������������������0000664�0000000�0000000�00000000126�13251554454�0021301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincos.inc������������������������������������������������0000664�0000000�0000000�00000000516�13251554454�0021457�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#define __CLC_DECLARE_SINCOS(ADDRSPACE, TYPE) \ _CLC_OVERLOAD _CLC_DEF TYPE sincos (TYPE x, ADDRSPACE TYPE * cosval) { \ *cosval = cos(x); \ return sin(x); \ } __CLC_DECLARE_SINCOS(global, __CLC_GENTYPE) __CLC_DECLARE_SINCOS(local, __CLC_GENTYPE) __CLC_DECLARE_SINCOS(private, __CLC_GENTYPE) #undef __CLC_DECLARE_SINCOS ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincosD_piby4.h�������������������������������������������0000664�0000000�0000000�00000012434�13251554454�0022352�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_INLINE double2 __libclc__sincos_piby4(double x, double xx) { // Taylor series for sin(x) is x - x^3/3! + x^5/5! - x^7/7! ... // = x * (1 - x^2/3! + x^4/5! - x^6/7! ... // = x * f(w) // where w = x*x and f(w) = (1 - w/3! + w^2/5! - w^3/7! ... // We use a minimax approximation of (f(w) - 1) / w // because this produces an expansion in even powers of x. // If xx (the tail of x) is non-zero, we add a correction // term g(x,xx) = (1-x*x/2)*xx to the result, where g(x,xx) // is an approximation to cos(x)*sin(xx) valid because // xx is tiny relative to x. // Taylor series for cos(x) is 1 - x^2/2! + x^4/4! - x^6/6! ... // = f(w) // where w = x*x and f(w) = (1 - w/2! + w^2/4! - w^3/6! ... // We use a minimax approximation of (f(w) - 1 + w/2) / (w*w) // because this produces an expansion in even powers of x. // If xx (the tail of x) is non-zero, we subtract a correction // term g(x,xx) = x*xx to the result, where g(x,xx) // is an approximation to sin(x)*sin(xx) valid because // xx is tiny relative to x. const double sc1 = -0.166666666666666646259241729; const double sc2 = 0.833333333333095043065222816e-2; const double sc3 = -0.19841269836761125688538679e-3; const double sc4 = 0.275573161037288022676895908448e-5; const double sc5 = -0.25051132068021699772257377197e-7; const double sc6 = 0.159181443044859136852668200e-9; const double cc1 = 0.41666666666666665390037e-1; const double cc2 = -0.13888888888887398280412e-2; const double cc3 = 0.248015872987670414957399e-4; const double cc4 = -0.275573172723441909470836e-6; const double cc5 = 0.208761463822329611076335e-8; const double cc6 = -0.113826398067944859590880e-10; double x2 = x * x; double x3 = x2 * x; double r = 0.5 * x2; double t = 1.0 - r; double sp = fma(fma(fma(fma(sc6, x2, sc5), x2, sc4), x2, sc3), x2, sc2); double cp = t + fma(fma(fma(fma(fma(fma(cc6, x2, cc5), x2, cc4), x2, cc3), x2, cc2), x2, cc1), x2*x2, fma(x, xx, (1.0 - t) - r)); double2 ret; ret.lo = x - fma(-x3, sc1, fma(fma(-x3, sp, 0.5*xx), x2, -xx)); ret.hi = cp; return ret; } _CLC_INLINE double2 __clc_tan_piby4(double x, double xx) { const double piby4_lead = 7.85398163397448278999e-01; // 0x3fe921fb54442d18 const double piby4_tail = 3.06161699786838240164e-17; // 0x3c81a62633145c06 // In order to maintain relative precision transform using the identity: // tan(pi/4-x) = (1-tan(x))/(1+tan(x)) for arguments close to pi/4. // Similarly use tan(x-pi/4) = (tan(x)-1)/(tan(x)+1) close to -pi/4. int ca = x > 0.68; int cb = x < -0.68; double transform = ca ? 1.0 : 0.0; transform = cb ? -1.0 : transform; double tx = fma(-transform, x, piby4_lead) + fma(-transform, xx, piby4_tail); int c = ca | cb; x = c ? tx : x; xx = c ? 0.0 : xx; // Core Remez [2,3] approximation to tan(x+xx) on the interval [0,0.68]. double t1 = x; double r = fma(2.0, x*xx, x*x); double a = fma(r, fma(r, 0.224044448537022097264602535574e-3, -0.229345080057565662883358588111e-1), 0.372379159759792203640806338901e0); double b = fma(r, fma(r, fma(r, -0.232371494088563558304549252913e-3, 0.260656620398645407524064091208e-1), -0.515658515729031149329237816945e0), 0.111713747927937668539901657944e1); double t2 = fma(MATH_DIVIDE(a, b), x*r, xx); double tp = t1 + t2; // Compute -1.0/(t1 + t2) accurately double z1 = as_double(as_long(tp) & 0xffffffff00000000L); double z2 = t2 - (z1 - t1); double trec = -MATH_RECIP(tp); double trec_top = as_double(as_long(trec) & 0xffffffff00000000L); double tpr = fma(fma(trec_top, z2, fma(trec_top, z1, 1.0)), trec, trec_top); double tpt = transform * (1.0 - MATH_DIVIDE(2.0*tp, 1.0 + tp)); double tptr = transform * (MATH_DIVIDE(2.0*tp, tp - 1.0) - 1.0); double2 ret; ret.lo = c ? tpt : tp; ret.hi = c ? tptr : tpr; return ret; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincos_helpers.cl�����������������������������������������0000664�0000000�0000000�00000042242�13251554454�0023030�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "sincos_helpers.h" #define bitalign(hi, lo, shift) \ ((hi) << (32 - (shift))) | ((lo) >> (shift)); #define bytealign(src0, src1, src2) \ ((uint) (((((long)(src0)) << 32) | (long)(src1)) >> (((src2) & 3)*8))) _CLC_DEF float __clc_sinf_piby4(float x, float y) { // Taylor series for sin(x) is x - x^3/3! + x^5/5! - x^7/7! ... // = x * (1 - x^2/3! + x^4/5! - x^6/7! ... // = x * f(w) // where w = x*x and f(w) = (1 - w/3! + w^2/5! - w^3/7! ... // We use a minimax approximation of (f(w) - 1) / w // because this produces an expansion in even powers of x. const float c1 = -0.1666666666e0f; const float c2 = 0.8333331876e-2f; const float c3 = -0.198400874e-3f; const float c4 = 0.272500015e-5f; const float c5 = -2.5050759689e-08f; // 0xb2d72f34 const float c6 = 1.5896910177e-10f; // 0x2f2ec9d3 float z = x * x; float v = z * x; float r = mad(z, mad(z, mad(z, mad(z, c6, c5), c4), c3), c2); float ret = x - mad(v, -c1, mad(z, mad(y, 0.5f, -v*r), -y)); return ret; } _CLC_DEF float __clc_cosf_piby4(float x, float y) { // Taylor series for cos(x) is 1 - x^2/2! + x^4/4! - x^6/6! ... // = f(w) // where w = x*x and f(w) = (1 - w/2! + w^2/4! - w^3/6! ... // We use a minimax approximation of (f(w) - 1 + w/2) / (w*w) // because this produces an expansion in even powers of x. const float c1 = 0.416666666e-1f; const float c2 = -0.138888876e-2f; const float c3 = 0.248006008e-4f; const float c4 = -0.2730101334e-6f; const float c5 = 2.0875723372e-09f; // 0x310f74f6 const float c6 = -1.1359647598e-11f; // 0xad47d74e float z = x * x; float r = z * mad(z, mad(z, mad(z, mad(z, mad(z, c6, c5), c4), c3), c2), c1); // if |x| < 0.3 float qx = 0.0f; int ix = as_int(x) & EXSIGNBIT_SP32; // 0.78125 > |x| >= 0.3 float xby4 = as_float(ix - 0x01000000); qx = (ix >= 0x3e99999a) & (ix <= 0x3f480000) ? xby4 : qx; // x > 0.78125 qx = ix > 0x3f480000 ? 0.28125f : qx; float hz = mad(z, 0.5f, -qx); float a = 1.0f - qx; float ret = a - (hz - mad(z, r, -x*y)); return ret; } _CLC_DEF float __clc_tanf_piby4(float x, int regn) { // Core Remez [1,2] approximation to tan(x) on the interval [0,pi/4]. float r = x * x; float a = mad(r, -0.0172032480471481694693109f, 0.385296071263995406715129f); float b = mad(r, mad(r, 0.01844239256901656082986661f, -0.51396505478854532132342f), 1.15588821434688393452299f); float t = mad(x*r, native_divide(a, b), x); float tr = -MATH_RECIP(t); return regn & 1 ? tr : t; } _CLC_DEF void __clc_fullMulS(float *hi, float *lo, float a, float b, float bh, float bt) { if (HAVE_HW_FMA32()) { float ph = a * b; *hi = ph; *lo = fma(a, b, -ph); } else { float ah = as_float(as_uint(a) & 0xfffff000U); float at = a - ah; float ph = a * b; float pt = mad(at, bt, mad(at, bh, mad(ah, bt, mad(ah, bh, -ph)))); *hi = ph; *lo = pt; } } _CLC_DEF float __clc_removePi2S(float *hi, float *lo, float x) { // 72 bits of pi/2 const float fpiby2_1 = (float) 0xC90FDA / 0x1.0p+23f; const float fpiby2_1_h = (float) 0xC90 / 0x1.0p+11f; const float fpiby2_1_t = (float) 0xFDA / 0x1.0p+23f; const float fpiby2_2 = (float) 0xA22168 / 0x1.0p+47f; const float fpiby2_2_h = (float) 0xA22 / 0x1.0p+35f; const float fpiby2_2_t = (float) 0x168 / 0x1.0p+47f; const float fpiby2_3 = (float) 0xC234C4 / 0x1.0p+71f; const float fpiby2_3_h = (float) 0xC23 / 0x1.0p+59f; const float fpiby2_3_t = (float) 0x4C4 / 0x1.0p+71f; const float twobypi = 0x1.45f306p-1f; float fnpi2 = trunc(mad(x, twobypi, 0.5f)); // subtract n * pi/2 from x float rhead, rtail; __clc_fullMulS(&rhead, &rtail, fnpi2, fpiby2_1, fpiby2_1_h, fpiby2_1_t); float v = x - rhead; float rem = v + (((x - v) - rhead) - rtail); float rhead2, rtail2; __clc_fullMulS(&rhead2, &rtail2, fnpi2, fpiby2_2, fpiby2_2_h, fpiby2_2_t); v = rem - rhead2; rem = v + (((rem - v) - rhead2) - rtail2); float rhead3, rtail3; __clc_fullMulS(&rhead3, &rtail3, fnpi2, fpiby2_3, fpiby2_3_h, fpiby2_3_t); v = rem - rhead3; *hi = v + ((rem - v) - rhead3); *lo = -rtail3; return fnpi2; } _CLC_DEF int __clc_argReductionSmallS(float *r, float *rr, float x) { float fnpi2 = __clc_removePi2S(r, rr, x); return (int)fnpi2 & 0x3; } #define FULL_MUL(A, B, HI, LO) \ LO = A * B; \ HI = mul_hi(A, B) #define FULL_MAD(A, B, C, HI, LO) \ LO = ((A) * (B) + (C)); \ HI = mul_hi(A, B); \ HI += LO < C _CLC_DEF int __clc_argReductionLargeS(float *r, float *rr, float x) { int xe = (int)(as_uint(x) >> 23) - 127; uint xm = 0x00800000U | (as_uint(x) & 0x7fffffU); // 224 bits of 2/PI: . A2F9836E 4E441529 FC2757D1 F534DDC0 DB629599 3C439041 FE5163AB const uint b6 = 0xA2F9836EU; const uint b5 = 0x4E441529U; const uint b4 = 0xFC2757D1U; const uint b3 = 0xF534DDC0U; const uint b2 = 0xDB629599U; const uint b1 = 0x3C439041U; const uint b0 = 0xFE5163ABU; uint p0, p1, p2, p3, p4, p5, p6, p7, c0, c1; FULL_MUL(xm, b0, c0, p0); FULL_MAD(xm, b1, c0, c1, p1); FULL_MAD(xm, b2, c1, c0, p2); FULL_MAD(xm, b3, c0, c1, p3); FULL_MAD(xm, b4, c1, c0, p4); FULL_MAD(xm, b5, c0, c1, p5); FULL_MAD(xm, b6, c1, p7, p6); uint fbits = 224 + 23 - xe; // shift amount to get 2 lsb of integer part at top 2 bits // min: 25 (xe=18) max: 134 (xe=127) uint shift = 256U - 2 - fbits; // Shift by up to 134/32 = 4 words int c = shift > 31; p7 = c ? p6 : p7; p6 = c ? p5 : p6; p5 = c ? p4 : p5; p4 = c ? p3 : p4; p3 = c ? p2 : p3; p2 = c ? p1 : p2; p1 = c ? p0 : p1; shift -= (-c) & 32; c = shift > 31; p7 = c ? p6 : p7; p6 = c ? p5 : p6; p5 = c ? p4 : p5; p4 = c ? p3 : p4; p3 = c ? p2 : p3; p2 = c ? p1 : p2; shift -= (-c) & 32; c = shift > 31; p7 = c ? p6 : p7; p6 = c ? p5 : p6; p5 = c ? p4 : p5; p4 = c ? p3 : p4; p3 = c ? p2 : p3; shift -= (-c) & 32; c = shift > 31; p7 = c ? p6 : p7; p6 = c ? p5 : p6; p5 = c ? p4 : p5; p4 = c ? p3 : p4; shift -= (-c) & 32; // bitalign cannot handle a shift of 32 c = shift > 0; shift = 32 - shift; uint t7 = bitalign(p7, p6, shift); uint t6 = bitalign(p6, p5, shift); uint t5 = bitalign(p5, p4, shift); p7 = c ? t7 : p7; p6 = c ? t6 : p6; p5 = c ? t5 : p5; // Get 2 lsb of int part and msb of fraction int i = p7 >> 29; // Scoot up 2 more bits so only fraction remains p7 = bitalign(p7, p6, 30); p6 = bitalign(p6, p5, 30); p5 = bitalign(p5, p4, 30); // Subtract 1 if msb of fraction is 1, i.e. fraction >= 0.5 uint flip = i & 1 ? 0xffffffffU : 0U; uint sign = i & 1 ? 0x80000000U : 0U; p7 = p7 ^ flip; p6 = p6 ^ flip; p5 = p5 ^ flip; // Find exponent and shift away leading zeroes and hidden bit xe = clz(p7) + 1; shift = 32 - xe; p7 = bitalign(p7, p6, shift); p6 = bitalign(p6, p5, shift); // Most significant part of fraction float q1 = as_float(sign | ((127 - xe) << 23) | (p7 >> 9)); // Shift out bits we captured on q1 p7 = bitalign(p7, p6, 32-23); // Get 24 more bits of fraction in another float, there are not long strings of zeroes here int xxe = clz(p7) + 1; p7 = bitalign(p7, p6, 32-xxe); float q0 = as_float(sign | ((127 - (xe + 23 + xxe)) << 23) | (p7 >> 9)); // At this point, the fraction q1 + q0 is correct to at least 48 bits // Now we need to multiply the fraction by pi/2 // This loses us about 4 bits // pi/2 = C90 FDA A22 168 C23 4C4 const float pio2h = (float)0xc90fda / 0x1.0p+23f; const float pio2hh = (float)0xc90 / 0x1.0p+11f; const float pio2ht = (float)0xfda / 0x1.0p+23f; const float pio2t = (float)0xa22168 / 0x1.0p+47f; float rh, rt; if (HAVE_HW_FMA32()) { rh = q1 * pio2h; rt = fma(q0, pio2h, fma(q1, pio2t, fma(q1, pio2h, -rh))); } else { float q1h = as_float(as_uint(q1) & 0xfffff000); float q1t = q1 - q1h; rh = q1 * pio2h; rt = mad(q1t, pio2ht, mad(q1t, pio2hh, mad(q1h, pio2ht, mad(q1h, pio2hh, -rh)))); rt = mad(q0, pio2h, mad(q1, pio2t, rt)); } float t = rh + rt; rt = rt - (t - rh); *r = t; *rr = rt; return ((i >> 1) + (i & 1)) & 0x3; } _CLC_DEF int __clc_argReductionS(float *r, float *rr, float x) { if (x < 0x1.0p+23f) return __clc_argReductionSmallS(r, rr, x); else return __clc_argReductionLargeS(r, rr, x); } #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // Reduction for medium sized arguments _CLC_DEF void __clc_remainder_piby2_medium(double x, double *r, double *rr, int *regn) { // How many pi/2 is x a multiple of? const double two_by_pi = 0x1.45f306dc9c883p-1; double dnpi2 = trunc(fma(x, two_by_pi, 0.5)); const double piby2_h = -7074237752028440.0 / 0x1.0p+52; const double piby2_m = -2483878800010755.0 / 0x1.0p+105; const double piby2_t = -3956492004828932.0 / 0x1.0p+158; // Compute product of npi2 with 159 bits of 2/pi double p_hh = piby2_h * dnpi2; double p_ht = fma(piby2_h, dnpi2, -p_hh); double p_mh = piby2_m * dnpi2; double p_mt = fma(piby2_m, dnpi2, -p_mh); double p_th = piby2_t * dnpi2; double p_tt = fma(piby2_t, dnpi2, -p_th); // Reduce to 159 bits double ph = p_hh; double pm = p_ht + p_mh; double t = p_mh - (pm - p_ht); double pt = p_th + t + p_mt + p_tt; t = ph + pm; pm = pm - (t - ph); ph = t; t = pm + pt; pt = pt - (t - pm); pm = t; // Subtract from x t = x + ph; double qh = t + pm; double qt = pm - (qh - t) + pt; *r = qh; *rr = qt; *regn = (int)(long)dnpi2 & 0x3; } // Given positive argument x, reduce it to the range [-pi/4,pi/4] using // extra precision, and return the result in r, rr. // Return value "regn" tells how many lots of pi/2 were subtracted // from x to put it in the range [-pi/4,pi/4], mod 4. _CLC_DEF void __clc_remainder_piby2_large(double x, double *r, double *rr, int *regn) { long ux = as_long(x); int e = (int)(ux >> 52) - 1023; int i = max(23, (e >> 3) + 17); int j = 150 - i; int j16 = j & ~0xf; double fract_temp; // The following extracts 192 consecutive bits of 2/pi aligned on an arbitrary byte boundary uint4 q0 = USE_TABLE(pibits_tbl, j16); uint4 q1 = USE_TABLE(pibits_tbl, (j16 + 16)); uint4 q2 = USE_TABLE(pibits_tbl, (j16 + 32)); int k = (j >> 2) & 0x3; int4 c = (int4)k == (int4)(0, 1, 2, 3); uint u0, u1, u2, u3, u4, u5, u6; u0 = c.s1 ? q0.s1 : q0.s0; u0 = c.s2 ? q0.s2 : u0; u0 = c.s3 ? q0.s3 : u0; u1 = c.s1 ? q0.s2 : q0.s1; u1 = c.s2 ? q0.s3 : u1; u1 = c.s3 ? q1.s0 : u1; u2 = c.s1 ? q0.s3 : q0.s2; u2 = c.s2 ? q1.s0 : u2; u2 = c.s3 ? q1.s1 : u2; u3 = c.s1 ? q1.s0 : q0.s3; u3 = c.s2 ? q1.s1 : u3; u3 = c.s3 ? q1.s2 : u3; u4 = c.s1 ? q1.s1 : q1.s0; u4 = c.s2 ? q1.s2 : u4; u4 = c.s3 ? q1.s3 : u4; u5 = c.s1 ? q1.s2 : q1.s1; u5 = c.s2 ? q1.s3 : u5; u5 = c.s3 ? q2.s0 : u5; u6 = c.s1 ? q1.s3 : q1.s2; u6 = c.s2 ? q2.s0 : u6; u6 = c.s3 ? q2.s1 : u6; uint v0 = bytealign(u1, u0, j); uint v1 = bytealign(u2, u1, j); uint v2 = bytealign(u3, u2, j); uint v3 = bytealign(u4, u3, j); uint v4 = bytealign(u5, u4, j); uint v5 = bytealign(u6, u5, j); // Place those 192 bits in 4 48-bit doubles along with correct exponent // If i > 1018 we would get subnormals so we scale p up and x down to get the same product i = 2 + 8*i; x *= i > 1018 ? 0x1.0p-136 : 1.0; i -= i > 1018 ? 136 : 0; uint ua = (uint)(1023 + 52 - i) << 20; double a = as_double((uint2)(0, ua)); double p0 = as_double((uint2)(v0, ua | (v1 & 0xffffU))) - a; ua += 0x03000000U; a = as_double((uint2)(0, ua)); double p1 = as_double((uint2)((v2 << 16) | (v1 >> 16), ua | (v2 >> 16))) - a; ua += 0x03000000U; a = as_double((uint2)(0, ua)); double p2 = as_double((uint2)(v3, ua | (v4 & 0xffffU))) - a; ua += 0x03000000U; a = as_double((uint2)(0, ua)); double p3 = as_double((uint2)((v5 << 16) | (v4 >> 16), ua | (v5 >> 16))) - a; // Exact multiply double f0h = p0 * x; double f0l = fma(p0, x, -f0h); double f1h = p1 * x; double f1l = fma(p1, x, -f1h); double f2h = p2 * x; double f2l = fma(p2, x, -f2h); double f3h = p3 * x; double f3l = fma(p3, x, -f3h); // Accumulate product into 4 doubles double s, t; double f3 = f3h + f2h; t = f2h - (f3 - f3h); s = f3l + t; t = t - (s - f3l); double f2 = s + f1h; t = f1h - (f2 - s) + t; s = f2l + t; t = t - (s - f2l); double f1 = s + f0h; t = f0h - (f1 - s) + t; s = f1l + t; double f0 = s + f0l; // Strip off unwanted large integer bits f3 = 0x1.0p+10 * fract(f3 * 0x1.0p-10, &fract_temp); f3 += f3 + f2 < 0.0 ? 0x1.0p+10 : 0.0; // Compute least significant integer bits t = f3 + f2; double di = t - fract(t, &fract_temp); i = (float)di; // Shift out remaining integer part f3 -= di; s = f3 + f2; t = f2 - (s - f3); f3 = s; f2 = t; s = f2 + f1; t = f1 - (s - f2); f2 = s; f1 = t; f1 += f0; // Subtract 1 if fraction is >= 0.5, and update regn int g = f3 >= 0.5; i += g; f3 -= (float)g; // Shift up bits s = f3 + f2; t = f2 -(s - f3); f3 = s; f2 = t + f1; // Multiply precise fraction by pi/2 to get radians const double p2h = 7074237752028440.0 / 0x1.0p+52; const double p2t = 4967757600021510.0 / 0x1.0p+106; double rhi = f3 * p2h; double rlo = fma(f2, p2h, fma(f3, p2t, fma(f3, p2h, -rhi))); *r = rhi + rlo; *rr = rlo - (*r - rhi); *regn = i & 0x3; } _CLC_DEF double2 __clc_sincos_piby4(double x, double xx) { // Taylor series for sin(x) is x - x^3/3! + x^5/5! - x^7/7! ... // = x * (1 - x^2/3! + x^4/5! - x^6/7! ... // = x * f(w) // where w = x*x and f(w) = (1 - w/3! + w^2/5! - w^3/7! ... // We use a minimax approximation of (f(w) - 1) / w // because this produces an expansion in even powers of x. // If xx (the tail of x) is non-zero, we add a correction // term g(x,xx) = (1-x*x/2)*xx to the result, where g(x,xx) // is an approximation to cos(x)*sin(xx) valid because // xx is tiny relative to x. // Taylor series for cos(x) is 1 - x^2/2! + x^4/4! - x^6/6! ... // = f(w) // where w = x*x and f(w) = (1 - w/2! + w^2/4! - w^3/6! ... // We use a minimax approximation of (f(w) - 1 + w/2) / (w*w) // because this produces an expansion in even powers of x. // If xx (the tail of x) is non-zero, we subtract a correction // term g(x,xx) = x*xx to the result, where g(x,xx) // is an approximation to sin(x)*sin(xx) valid because // xx is tiny relative to x. const double sc1 = -0.166666666666666646259241729; const double sc2 = 0.833333333333095043065222816e-2; const double sc3 = -0.19841269836761125688538679e-3; const double sc4 = 0.275573161037288022676895908448e-5; const double sc5 = -0.25051132068021699772257377197e-7; const double sc6 = 0.159181443044859136852668200e-9; const double cc1 = 0.41666666666666665390037e-1; const double cc2 = -0.13888888888887398280412e-2; const double cc3 = 0.248015872987670414957399e-4; const double cc4 = -0.275573172723441909470836e-6; const double cc5 = 0.208761463822329611076335e-8; const double cc6 = -0.113826398067944859590880e-10; double x2 = x * x; double x3 = x2 * x; double r = 0.5 * x2; double t = 1.0 - r; double sp = fma(fma(fma(fma(sc6, x2, sc5), x2, sc4), x2, sc3), x2, sc2); double cp = t + fma(fma(fma(fma(fma(fma(cc6, x2, cc5), x2, cc4), x2, cc3), x2, cc2), x2, cc1), x2*x2, fma(x, xx, (1.0 - t) - r)); double2 ret; ret.lo = x - fma(-x3, sc1, fma(fma(-x3, sp, 0.5*xx), x2, -xx)); ret.hi = cp; return ret; } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincos_helpers.h������������������������������������������0000664�0000000�0000000�00000003233�13251554454�0022656�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "clc/clcfunc.h" _CLC_DECL float __clc_sinf_piby4(float x, float y); _CLC_DECL float __clc_cosf_piby4(float x, float y); _CLC_DECL float __clc_tanf_piby4(float x, int y); _CLC_DECL int __clc_argReductionS(float *r, float *rr, float x); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DECL void __clc_remainder_piby2_medium(double x, double *r, double *rr, int *regn); _CLC_DECL void __clc_remainder_piby2_large(double x, double *r, double *rr, int *regn); _CLC_DECL double2 __clc_sincos_piby4(double x, double xx); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sincospiF_piby4.h�����������������������������������������0000664�0000000�0000000�00000004741�13251554454�0022707�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // Evaluate single precisions in and cos of value in interval [-pi/4, pi/4] _CLC_INLINE float2 __libclc__sincosf_piby4(float x) { // Taylor series for sin(x) is x - x^3/3! + x^5/5! - x^7/7! ... // = x * (1 - x^2/3! + x^4/5! - x^6/7! ... // = x * f(w) // where w = x*x and f(w) = (1 - w/3! + w^2/5! - w^3/7! ... // We use a minimax approximation of (f(w) - 1) / w // because this produces an expansion in even powers of x. // Taylor series for cos(x) is 1 - x^2/2! + x^4/4! - x^6/6! ... // = f(w) // where w = x*x and f(w) = (1 - w/2! + w^2/4! - w^3/6! ... // We use a minimax approximation of (f(w) - 1 + w/2) / (w*w) // because this produces an expansion in even powers of x. const float sc1 = -0.166666666638608441788607926e0F; const float sc2 = 0.833333187633086262120839299e-2F; const float sc3 = -0.198400874359527693921333720e-3F; const float sc4 = 0.272500015145584081596826911e-5F; const float cc1 = 0.41666666664325175238031e-1F; const float cc2 = -0.13888887673175665567647e-2F; const float cc3 = 0.24800600878112441958053e-4F; const float cc4 = -0.27301013343179832472841e-6F; float x2 = x * x; float2 ret; ret.x = mad(x*x2, mad(x2, mad(x2, mad(x2, sc4, sc3), sc2), sc1), x); ret.y = mad(x2*x2, mad(x2, mad(x2, mad(x2, cc4, cc3), cc2), cc1), mad(x2, -0.5f, 1.0f)); return ret; } �������������������������������libclc-0.2.0+git20180312/generic/lib/math/sinh.cl���������������������������������������������������0000664�0000000�0000000�00000015365�13251554454�0020757�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "tables.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float sinh(float x) { // After dealing with special cases the computation is split into regions as follows. // abs(x) >= max_sinh_arg: // sinh(x) = sign(x)*Inf // abs(x) >= small_threshold: // sinh(x) = sign(x)*exp(abs(x))/2 computed using the splitexp and scaleDouble functions as for exp_amd(). // abs(x) < small_threshold: // compute p = exp(y) - 1 and then z = 0.5*(p+(p/(p+1.0))) // sinh(x) is then sign(x)*z. const float max_sinh_arg = 0x1.65a9fap+6f; const float small_threshold = 0x1.0a2b24p+3f; uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; uint xs = ux ^ aux; float y = as_float(aux); // We find the integer part y0 of y and the increment dy = y - y0. We then compute // z = sinh(y) = sinh(y0)cosh(dy) + cosh(y0)sinh(dy) // where sinh(y0) and cosh(y0) are tabulated above. int ind = (int) y; ind = (uint)ind > 36U ? 0 : ind; float dy = y - ind; float dy2 = dy * dy; float sdy = mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, 0.7746188980094184251527126e-12f, 0.160576793121939886190847e-9f), 0.250521176994133472333666e-7f), 0.275573191913636406057211e-5f), 0.198412698413242405162014e-3f), 0.833333333333329931873097e-2f), 0.166666666666666667013899e0f); sdy = mad(sdy, dy*dy2, dy); float cdy = mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, mad(dy2, 0.1163921388172173692062032e-10f, 0.208744349831471353536305e-8f), 0.275573350756016588011357e-6f), 0.248015872460622433115785e-4f), 0.138888888889814854814536e-2f), 0.416666666666660876512776e-1f), 0.500000000000000005911074e0f); cdy = mad(cdy, dy2, 1.0f); float2 tv = USE_TABLE(sinhcosh_tbl, ind); float z = mad(tv.s1, sdy, tv.s0 * cdy); z = as_float(xs | as_uint(z)); // When y is large enough so that the negative exponential is negligible, // so sinh(y) is approximated by sign(x)*exp(y)/2. float t = exp(y - 0x1.62e500p-1f); float zsmall = mad(0x1.a0210ep-18f, t, t); zsmall = as_float(xs | as_uint(zsmall)); z = y >= small_threshold ? zsmall : z; // Corner cases float zinf = as_float(PINFBITPATT_SP32 | xs); z = y >= max_sinh_arg ? zinf : z; z = aux > PINFBITPATT_SP32 | aux < 0x38800000U ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, sinh, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double sinh(double x) { // After dealing with special cases the computation is split into // regions as follows: // // abs(x) >= max_sinh_arg: // sinh(x) = sign(x)*Inf // // abs(x) >= small_threshold: // sinh(x) = sign(x)*exp(abs(x))/2 computed using the // splitexp and scaleDouble functions as for exp_amd(). // // abs(x) < small_threshold: // compute p = exp(y) - 1 and then z = 0.5*(p+(p/(p+1.0))) // sinh(x) is then sign(x)*z. const double max_sinh_arg = 7.10475860073943977113e+02; // 0x408633ce8fb9f87e // This is where exp(-x) is insignificant compared to exp(x) = ln(2^27) const double small_threshold = 0x1.2b708872320e2p+4; double y = fabs(x); // In this range we find the integer part y0 of y // and the increment dy = y - y0. We then compute // z = sinh(y) = sinh(y0)cosh(dy) + cosh(y0)sinh(dy) // where sinh(y0) and cosh(y0) are obtained from tables int ind = min((int)y, 36); double dy = y - ind; double dy2 = dy * dy; double sdy = dy * dy2 * fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, 0.7746188980094184251527126e-12, 0.160576793121939886190847e-9), 0.250521176994133472333666e-7), 0.275573191913636406057211e-5), 0.198412698413242405162014e-3), 0.833333333333329931873097e-2), 0.166666666666666667013899e0); double cdy = dy2 * fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, fma(dy2, 0.1163921388172173692062032e-10, 0.208744349831471353536305e-8), 0.275573350756016588011357e-6), 0.248015872460622433115785e-4), 0.138888888889814854814536e-2), 0.416666666666660876512776e-1), 0.500000000000000005911074e0); // At this point sinh(dy) is approximated by dy + sdy. // Shift some significant bits from dy to sdy. double sdy1 = as_double(as_ulong(dy) & 0xfffffffff8000000UL); double sdy2 = sdy + (dy - sdy1); double2 tv = USE_TABLE(cosh_tbl, ind); double cl = tv.s0; double ct = tv.s1; tv = USE_TABLE(sinh_tbl, ind); double sl = tv.s0; double st = tv.s1; double z = fma(cl, sdy1, fma(sl, cdy, fma(cl, sdy2, fma(ct, sdy1, fma(st, cdy, ct*sdy2)) + st))) + sl; // Other cases z = (y < 0x1.0p-28) | isnan(x) | isinf(x) ? y : z; double t = exp(y - 0x1.62e42fefa3800p-1); t = fma(t, -0x1.ef35793c76641p-45, t); z = y >= small_threshold ? t : z; z = y >= max_sinh_arg ? as_double(PINFBITPATT_DP64) : z; return copysign(z, x); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sinh, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sinpi.cl��������������������������������������������������0000664�0000000�0000000�00000006605�13251554454�0021135�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "sincospiF_piby4.h" #include "../clcmacro.h" #ifdef cl_khr_fp64 #include "sincosD_piby4.h" #endif _CLC_OVERLOAD _CLC_DEF float sinpi(float x) { int ix = as_int(x); int xsgn = ix & 0x80000000; ix ^= xsgn; float ax = as_float(ix); int iax = (int)ax; float r = ax - iax; int xodd = xsgn ^ (iax & 0x1 ? 0x80000000 : 0); // Initialize with return for +-Inf and NaN int ir = 0x7fc00000; // 2^23 <= |x| < Inf, the result is always integer ir = ix < 0x7f800000 ? xsgn : ir; // 0x1.0p-7 <= |x| < 2^23, result depends on which 0.25 interval // r < 1.0 float a = 1.0f - r; int e = 0; // r <= 0.75 int c = r <= 0.75f; a = c ? r - 0.5f : a; e = c ? 1 : e; // r < 0.5 c = r < 0.5f; a = c ? 0.5f - r : a; // 0 < r <= 0.25 c = r <= 0.25f; a = c ? r : a; e = c ? 0 : e; float2 t = __libclc__sincosf_piby4(a * M_PI_F); int jr = xodd ^ as_int(e ? t.hi : t.lo); ir = ix < 0x4b000000 ? jr : ir; return as_float(ir); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, sinpi, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double sinpi(double x) { long ix = as_long(x); long xsgn = ix & 0x8000000000000000L; ix ^= xsgn; double ax = as_double(ix); long iax = (long)ax; double r = ax - (double)iax; long xodd = xsgn ^ (iax & 0x1L ? 0x8000000000000000L : 0L); // Initialize with return for +-Inf and NaN long ir = 0x7ff8000000000000L; // 2^23 <= |x| < Inf, the result is always integer ir = ix < 0x7ff0000000000000 ? xsgn : ir; // 0x1.0p-7 <= |x| < 2^23, result depends on which 0.25 interval // r < 1.0 double a = 1.0 - r; int e = 0; // r <= 0.75 int c = r <= 0.75; double t = r - 0.5; a = c ? t : a; e = c ? 1 : e; // r < 0.5 c = r < 0.5; t = 0.5 - r; a = c ? t : a; // r <= 0.25 c = r <= 0.25; a = c ? r : a; e = c ? 0 : e; double api = a * M_PI; double2 sc = __libclc__sincos_piby4(api, 0.0); long jr = xodd ^ as_long(e ? sc.hi : sc.lo); ir = ax < 0x1.0p+52 ? jr : ir; return as_double(ir); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, sinpi, double) #endif ���������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/sqrt.cl���������������������������������������������������0000664�0000000�0000000�00000002572�13251554454�0021003�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" #include "math/clc_sqrt.h" _CLC_DEFINE_UNARY_BUILTIN(float, sqrt, __clc_sqrt, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_UNARY_BUILTIN(double, sqrt, __clc_sqrt, double) #endif ��������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tables.cl�������������������������������������������������0000664�0000000�0000000�00000344402�13251554454�0021265�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "tables.h" DECLARE_TABLE(float2, LOGE_TBL, 129) = { (float2)(0x0.000000p+0f, 0x0.000000p+0f), (float2)(0x1.fe0000p-8f, 0x1.535882p-23f), (float2)(0x1.fc0000p-7f, 0x1.5161f8p-20f), (float2)(0x1.7b8000p-6f, 0x1.1b07d4p-18f), (float2)(0x1.f82000p-6f, 0x1.361cf0p-19f), (float2)(0x1.39e000p-5f, 0x1.0f73fcp-18f), (float2)(0x1.774000p-5f, 0x1.63d8cap-19f), (float2)(0x1.b42000p-5f, 0x1.bae232p-18f), (float2)(0x1.f0a000p-5f, 0x1.86008ap-20f), (float2)(0x1.164000p-4f, 0x1.36eea2p-16f), (float2)(0x1.340000p-4f, 0x1.d7961ap-16f), (float2)(0x1.51a000p-4f, 0x1.073f06p-16f), (float2)(0x1.6f0000p-4f, 0x1.a515cap-17f), (float2)(0x1.8c2000p-4f, 0x1.45d630p-16f), (float2)(0x1.a92000p-4f, 0x1.b4e92ap-18f), (float2)(0x1.c5e000p-4f, 0x1.523d6ep-18f), (float2)(0x1.e26000p-4f, 0x1.076e2ap-16f), (float2)(0x1.fec000p-4f, 0x1.2263b6p-17f), (float2)(0x1.0d6000p-3f, 0x1.7e7cd0p-15f), (float2)(0x1.1b6000p-3f, 0x1.2ad52ep-15f), (float2)(0x1.294000p-3f, 0x1.52f81ep-15f), (float2)(0x1.370000p-3f, 0x1.fc201ep-15f), (float2)(0x1.44c000p-3f, 0x1.2b6ccap-15f), (float2)(0x1.526000p-3f, 0x1.cbc742p-16f), (float2)(0x1.5fe000p-3f, 0x1.3070a6p-15f), (float2)(0x1.6d6000p-3f, 0x1.fce33ap-20f), (float2)(0x1.7aa000p-3f, 0x1.890210p-15f), (float2)(0x1.87e000p-3f, 0x1.a06520p-15f), (float2)(0x1.952000p-3f, 0x1.6a73d0p-17f), (float2)(0x1.a22000p-3f, 0x1.bc1fe2p-15f), (float2)(0x1.af2000p-3f, 0x1.c94e80p-15f), (float2)(0x1.bc2000p-3f, 0x1.0ce85ap-16f), (float2)(0x1.c8e000p-3f, 0x1.f7c79ap-15f), (float2)(0x1.d5c000p-3f, 0x1.0b5a7cp-18f), (float2)(0x1.e26000p-3f, 0x1.076e2ap-15f), (float2)(0x1.ef0000p-3f, 0x1.5b97b8p-16f), (float2)(0x1.fb8000p-3f, 0x1.186d5ep-15f), (float2)(0x1.040000p-2f, 0x1.2ca5a6p-17f), (float2)(0x1.0a2000p-2f, 0x1.24e272p-14f), (float2)(0x1.104000p-2f, 0x1.8bf9aep-14f), (float2)(0x1.166000p-2f, 0x1.5cabaap-14f), (float2)(0x1.1c8000p-2f, 0x1.3182d2p-15f), (float2)(0x1.228000p-2f, 0x1.41fbcep-14f), (float2)(0x1.288000p-2f, 0x1.5a13dep-14f), (float2)(0x1.2e8000p-2f, 0x1.c575c2p-15f), (float2)(0x1.346000p-2f, 0x1.dd9a98p-14f), (float2)(0x1.3a6000p-2f, 0x1.3155a4p-16f), (float2)(0x1.404000p-2f, 0x1.843434p-17f), (float2)(0x1.460000p-2f, 0x1.8bc21cp-14f), (float2)(0x1.4be000p-2f, 0x1.7e55dcp-16f), (float2)(0x1.51a000p-2f, 0x1.5b0e5ap-15f), (float2)(0x1.576000p-2f, 0x1.dc5d14p-16f), (float2)(0x1.5d0000p-2f, 0x1.bdbf58p-14f), (float2)(0x1.62c000p-2f, 0x1.05e572p-15f), (float2)(0x1.686000p-2f, 0x1.903d36p-15f), (float2)(0x1.6e0000p-2f, 0x1.1d5456p-15f), (float2)(0x1.738000p-2f, 0x1.d7f6bap-14f), (float2)(0x1.792000p-2f, 0x1.4abfbap-15f), (float2)(0x1.7ea000p-2f, 0x1.f07704p-15f), (float2)(0x1.842000p-2f, 0x1.a3b43cp-15f), (float2)(0x1.89a000p-2f, 0x1.9c360ap-17f), (float2)(0x1.8f0000p-2f, 0x1.1e8736p-14f), (float2)(0x1.946000p-2f, 0x1.941c20p-14f), (float2)(0x1.99c000p-2f, 0x1.958116p-14f), (float2)(0x1.9f2000p-2f, 0x1.23ecbep-14f), (float2)(0x1.a48000p-2f, 0x1.024396p-16f), (float2)(0x1.a9c000p-2f, 0x1.d93534p-15f), (float2)(0x1.af0000p-2f, 0x1.293246p-14f), (float2)(0x1.b44000p-2f, 0x1.eef798p-15f), (float2)(0x1.b98000p-2f, 0x1.625a4cp-16f), (float2)(0x1.bea000p-2f, 0x1.4d9da6p-14f), (float2)(0x1.c3c000p-2f, 0x1.d7a7ccp-14f), (float2)(0x1.c8e000p-2f, 0x1.f7c79ap-14f), (float2)(0x1.ce0000p-2f, 0x1.af0b84p-14f), (float2)(0x1.d32000p-2f, 0x1.fcfc00p-15f), (float2)(0x1.d82000p-2f, 0x1.e7258ap-14f), (float2)(0x1.dd4000p-2f, 0x1.a81306p-16f), (float2)(0x1.e24000p-2f, 0x1.1034f8p-15f), (float2)(0x1.e74000p-2f, 0x1.09875ap-16f), (float2)(0x1.ec2000p-2f, 0x1.99d246p-14f), (float2)(0x1.f12000p-2f, 0x1.1ebf5ep-15f), (float2)(0x1.f60000p-2f, 0x1.23fa70p-14f), (float2)(0x1.fae000p-2f, 0x1.588f78p-14f), (float2)(0x1.ffc000p-2f, 0x1.2e0856p-14f), (float2)(0x1.024000p-1f, 0x1.52a5a4p-13f), (float2)(0x1.04a000p-1f, 0x1.df9da8p-13f), (float2)(0x1.072000p-1f, 0x1.f2e0e6p-16f), (float2)(0x1.098000p-1f, 0x1.bd3d5cp-15f), (float2)(0x1.0be000p-1f, 0x1.cb9094p-15f), (float2)(0x1.0e4000p-1f, 0x1.261746p-15f), (float2)(0x1.108000p-1f, 0x1.f39e2cp-13f), (float2)(0x1.12e000p-1f, 0x1.719592p-13f), (float2)(0x1.154000p-1f, 0x1.87a5e8p-14f), (float2)(0x1.178000p-1f, 0x1.eabbd8p-13f), (float2)(0x1.19e000p-1f, 0x1.cd68cep-14f), (float2)(0x1.1c2000p-1f, 0x1.b81f70p-13f), (float2)(0x1.1e8000p-1f, 0x1.7d79c0p-15f), (float2)(0x1.20c000p-1f, 0x1.b9a324p-14f), (float2)(0x1.230000p-1f, 0x1.30d7bep-13f), (float2)(0x1.254000p-1f, 0x1.5bce98p-13f), (float2)(0x1.278000p-1f, 0x1.5e1288p-13f), (float2)(0x1.29c000p-1f, 0x1.37fec2p-13f), (float2)(0x1.2c0000p-1f, 0x1.d3da88p-14f), (float2)(0x1.2e4000p-1f, 0x1.d0db90p-15f), (float2)(0x1.306000p-1f, 0x1.d7334ep-13f), (float2)(0x1.32a000p-1f, 0x1.133912p-13f), (float2)(0x1.34e000p-1f, 0x1.44ece6p-16f), (float2)(0x1.370000p-1f, 0x1.17b546p-13f), (float2)(0x1.392000p-1f, 0x1.e0d356p-13f), (float2)(0x1.3b6000p-1f, 0x1.0893fep-14f), (float2)(0x1.3d8000p-1f, 0x1.026a70p-13f), (float2)(0x1.3fa000p-1f, 0x1.5b84d0p-13f), (float2)(0x1.41c000p-1f, 0x1.8fe846p-13f), (float2)(0x1.43e000p-1f, 0x1.9fe2f8p-13f), (float2)(0x1.460000p-1f, 0x1.8bc21cp-13f), (float2)(0x1.482000p-1f, 0x1.53d1eap-13f), (float2)(0x1.4a4000p-1f, 0x1.f0bb60p-14f), (float2)(0x1.4c6000p-1f, 0x1.e6bf32p-15f), (float2)(0x1.4e6000p-1f, 0x1.d811b6p-13f), (float2)(0x1.508000p-1f, 0x1.13cc00p-13f), (float2)(0x1.52a000p-1f, 0x1.6932dep-16f), (float2)(0x1.54a000p-1f, 0x1.246798p-13f), (float2)(0x1.56a000p-1f, 0x1.f9d5b2p-13f), (float2)(0x1.58c000p-1f, 0x1.5b6b9ap-14f), (float2)(0x1.5ac000p-1f, 0x1.404c34p-13f), (float2)(0x1.5cc000p-1f, 0x1.b1dc6cp-13f), (float2)(0x1.5ee000p-1f, 0x1.54920ap-20f), (float2)(0x1.60e000p-1f, 0x1.97a23cp-16f), (float2)(0x1.62e000p-1f, 0x1.0bfbe8p-15f), }; DECLARE_TABLE(float, LOG_INV_TBL, 129) = { 0x1.000000p+1f, 0x1.fc07f0p+0f, 0x1.f81f82p+0f, 0x1.f4465ap+0f, 0x1.f07c20p+0f, 0x1.ecc07cp+0f, 0x1.e9131ap+0f, 0x1.e573acp+0f, 0x1.e1e1e2p+0f, 0x1.de5d6ep+0f, 0x1.dae608p+0f, 0x1.d77b66p+0f, 0x1.d41d42p+0f, 0x1.d0cb58p+0f, 0x1.cd8568p+0f, 0x1.ca4b30p+0f, 0x1.c71c72p+0f, 0x1.c3f8f0p+0f, 0x1.c0e070p+0f, 0x1.bdd2b8p+0f, 0x1.bacf92p+0f, 0x1.b7d6c4p+0f, 0x1.b4e81cp+0f, 0x1.b20364p+0f, 0x1.af286cp+0f, 0x1.ac5702p+0f, 0x1.a98ef6p+0f, 0x1.a6d01ap+0f, 0x1.a41a42p+0f, 0x1.a16d40p+0f, 0x1.9ec8eap+0f, 0x1.9c2d14p+0f, 0x1.99999ap+0f, 0x1.970e50p+0f, 0x1.948b10p+0f, 0x1.920fb4p+0f, 0x1.8f9c18p+0f, 0x1.8d3018p+0f, 0x1.8acb90p+0f, 0x1.886e60p+0f, 0x1.861862p+0f, 0x1.83c978p+0f, 0x1.818182p+0f, 0x1.7f4060p+0f, 0x1.7d05f4p+0f, 0x1.7ad220p+0f, 0x1.78a4c8p+0f, 0x1.767dcep+0f, 0x1.745d18p+0f, 0x1.724288p+0f, 0x1.702e06p+0f, 0x1.6e1f76p+0f, 0x1.6c16c2p+0f, 0x1.6a13cep+0f, 0x1.681682p+0f, 0x1.661ec6p+0f, 0x1.642c86p+0f, 0x1.623fa8p+0f, 0x1.605816p+0f, 0x1.5e75bcp+0f, 0x1.5c9882p+0f, 0x1.5ac056p+0f, 0x1.58ed24p+0f, 0x1.571ed4p+0f, 0x1.555556p+0f, 0x1.539094p+0f, 0x1.51d07ep+0f, 0x1.501502p+0f, 0x1.4e5e0ap+0f, 0x1.4cab88p+0f, 0x1.4afd6ap+0f, 0x1.49539ep+0f, 0x1.47ae14p+0f, 0x1.460cbcp+0f, 0x1.446f86p+0f, 0x1.42d662p+0f, 0x1.414142p+0f, 0x1.3fb014p+0f, 0x1.3e22ccp+0f, 0x1.3c995ap+0f, 0x1.3b13b2p+0f, 0x1.3991c2p+0f, 0x1.381382p+0f, 0x1.3698e0p+0f, 0x1.3521d0p+0f, 0x1.33ae46p+0f, 0x1.323e34p+0f, 0x1.30d190p+0f, 0x1.2f684cp+0f, 0x1.2e025cp+0f, 0x1.2c9fb4p+0f, 0x1.2b404ap+0f, 0x1.29e412p+0f, 0x1.288b02p+0f, 0x1.27350cp+0f, 0x1.25e228p+0f, 0x1.24924ap+0f, 0x1.234568p+0f, 0x1.21fb78p+0f, 0x1.20b470p+0f, 0x1.1f7048p+0f, 0x1.1e2ef4p+0f, 0x1.1cf06ap+0f, 0x1.1bb4a4p+0f, 0x1.1a7b96p+0f, 0x1.194538p+0f, 0x1.181182p+0f, 0x1.16e068p+0f, 0x1.15b1e6p+0f, 0x1.1485f0p+0f, 0x1.135c82p+0f, 0x1.12358ep+0f, 0x1.111112p+0f, 0x1.0fef02p+0f, 0x1.0ecf56p+0f, 0x1.0db20ap+0f, 0x1.0c9714p+0f, 0x1.0b7e6ep+0f, 0x1.0a6810p+0f, 0x1.0953f4p+0f, 0x1.084210p+0f, 0x1.073260p+0f, 0x1.0624dep+0f, 0x1.051980p+0f, 0x1.041042p+0f, 0x1.03091cp+0f, 0x1.020408p+0f, 0x1.010102p+0f, 0x1.000000p+0f, }; DECLARE_TABLE(float2, LOG_INV_TBL_EP, 129) = { (float2)(0x1.000000p+1f, 0x0.000000p+0f), (float2)(0x1.fc0000p+0f, 0x1.fc07f0p-14f), (float2)(0x1.f80000p+0f, 0x1.f81f82p-12f), (float2)(0x1.f40000p+0f, 0x1.196792p-10f), (float2)(0x1.f00000p+0f, 0x1.f07c20p-10f), (float2)(0x1.ec0000p+0f, 0x1.80f660p-9f), (float2)(0x1.e80000p+0f, 0x1.131ac0p-8f), (float2)(0x1.e40000p+0f, 0x1.73ac90p-8f), (float2)(0x1.e00000p+0f, 0x1.e1e1e2p-8f), (float2)(0x1.de0000p+0f, 0x1.75b8fep-10f), (float2)(0x1.da0000p+0f, 0x1.cc0ed8p-9f), (float2)(0x1.d60000p+0f, 0x1.7b654cp-8f), (float2)(0x1.d40000p+0f, 0x1.d41d42p-12f), (float2)(0x1.d00000p+0f, 0x1.96b1eep-9f), (float2)(0x1.cc0000p+0f, 0x1.856890p-8f), (float2)(0x1.ca0000p+0f, 0x1.2cc158p-10f), (float2)(0x1.c60000p+0f, 0x1.1c71c8p-8f), (float2)(0x1.c20000p+0f, 0x1.f8f01cp-8f), (float2)(0x1.c00000p+0f, 0x1.c0e070p-9f), (float2)(0x1.bc0000p+0f, 0x1.d2b89ap-8f), (float2)(0x1.ba0000p+0f, 0x1.9f2298p-9f), (float2)(0x1.b60000p+0f, 0x1.d6c3dep-8f), (float2)(0x1.b40000p+0f, 0x1.d0369ep-9f), (float2)(0x1.b20000p+0f, 0x1.b20364p-15f), (float2)(0x1.ae0000p+0f, 0x1.286bcap-8f), (float2)(0x1.ac0000p+0f, 0x1.5c06b2p-10f), (float2)(0x1.a80000p+0f, 0x1.8ef606p-8f), (float2)(0x1.a60000p+0f, 0x1.a034dap-9f), (float2)(0x1.a40000p+0f, 0x1.a41a42p-12f), (float2)(0x1.a00000p+0f, 0x1.6d3f98p-8f), (float2)(0x1.9e0000p+0f, 0x1.91d2a2p-9f), (float2)(0x1.9c0000p+0f, 0x1.68a772p-11f), (float2)(0x1.980000p+0f, 0x1.99999ap-8f), (float2)(0x1.960000p+0f, 0x1.0e4f80p-8f), (float2)(0x1.940000p+0f, 0x1.161f9ap-9f), (float2)(0x1.920000p+0f, 0x1.f693a2p-13f), (float2)(0x1.8e0000p+0f, 0x1.9c18fap-8f), (float2)(0x1.8c0000p+0f, 0x1.3018d4p-8f), (float2)(0x1.8a0000p+0f, 0x1.9721eep-9f), (float2)(0x1.880000p+0f, 0x1.b97c2ap-10f), (float2)(0x1.860000p+0f, 0x1.861862p-12f), (float2)(0x1.820000p+0f, 0x1.c977acp-8f), (float2)(0x1.800000p+0f, 0x1.818182p-8f), (float2)(0x1.7e0000p+0f, 0x1.405fd0p-8f), (float2)(0x1.7c0000p+0f, 0x1.05f418p-8f), (float2)(0x1.7a0000p+0f, 0x1.a4411cp-9f), (float2)(0x1.780000p+0f, 0x1.499030p-9f), (float2)(0x1.760000p+0f, 0x1.f7390ep-10f), (float2)(0x1.740000p+0f, 0x1.745d18p-10f), (float2)(0x1.720000p+0f, 0x1.0a1fd2p-10f), (float2)(0x1.700000p+0f, 0x1.702e06p-11f), (float2)(0x1.6e0000p+0f, 0x1.f76b44p-12f), (float2)(0x1.6c0000p+0f, 0x1.6c16c2p-12f), (float2)(0x1.6a0000p+0f, 0x1.3cd154p-12f), (float2)(0x1.680000p+0f, 0x1.681682p-12f), (float2)(0x1.660000p+0f, 0x1.ec6a52p-12f), (float2)(0x1.640000p+0f, 0x1.642c86p-11f), (float2)(0x1.620000p+0f, 0x1.fd3b80p-11f), (float2)(0x1.600000p+0f, 0x1.605816p-10f), (float2)(0x1.5e0000p+0f, 0x1.d6ee34p-10f), (float2)(0x1.5c0000p+0f, 0x1.310572p-9f), (float2)(0x1.5a0000p+0f, 0x1.80ad60p-9f), (float2)(0x1.580000p+0f, 0x1.da4610p-9f), (float2)(0x1.560000p+0f, 0x1.1ed3c6p-8f), (float2)(0x1.540000p+0f, 0x1.555556p-8f), (float2)(0x1.520000p+0f, 0x1.909490p-8f), (float2)(0x1.500000p+0f, 0x1.d07eaep-8f), (float2)(0x1.500000p+0f, 0x1.501502p-12f), (float2)(0x1.4e0000p+0f, 0x1.7829ccp-10f), (float2)(0x1.4c0000p+0f, 0x1.5710e4p-9f), (float2)(0x1.4a0000p+0f, 0x1.fad40ap-9f), (float2)(0x1.480000p+0f, 0x1.539e3cp-8f), (float2)(0x1.460000p+0f, 0x1.ae147ap-8f), (float2)(0x1.460000p+0f, 0x1.978fecp-13f), (float2)(0x1.440000p+0f, 0x1.be1958p-10f), (float2)(0x1.420000p+0f, 0x1.acc4bap-9f), (float2)(0x1.400000p+0f, 0x1.414142p-8f), (float2)(0x1.3e0000p+0f, 0x1.b013fcp-8f), (float2)(0x1.3e0000p+0f, 0x1.165e72p-11f), (float2)(0x1.3c0000p+0f, 0x1.32b490p-9f), (float2)(0x1.3a0000p+0f, 0x1.13b13cp-8f), (float2)(0x1.380000p+0f, 0x1.91c2c2p-8f), (float2)(0x1.380000p+0f, 0x1.381382p-12f), (float2)(0x1.360000p+0f, 0x1.31be7cp-9f), (float2)(0x1.340000p+0f, 0x1.21cfb2p-8f), (float2)(0x1.320000p+0f, 0x1.ae45b6p-8f), (float2)(0x1.320000p+0f, 0x1.f1a516p-11f), (float2)(0x1.300000p+0f, 0x1.a32026p-9f), (float2)(0x1.2e0000p+0f, 0x1.684bdap-8f), (float2)(0x1.2e0000p+0f, 0x1.2e025cp-15f), (float2)(0x1.2c0000p+0f, 0x1.3f69b0p-9f), (float2)(0x1.2a0000p+0f, 0x1.404ad0p-8f), (float2)(0x1.280000p+0f, 0x1.e4129ep-8f), (float2)(0x1.280000p+0f, 0x1.160252p-9f), (float2)(0x1.260000p+0f, 0x1.350b88p-8f), (float2)(0x1.240000p+0f, 0x1.e22708p-8f), (float2)(0x1.240000p+0f, 0x1.24924ap-9f), (float2)(0x1.220000p+0f, 0x1.45678ap-8f), (float2)(0x1.200000p+0f, 0x1.fb7812p-8f), (float2)(0x1.200000p+0f, 0x1.68e18cp-9f), (float2)(0x1.1e0000p+0f, 0x1.7047dcp-8f), (float2)(0x1.1e0000p+0f, 0x1.779da0p-11f), (float2)(0x1.1c0000p+0f, 0x1.e0d5b4p-9f), (float2)(0x1.1a0000p+0f, 0x1.b4a404p-8f), (float2)(0x1.1a0000p+0f, 0x1.ee5846p-10f), (float2)(0x1.180000p+0f, 0x1.453808p-8f), (float2)(0x1.180000p+0f, 0x1.181182p-12f), (float2)(0x1.160000p+0f, 0x1.c0d128p-9f), (float2)(0x1.140000p+0f, 0x1.b1e5f8p-8f), (float2)(0x1.140000p+0f, 0x1.0be1c2p-9f), (float2)(0x1.120000p+0f, 0x1.5c8114p-8f), (float2)(0x1.120000p+0f, 0x1.ac73aep-11f), (float2)(0x1.100000p+0f, 0x1.111112p-8f), (float2)(0x1.0e0000p+0f, 0x1.ef0110p-8f), (float2)(0x1.0e0000p+0f, 0x1.9ead7cp-9f), (float2)(0x1.0c0000p+0f, 0x1.b20a88p-8f), (float2)(0x1.0c0000p+0f, 0x1.2e29f8p-9f), (float2)(0x1.0a0000p+0f, 0x1.7e6ec2p-8f), (float2)(0x1.0a0000p+0f, 0x1.a0429ap-10f), (float2)(0x1.080000p+0f, 0x1.53f390p-8f), (float2)(0x1.080000p+0f, 0x1.084210p-10f), (float2)(0x1.060000p+0f, 0x1.3260a4p-8f), (float2)(0x1.060000p+0f, 0x1.26e978p-11f), (float2)(0x1.040000p+0f, 0x1.197f7ep-8f), (float2)(0x1.040000p+0f, 0x1.041042p-12f), (float2)(0x1.020000p+0f, 0x1.091b52p-8f), (float2)(0x1.020000p+0f, 0x1.020408p-14f), (float2)(0x1.000000p+0f, 0x1.010102p-8f), (float2)(0x1.000000p+0f, 0x0.000000p+0f), }; DECLARE_TABLE(float2, LOG2_TBL, 129) = { (float2)(0x0.000000p+0f, 0x0.000000p+0f), (float2)(0x1.6f8000p-7f, 0x1.942dbap-17f), (float2)(0x1.6e0000p-6f, 0x1.e5a170p-16f), (float2)(0x1.118000p-5f, 0x1.347544p-15f), (float2)(0x1.6b8000p-5f, 0x1.69bac6p-16f), (float2)(0x1.c48000p-5f, 0x1.7eae42p-15f), (float2)(0x1.0e8000p-4f, 0x1.9c4fd0p-15f), (float2)(0x1.3a8000p-4f, 0x1.17ee92p-15f), (float2)(0x1.660000p-4f, 0x1.fb7d64p-15f), (float2)(0x1.918000p-4f, 0x1.42dc8cp-17f), (float2)(0x1.bc8000p-4f, 0x1.0902b6p-18f), (float2)(0x1.e70000p-4f, 0x1.7608bep-15f), (float2)(0x1.088000p-3f, 0x1.162336p-13f), (float2)(0x1.1d8000p-3f, 0x1.3465d4p-13f), (float2)(0x1.328000p-3f, 0x1.74f13cp-14f), (float2)(0x1.470000p-3f, 0x1.aa7e60p-13f), (float2)(0x1.5c0000p-3f, 0x1.a39fbcp-19f), (float2)(0x1.700000p-3f, 0x1.d0b53ap-13f), (float2)(0x1.848000p-3f, 0x1.0af40ap-13f), (float2)(0x1.988000p-3f, 0x1.b741dep-13f), (float2)(0x1.ac8000p-3f, 0x1.d78b6cp-13f), (float2)(0x1.c08000p-3f, 0x1.6db376p-13f), (float2)(0x1.d48000p-3f, 0x1.ee4c32p-15f), (float2)(0x1.e80000p-3f, 0x1.02f9d2p-13f), (float2)(0x1.fb8000p-3f, 0x1.05ae40p-13f), (float2)(0x1.078000p-2f, 0x1.0adbb0p-14f), (float2)(0x1.110000p-2f, 0x1.83ed68p-13f), (float2)(0x1.1a8000p-2f, 0x1.016ca4p-12f), (float2)(0x1.240000p-2f, 0x1.01eac2p-12f), (float2)(0x1.2d8000p-2f, 0x1.887e26p-13f), (float2)(0x1.370000p-2f, 0x1.24cea4p-14f), (float2)(0x1.400000p-2f, 0x1.918ec6p-12f), (float2)(0x1.498000p-2f, 0x1.3c25e6p-13f), (float2)(0x1.528000p-2f, 0x1.6f7f12p-12f), (float2)(0x1.5c0000p-2f, 0x1.a39fbcp-18f), (float2)(0x1.650000p-2f, 0x1.8fe466p-14f), (float2)(0x1.6e0000p-2f, 0x1.10e6cep-13f), (float2)(0x1.770000p-2f, 0x1.d2ba7ep-14f), (float2)(0x1.800000p-2f, 0x1.4ac62cp-15f), (float2)(0x1.888000p-2f, 0x1.a71cb8p-12f), (float2)(0x1.918000p-2f, 0x1.dd448ep-13f), (float2)(0x1.9a8000p-2f, 0x1.1c8f10p-21f), (float2)(0x1.a30000p-2f, 0x1.bb053ep-13f), (float2)(0x1.ab8000p-2f, 0x1.861e5ep-12f), (float2)(0x1.b40000p-2f, 0x1.fafdcep-12f), (float2)(0x1.bd0000p-2f, 0x1.e5d3cep-15f), (float2)(0x1.c58000p-2f, 0x1.2fad28p-14f), (float2)(0x1.ce0000p-2f, 0x1.492474p-15f), (float2)(0x1.d60000p-2f, 0x1.d4f80cp-12f), (float2)(0x1.de8000p-2f, 0x1.4ff510p-12f), (float2)(0x1.e70000p-2f, 0x1.3550f2p-13f), (float2)(0x1.ef0000p-2f, 0x1.b59ccap-12f), (float2)(0x1.f78000p-2f, 0x1.42b464p-13f), (float2)(0x1.ff8000p-2f, 0x1.5e66a0p-12f), (float2)(0x1.038000p-1f, 0x1.f6a2e4p-11f), (float2)(0x1.080000p-1f, 0x1.39e4fep-14f), (float2)(0x1.0c0000p-1f, 0x1.0500d6p-13f), (float2)(0x1.100000p-1f, 0x1.13b152p-13f), (float2)(0x1.140000p-1f, 0x1.93f542p-14f), (float2)(0x1.180000p-1f, 0x1.467b94p-16f), (float2)(0x1.1b8000p-1f, 0x1.cc47a4p-11f), (float2)(0x1.1f8000p-1f, 0x1.78f4c2p-11f), (float2)(0x1.238000p-1f, 0x1.107508p-11f), (float2)(0x1.278000p-1f, 0x1.2602c2p-12f), (float2)(0x1.2b8000p-1f, 0x1.a39fbcp-20f), (float2)(0x1.2f0000p-1f, 0x1.5a1d7ap-11f), (float2)(0x1.330000p-1f, 0x1.3e355ap-12f), (float2)(0x1.368000p-1f, 0x1.cffedap-11f), (float2)(0x1.3a8000p-1f, 0x1.d9fd50p-12f), (float2)(0x1.3e0000p-1f, 0x1.f64de6p-11f), (float2)(0x1.420000p-1f, 0x1.d83f4cp-12f), (float2)(0x1.458000p-1f, 0x1.cea628p-11f), (float2)(0x1.498000p-1f, 0x1.3c25e6p-12f), (float2)(0x1.4d0000p-1f, 0x1.5a96ccp-11f), (float2)(0x1.510000p-1f, 0x1.18708ap-17f), (float2)(0x1.548000p-1f, 0x1.374652p-12f), (float2)(0x1.580000p-1f, 0x1.2089a6p-11f), (float2)(0x1.5b8000p-1f, 0x1.93432cp-11f), (float2)(0x1.5f0000p-1f, 0x1.f3fd06p-11f), (float2)(0x1.630000p-1f, 0x1.0b8f54p-13f), (float2)(0x1.668000p-1f, 0x1.004722p-12f), (float2)(0x1.6a0000p-1f, 0x1.57cf2cp-12f), (float2)(0x1.6d8000p-1f, 0x1.8cb53ap-12f), (float2)(0x1.710000p-1f, 0x1.9f4d8ap-12f), (float2)(0x1.748000p-1f, 0x1.8feb26p-12f), (float2)(0x1.780000p-1f, 0x1.5edfeep-12f), (float2)(0x1.7b8000p-1f, 0x1.0c7c9ap-12f), (float2)(0x1.7f0000p-1f, 0x1.322182p-13f), (float2)(0x1.828000p-1f, 0x1.3ab7cep-18f), (float2)(0x1.858000p-1f, 0x1.a82c2cp-11f), (float2)(0x1.890000p-1f, 0x1.3dd2c0p-11f), (float2)(0x1.8c8000p-1f, 0x1.871da4p-12f), (float2)(0x1.900000p-1f, 0x1.cc2c00p-14f), (float2)(0x1.930000p-1f, 0x1.9fdb68p-11f), (float2)(0x1.968000p-1f, 0x1.ed6956p-12f), (float2)(0x1.9a0000p-1f, 0x1.f1a760p-14f), (float2)(0x1.9d0000p-1f, 0x1.767f54p-11f), (float2)(0x1.a08000p-1f, 0x1.3f6d26p-12f), (float2)(0x1.a38000p-1f, 0x1.b9fce2p-11f), (float2)(0x1.a70000p-1f, 0x1.8ae816p-12f), (float2)(0x1.aa0000p-1f, 0x1.c23d60p-11f), (float2)(0x1.ad8000p-1f, 0x1.60f388p-12f), (float2)(0x1.b08000p-1f, 0x1.9049aep-11f), (float2)(0x1.b40000p-1f, 0x1.8734a8p-13f), (float2)(0x1.b70000p-1f, 0x1.2523d4p-11f), (float2)(0x1.ba0000p-1f, 0x1.da6ce6p-11f), (float2)(0x1.bd8000p-1f, 0x1.038e62p-12f), (float2)(0x1.c08000p-1f, 0x1.1b511ep-11f), (float2)(0x1.c38000p-1f, 0x1.a728b8p-11f), (float2)(0x1.c70000p-1f, 0x1.2b5d22p-14f), (float2)(0x1.ca0000p-1f, 0x1.2c6e54p-12f), (float2)(0x1.cd0000p-1f, 0x1.f35064p-12f), (float2)(0x1.d00000p-1f, 0x1.4fdb48p-11f), (float2)(0x1.d30000p-1f, 0x1.98ec9ep-11f), (float2)(0x1.d60000p-1f, 0x1.d4f80cp-11f), (float2)(0x1.d98000p-1f, 0x1.0643d6p-17f), (float2)(0x1.dc8000p-1f, 0x1.33567ep-14f), (float2)(0x1.df8000p-1f, 0x1.e0410cp-14f), (float2)(0x1.e28000p-1f, 0x1.142e0ep-13f), (float2)(0x1.e58000p-1f, 0x1.063c88p-13f), (float2)(0x1.e88000p-1f, 0x1.8d66c4p-14f), (float2)(0x1.eb8000p-1f, 0x1.57e32ap-15f), (float2)(0x1.ee0000p-1f, 0x1.ed1c6cp-11f), (float2)(0x1.f10000p-1f, 0x1.b8a076p-11f), (float2)(0x1.f40000p-1f, 0x1.7822f2p-11f), (float2)(0x1.f70000p-1f, 0x1.2bbc3ap-11f), (float2)(0x1.fa0000p-1f, 0x1.a708bap-12f), (float2)(0x1.fd0000p-1f, 0x1.be4c7ep-13f), (float2)(0x1.000000p+0f, 0x0.000000p+0f) }; DECLARE_TABLE(uchar, PIBITS_TBL, ) = { 224, 241, 27, 193, 12, 88, 33, 116, 53, 126, 196, 126, 237, 175, 169, 75, 74, 41, 222, 231, 28, 244, 236, 197, 151, 175, 31, 235, 158, 212, 181, 168, 127, 121, 154, 253, 24, 61, 221, 38, 44, 159, 60, 251, 217, 180, 125, 180, 41, 104, 45, 70, 188, 188, 63, 96, 22, 120, 255, 95, 226, 127, 236, 160, 228, 247, 46, 126, 17, 114, 210, 231, 76, 13, 230, 88, 71, 230, 4, 249, 125, 209, 154, 192, 113, 166, 19, 18, 237, 186, 212, 215, 8, 162, 251, 156, 166, 196, 114, 172, 119, 248, 115, 72, 70, 39, 168, 187, 36, 25, 128, 75, 55, 9, 233, 184, 145, 220, 134, 21, 239, 122, 175, 142, 69, 249, 7, 65, 14, 241, 100, 86, 138, 109, 3, 119, 211, 212, 71, 95, 157, 240, 167, 84, 16, 57, 185, 13, 230, 139, 2, 0, 0, 0, 0, 0, 0, 0 }; // Tabulated values of sinh(i) and cosh(i) for i = 0,...,36. DECLARE_TABLE(float2, SINHCOSH_TBL, 37) = { (float2)(0x0.000000p+0f, 0x1.000000p+0f), (float2)(0x1.2cd9fcp+0f, 0x1.8b0756p+0f), (float2)(0x1.d03cf6p+1f, 0x1.e18fa0p+1f), (float2)(0x1.40926ep+3f, 0x1.422a4ap+3f), (float2)(0x1.b4a380p+4f, 0x1.b4ee86p+4f), (float2)(0x1.28d016p+6f, 0x1.28d6fcp+6f), (float2)(0x1.936d22p+7f, 0x1.936e68p+7f), (float2)(0x1.122876p+9f, 0x1.122894p+9f), (float2)(0x1.749ea6p+10f, 0x1.749eaap+10f), (float2)(0x1.fa7158p+11f, 0x1.fa7158p+11f), (float2)(0x1.5829dcp+13f, 0x1.5829dep+13f), (float2)(0x1.d3c448p+14f, 0x1.d3c448p+14f), (float2)(0x1.3de166p+16f, 0x1.3de166p+16f), (float2)(0x1.b00b5ap+17f, 0x1.b00b5ap+17f), (float2)(0x1.259ac4p+19f, 0x1.259ac4p+19f), (float2)(0x1.8f0ccap+20f, 0x1.8f0ccap+20f), (float2)(0x1.0f2ebep+22f, 0x1.0f2ebep+22f), (float2)(0x1.709348p+23f, 0x1.709348p+23f), (float2)(0x1.f4f220p+24f, 0x1.f4f220p+24f), (float2)(0x1.546d90p+26f, 0x1.546d90p+26f), (float2)(0x1.ceb088p+27f, 0x1.ceb088p+27f), (float2)(0x1.3a6e20p+29f, 0x1.3a6e20p+29f), (float2)(0x1.ab5adcp+30f, 0x1.ab5adcp+30f), (float2)(0x1.226af4p+32f, 0x1.226af4p+32f), (float2)(0x1.8ab7fcp+33f, 0x1.8ab7fcp+33f), (float2)(0x1.0c3d3ap+35f, 0x1.0c3d3ap+35f), (float2)(0x1.6c9326p+36f, 0x1.6c9326p+36f), (float2)(0x1.ef8230p+37f, 0x1.ef8230p+37f), (float2)(0x1.50bba4p+39f, 0x1.50bba4p+39f), (float2)(0x1.c9aae4p+40f, 0x1.c9aae4p+40f), (float2)(0x1.370470p+42f, 0x1.370470p+42f), (float2)(0x1.a6b766p+43f, 0x1.a6b766p+43f), (float2)(0x1.1f43fcp+45f, 0x1.1f43fcp+45f), (float2)(0x1.866f34p+46f, 0x1.866f34p+46f), (float2)(0x1.0953e2p+48f, 0x1.0953e2p+48f), (float2)(0x1.689e22p+49f, 0x1.689e22p+49f), (float2)(0x1.ea215ap+50f, 0x1.ea215ap+50f) }; DECLARE_TABLE(float2, CBRT_TBL, 129) = { (float2)(0x1.000000p+0f, 0x0.000000p+0f), (float2)(0x1.008000p+0f, 0x1.51cb0ap-11f), (float2)(0x1.014000p+0f, 0x1.39221ep-12f), (float2)(0x1.01c000p+0f, 0x1.e06908p-11f), (float2)(0x1.028000p+0f, 0x1.1d6978p-11f), (float2)(0x1.034000p+0f, 0x1.4ea1bep-13f), (float2)(0x1.03c000p+0f, 0x1.833b8ep-11f), (float2)(0x1.048000p+0f, 0x1.587002p-12f), (float2)(0x1.050000p+0f, 0x1.ceb290p-11f), (float2)(0x1.05c000p+0f, 0x1.d57f34p-12f), (float2)(0x1.068000p+0f, 0x1.cc53acp-21f), (float2)(0x1.070000p+0f, 0x1.0fe098p-11f), (float2)(0x1.07c000p+0f, 0x1.91b586p-15f), (float2)(0x1.084000p+0f, 0x1.1c362ep-11f), (float2)(0x1.090000p+0f, 0x1.94398ep-15f), (float2)(0x1.098000p+0f, 0x1.1055bcp-11f), (float2)(0x1.0a4000p+0f, 0x1.7e63cap-19f), (float2)(0x1.0ac000p+0f, 0x1.d99e1ap-12f), (float2)(0x1.0b4000p+0f, 0x1.d258dep-11f), (float2)(0x1.0c0000p+0f, 0x1.645962p-12f), (float2)(0x1.0c8000p+0f, 0x1.8c5b0ep-11f), (float2)(0x1.0d4000p+0f, 0x1.83d0c8p-13f), (float2)(0x1.0dc000p+0f, 0x1.300812p-11f), (float2)(0x1.0e4000p+0f, 0x1.f9a65ap-11f), (float2)(0x1.0f0000p+0f, 0x1.7bbcd8p-12f), (float2)(0x1.0f8000p+0f, 0x1.7cbf68p-11f), (float2)(0x1.104000p+0f, 0x1.b2c166p-14f), (float2)(0x1.10c000p+0f, 0x1.d56ea4p-12f), (float2)(0x1.114000p+0f, 0x1.99eb32p-11f), (float2)(0x1.120000p+0f, 0x1.1007a2p-13f), (float2)(0x1.128000p+0f, 0x1.d212aap-12f), (float2)(0x1.130000p+0f, 0x1.890f18p-11f), (float2)(0x1.13c000p+0f, 0x1.2104e2p-14f), (float2)(0x1.144000p+0f, 0x1.74961ep-12f), (float2)(0x1.14c000p+0f, 0x1.4b9b66p-11f), (float2)(0x1.154000p+0f, 0x1.d81e66p-11f), (float2)(0x1.160000p+0f, 0x1.7f825cp-13f), (float2)(0x1.168000p+0f, 0x1.c5dca2p-12f), (float2)(0x1.170000p+0f, 0x1.6153bap-11f), (float2)(0x1.178000p+0f, 0x1.db1cc2p-11f), (float2)(0x1.184000p+0f, 0x1.4154b0p-13f), (float2)(0x1.18c000p+0f, 0x1.821114p-12f), (float2)(0x1.194000p+0f, 0x1.2d4240p-11f), (float2)(0x1.19c000p+0f, 0x1.950d82p-11f), (float2)(0x1.1a4000p+0f, 0x1.f8755cp-11f), (float2)(0x1.1b0000p+0f, 0x1.5e12a4p-13f), (float2)(0x1.1b8000p+0f, 0x1.648c38p-12f), (float2)(0x1.1c0000p+0f, 0x1.08c43ep-11f), (float2)(0x1.1c8000p+0f, 0x1.5b0970p-11f), (float2)(0x1.1d0000p+0f, 0x1.a91fe8p-11f), (float2)(0x1.1d8000p+0f, 0x1.f311b6p-11f), (float2)(0x1.1e4000p+0f, 0x1.c74618p-14f), (float2)(0x1.1ec000p+0f, 0x1.eabb54p-13f), (float2)(0x1.1f4000p+0f, 0x1.70db14p-12f), (float2)(0x1.1fc000p+0f, 0x1.e45cbcp-12f), (float2)(0x1.204000p+0f, 0x1.27faa6p-11f), (float2)(0x1.20c000p+0f, 0x1.59db98p-11f), (float2)(0x1.214000p+0f, 0x1.87da46p-11f), (float2)(0x1.21c000p+0f, 0x1.b1ffa0p-11f), (float2)(0x1.224000p+0f, 0x1.d85478p-11f), (float2)(0x1.22c000p+0f, 0x1.fae17ep-11f), (float2)(0x1.238000p+0f, 0x1.9af40cp-15f), (float2)(0x1.240000p+0f, 0x1.a6319ep-14f), (float2)(0x1.248000p+0f, 0x1.30baa6p-13f), (float2)(0x1.250000p+0f, 0x1.7fc362p-13f), (float2)(0x1.258000p+0f, 0x1.c05362p-13f), (float2)(0x1.260000p+0f, 0x1.f28a98p-13f), (float2)(0x1.268000p+0f, 0x1.0b4442p-12f), (float2)(0x1.270000p+0f, 0x1.16361ap-12f), (float2)(0x1.278000p+0f, 0x1.1a2a2ap-12f), (float2)(0x1.280000p+0f, 0x1.172f8ep-12f), (float2)(0x1.288000p+0f, 0x1.0d5530p-12f), (float2)(0x1.290000p+0f, 0x1.f9538ep-13f), (float2)(0x1.298000p+0f, 0x1.ca77b0p-13f), (float2)(0x1.2a0000p+0f, 0x1.8e336ap-13f), (float2)(0x1.2a8000p+0f, 0x1.44a304p-13f), (float2)(0x1.2b0000p+0f, 0x1.dbc4c8p-14f), (float2)(0x1.2b8000p+0f, 0x1.141a2ap-14f), (float2)(0x1.2c0000p+0f, 0x1.93e44cp-17f), (float2)(0x1.2c4000p+0f, 0x1.e6e432p-11f), (float2)(0x1.2cc000p+0f, 0x1.c447c6p-11f), (float2)(0x1.2d4000p+0f, 0x1.9e80d8p-11f), (float2)(0x1.2dc000p+0f, 0x1.7595dcp-11f), (float2)(0x1.2e4000p+0f, 0x1.498d30p-11f), (float2)(0x1.2ec000p+0f, 0x1.1a6d1ep-11f), (float2)(0x1.2f4000p+0f, 0x1.d077bap-12f), (float2)(0x1.2fc000p+0f, 0x1.65ff1ep-12f), (float2)(0x1.304000p+0f, 0x1.eaf912p-13f), (float2)(0x1.30c000p+0f, 0x1.fbefb8p-14f), (float2)(0x1.314000p+0f, 0x1.44905ap-19f), (float2)(0x1.318000p+0f, 0x1.c017e6p-11f), (float2)(0x1.320000p+0f, 0x1.7bfdbep-11f), (float2)(0x1.328000p+0f, 0x1.34fbc6p-11f), (float2)(0x1.330000p+0f, 0x1.d62f48p-12f), (float2)(0x1.338000p+0f, 0x1.3cadc6p-12f), (float2)(0x1.340000p+0f, 0x1.3afc06p-13f), (float2)(0x1.344000p+0f, 0x1.fc556ep-11f), (float2)(0x1.34c000p+0f, 0x1.a71f84p-11f), (float2)(0x1.354000p+0f, 0x1.4f2290p-11f), (float2)(0x1.35c000p+0f, 0x1.e8c79cp-12f), (float2)(0x1.364000p+0f, 0x1.2dd0d8p-12f), (float2)(0x1.36c000p+0f, 0x1.b5ac2ep-14f), (float2)(0x1.370000p+0f, 0x1.d3d02ap-11f), (float2)(0x1.378000p+0f, 0x1.6e3d58p-11f), (float2)(0x1.380000p+0f, 0x1.060200p-11f), (float2)(0x1.388000p+0f, 0x1.364608p-12f), (float2)(0x1.390000p+0f, 0x1.6d29b6p-14f), (float2)(0x1.394000p+0f, 0x1.bd8d5ep-11f), (float2)(0x1.39c000p+0f, 0x1.4ae030p-11f), (float2)(0x1.3a4000p+0f, 0x1.ab44b2p-12f), (float2)(0x1.3ac000p+0f, 0x1.7761cep-13f), (float2)(0x1.3b0000p+0f, 0x1.e38710p-11f), (float2)(0x1.3b8000p+0f, 0x1.66b2b0p-11f), (float2)(0x1.3c0000p+0f, 0x1.cebf96p-12f), (float2)(0x1.3c8000p+0f, 0x1.964b20p-13f), (float2)(0x1.3cc000p+0f, 0x1.e15004p-11f), (float2)(0x1.3d4000p+0f, 0x1.5a9bcep-11f), (float2)(0x1.3dc000p+0f, 0x1.a2f4d8p-12f), (float2)(0x1.3e4000p+0f, 0x1.17c056p-13f), (float2)(0x1.3e8000p+0f, 0x1.b800f8p-11f), (float2)(0x1.3f0000p+0f, 0x1.27b132p-11f), (float2)(0x1.3f8000p+0f, 0x1.2a09b8p-12f), (float2)(0x1.400000p+0f, 0x0.000000p+0f), (float2)(0x1.404000p+0f, 0x1.68a69cp-11f), (float2)(0x1.40c000p+0f, 0x1.9df950p-12f), (float2)(0x1.414000p+0f, 0x1.983050p-14f), (float2)(0x1.418000p+0f, 0x1.94c6a4p-11f), (float2)(0x1.420000p+0f, 0x1.e88494p-12f), (float2)(0x1.428000p+0f, 0x1.45f31ap-13f) }; DECLARE_TABLE(float, EXP_TBL, 65) = { 0x1.000000p+0f, 0x1.02c9a4p+0f, 0x1.059b0ep+0f, 0x1.087452p+0f, 0x1.0b5586p+0f, 0x1.0e3ec4p+0f, 0x1.11301ep+0f, 0x1.1429aap+0f, 0x1.172b84p+0f, 0x1.1a35bep+0f, 0x1.1d4874p+0f, 0x1.2063b8p+0f, 0x1.2387a6p+0f, 0x1.26b456p+0f, 0x1.29e9e0p+0f, 0x1.2d285ap+0f, 0x1.306fe0p+0f, 0x1.33c08cp+0f, 0x1.371a74p+0f, 0x1.3a7db4p+0f, 0x1.3dea64p+0f, 0x1.4160a2p+0f, 0x1.44e086p+0f, 0x1.486a2cp+0f, 0x1.4bfdaep+0f, 0x1.4f9b28p+0f, 0x1.5342b6p+0f, 0x1.56f474p+0f, 0x1.5ab07ep+0f, 0x1.5e76f2p+0f, 0x1.6247ecp+0f, 0x1.662388p+0f, 0x1.6a09e6p+0f, 0x1.6dfb24p+0f, 0x1.71f75ep+0f, 0x1.75feb6p+0f, 0x1.7a1148p+0f, 0x1.7e2f34p+0f, 0x1.82589ap+0f, 0x1.868d9ap+0f, 0x1.8ace54p+0f, 0x1.8f1aeap+0f, 0x1.93737cp+0f, 0x1.97d82ap+0f, 0x1.9c4918p+0f, 0x1.a0c668p+0f, 0x1.a5503cp+0f, 0x1.a9e6b6p+0f, 0x1.ae89fap+0f, 0x1.b33a2cp+0f, 0x1.b7f770p+0f, 0x1.bcc1eap+0f, 0x1.c199bep+0f, 0x1.c67f12p+0f, 0x1.cb720ep+0f, 0x1.d072d4p+0f, 0x1.d5818ep+0f, 0x1.da9e60p+0f, 0x1.dfc974p+0f, 0x1.e502eep+0f, 0x1.ea4afap+0f, 0x1.efa1bep+0f, 0x1.f50766p+0f, 0x1.fa7c18p+0f, 0x1.000000p+1f, }; DECLARE_TABLE(float2, EXP_TBL_EP, 65) = { (float2) (0x1.000000p+0f, 0x0.000000p+0f), (float2) (0x1.02c000p+0f, 0x1.347ceep-13f), (float2) (0x1.058000p+0f, 0x1.b0d314p-12f), (float2) (0x1.084000p+0f, 0x1.a28c3ap-11f), (float2) (0x1.0b4000p+0f, 0x1.586cf8p-12f), (float2) (0x1.0e0000p+0f, 0x1.f61968p-11f), (float2) (0x1.110000p+0f, 0x1.80e808p-11f), (float2) (0x1.140000p+0f, 0x1.4d5754p-11f), (float2) (0x1.170000p+0f, 0x1.5c1e3ep-11f), (float2) (0x1.1a0000p+0f, 0x1.adf5b6p-11f), (float2) (0x1.1d4000p+0f, 0x1.0e62d0p-13f), (float2) (0x1.204000p+0f, 0x1.1dc430p-11f), (float2) (0x1.238000p+0f, 0x1.e9b9d4p-14f), (float2) (0x1.268000p+0f, 0x1.a2b2f0p-11f), (float2) (0x1.29c000p+0f, 0x1.4efa8ep-11f), (float2) (0x1.2d0000p+0f, 0x1.42d372p-11f), (float2) (0x1.304000p+0f, 0x1.7f0518p-11f), (float2) (0x1.33c000p+0f, 0x1.164c82p-17f), (float2) (0x1.370000p+0f, 0x1.a7373ap-12f), (float2) (0x1.3a4000p+0f, 0x1.ed9a72p-11f), (float2) (0x1.3dc000p+0f, 0x1.532608p-11f), (float2) (0x1.414000p+0f, 0x1.0510fap-11f), (float2) (0x1.44c000p+0f, 0x1.043030p-11f), (float2) (0x1.484000p+0f, 0x1.515ae0p-11f), (float2) (0x1.4bc000p+0f, 0x1.ed6a9ap-11f), (float2) (0x1.4f8000p+0f, 0x1.b2769cp-12f), (float2) (0x1.534000p+0f, 0x1.5ab4eap-15f), (float2) (0x1.56c000p+0f, 0x1.a39b5ap-11f), (float2) (0x1.5a8000p+0f, 0x1.83eea4p-11f), (float2) (0x1.5e4000p+0f, 0x1.b78ad6p-11f), (float2) (0x1.624000p+0f, 0x1.fac0e8p-14f), (float2) (0x1.660000p+0f, 0x1.1c412ap-11f), (float2) (0x1.6a0000p+0f, 0x1.3cccfep-13f), (float2) (0x1.6dc000p+0f, 0x1.d91e32p-11f), (float2) (0x1.71c000p+0f, 0x1.baf476p-11f), (float2) (0x1.75c000p+0f, 0x1.f5ab20p-11f), (float2) (0x1.7a0000p+0f, 0x1.1473eap-12f), (float2) (0x1.7e0000p+0f, 0x1.799b66p-11f), (float2) (0x1.824000p+0f, 0x1.89994cp-12f), (float2) (0x1.868000p+0f, 0x1.b33688p-13f), (float2) (0x1.8ac000p+0f, 0x1.ca8454p-13f), (float2) (0x1.8f0000p+0f, 0x1.ae9914p-12f), (float2) (0x1.934000p+0f, 0x1.9bd866p-11f), (float2) (0x1.97c000p+0f, 0x1.829fdep-12f), (float2) (0x1.9c4000p+0f, 0x1.230546p-13f), (float2) (0x1.a0c000p+0f, 0x1.99ed76p-14f), (float2) (0x1.a54000p+0f, 0x1.03b23ep-12f), (float2) (0x1.a9c000p+0f, 0x1.35aabcp-11f), (float2) (0x1.ae8000p+0f, 0x1.3f32b4p-13f), (float2) (0x1.b30000p+0f, 0x1.d15c26p-11f), (float2) (0x1.b7c000p+0f, 0x1.bb797cp-11f), (float2) (0x1.bcc000p+0f, 0x1.e904bcp-16f), (float2) (0x1.c18000p+0f, 0x1.9bdd84p-12f), (float2) (0x1.c64000p+0f, 0x1.f8972ap-11f), (float2) (0x1.cb4000p+0f, 0x1.906e76p-11f), (float2) (0x1.d04000p+0f, 0x1.96a502p-11f), (float2) (0x1.d58000p+0f, 0x1.8dcfbap-16f), (float2) (0x1.da8000p+0f, 0x1.e603dap-12f), (float2) (0x1.dfc000p+0f, 0x1.2e66f6p-13f), (float2) (0x1.e50000p+0f, 0x1.773c58p-15f), (float2) (0x1.ea4000p+0f, 0x1.5f4548p-13f), (float2) (0x1.ef8000p+0f, 0x1.0df730p-11f), (float2) (0x1.f50000p+0f, 0x1.d96db8p-14f), (float2) (0x1.fa4000p+0f, 0x1.e0c0cep-11f), (float2) (0x1.000000p+1f, 0x0.000000p+0f), }; TABLE_FUNCTION(float2, LOGE_TBL, loge_tbl); TABLE_FUNCTION(float, LOG_INV_TBL, log_inv_tbl); TABLE_FUNCTION(float2, LOG_INV_TBL_EP, log_inv_tbl_ep); TABLE_FUNCTION(float2, LOG2_TBL, log2_tbl); uint4 TABLE_MANGLE(pibits_tbl)(size_t idx) { return *(__constant uint4 *)(PIBITS_TBL + idx); } TABLE_FUNCTION(float2, SINHCOSH_TBL, sinhcosh_tbl); TABLE_FUNCTION(float2, CBRT_TBL, cbrt_tbl); TABLE_FUNCTION(float, EXP_TBL, exp_tbl); TABLE_FUNCTION(float2, EXP_TBL_EP, exp_tbl_ep); #ifdef cl_khr_fp64 DECLARE_TABLE(double2, LN_TBL, 65) = { (double2)(0x0.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.fc0a800000000p-7, 0x1.61f807c79f3dbp-28), (double2)(0x1.f829800000000p-6, 0x1.873c1980267c8p-25), (double2)(0x1.7745800000000p-5, 0x1.ec65b9f88c69ep-26), (double2)(0x1.f0a3000000000p-5, 0x1.8022c54cc2f99p-26), (double2)(0x1.341d700000000p-4, 0x1.2c37a3a125330p-25), (double2)(0x1.6f0d200000000p-4, 0x1.15cad69737c93p-25), (double2)(0x1.a926d00000000p-4, 0x1.d256ab1b285e9p-27), (double2)(0x1.e270700000000p-4, 0x1.b8abcb97a7aa2p-26), (double2)(0x1.0d77e00000000p-3, 0x1.f34239659a5dcp-25), (double2)(0x1.2955280000000p-3, 0x1.e07fd48d30177p-25), (double2)(0x1.44d2b00000000p-3, 0x1.b32df4799f4f6p-25), (double2)(0x1.5ff3000000000p-3, 0x1.c29e4f4f21cf8p-25), (double2)(0x1.7ab8900000000p-3, 0x1.086c848df1b59p-30), (double2)(0x1.9525a80000000p-3, 0x1.cf456b4764130p-27), (double2)(0x1.af3c900000000p-3, 0x1.3a02ffcb63398p-25), (double2)(0x1.c8ff780000000p-3, 0x1.1e6a6886b0976p-25), (double2)(0x1.e270700000000p-3, 0x1.b8abcb97a7aa2p-25), (double2)(0x1.fb91800000000p-3, 0x1.b578f8aa35552p-25), (double2)(0x1.0a324c0000000p-2, 0x1.139c871afb9fcp-25), (double2)(0x1.1675c80000000p-2, 0x1.5d5d30701ce64p-25), (double2)(0x1.22941c0000000p-2, 0x1.de7bcb2d12142p-25), (double2)(0x1.2e8e280000000p-2, 0x1.d708e984e1664p-25), (double2)(0x1.3a64c40000000p-2, 0x1.56945e9c72f36p-26), (double2)(0x1.4618bc0000000p-2, 0x1.0e2f613e85bdap-29), (double2)(0x1.51aad80000000p-2, 0x1.cb7e0b42724f6p-28), (double2)(0x1.5d1bd80000000p-2, 0x1.fac04e52846c7p-25), (double2)(0x1.686c800000000p-2, 0x1.e9b14aec442bep-26), (double2)(0x1.739d7c0000000p-2, 0x1.b5de8034e7126p-25), (double2)(0x1.7eaf800000000p-2, 0x1.dc157e1b259d3p-25), (double2)(0x1.89a3380000000p-2, 0x1.b05096ad69c62p-28), (double2)(0x1.9479400000000p-2, 0x1.c2116faba4cddp-26), (double2)(0x1.9f323c0000000p-2, 0x1.65fcc25f95b47p-25), (double2)(0x1.a9cec80000000p-2, 0x1.a9a08498d4850p-26), (double2)(0x1.b44f740000000p-2, 0x1.de647b1465f77p-25), (double2)(0x1.beb4d80000000p-2, 0x1.da71b7bf7861dp-26), (double2)(0x1.c8ff7c0000000p-2, 0x1.e6a6886b09760p-28), (double2)(0x1.d32fe40000000p-2, 0x1.f0075eab0ef64p-25), (double2)(0x1.dd46a00000000p-2, 0x1.3071282fb989bp-28), (double2)(0x1.e744240000000p-2, 0x1.0eb43c3f1bed2p-25), (double2)(0x1.f128f40000000p-2, 0x1.faf06ecb35c84p-26), (double2)(0x1.faf5880000000p-2, 0x1.ef1e63db35f68p-27), (double2)(0x1.02552a0000000p-1, 0x1.69743fb1a71a5p-27), (double2)(0x1.0723e40000000p-1, 0x1.c1cdf404e5796p-25), (double2)(0x1.0be72e0000000p-1, 0x1.094aa0ada625ep-27), (double2)(0x1.109f380000000p-1, 0x1.e2d4c96fde3ecp-25), (double2)(0x1.154c3c0000000p-1, 0x1.2f4d5e9a98f34p-25), (double2)(0x1.19ee6a0000000p-1, 0x1.467c96ecc5cbep-25), (double2)(0x1.1e85f40000000p-1, 0x1.e7040d03dec5ap-25), (double2)(0x1.23130c0000000p-1, 0x1.7bebf4282de36p-25), (double2)(0x1.2795e00000000p-1, 0x1.289b11aeb783fp-25), (double2)(0x1.2c0e9e0000000p-1, 0x1.a891d1772f538p-26), (double2)(0x1.307d720000000p-1, 0x1.34f10be1fb591p-25), (double2)(0x1.34e2880000000p-1, 0x1.d9ce1d316eb93p-25), (double2)(0x1.393e0c0000000p-1, 0x1.3562a19a9c442p-25), (double2)(0x1.3d90260000000p-1, 0x1.4e2adf548084cp-26), (double2)(0x1.41d8fe0000000p-1, 0x1.08ce55cc8c97ap-26), (double2)(0x1.4618bc0000000p-1, 0x1.0e2f613e85bdap-28), (double2)(0x1.4a4f840000000p-1, 0x1.db03ebb0227bfp-25), (double2)(0x1.4e7d800000000p-1, 0x1.1b75bb09cb098p-25), (double2)(0x1.52a2d20000000p-1, 0x1.96f16abb9df22p-27), (double2)(0x1.56bf9c0000000p-1, 0x1.5b3f399411c62p-25), (double2)(0x1.5ad4040000000p-1, 0x1.86b3e59f65355p-26), (double2)(0x1.5ee02a0000000p-1, 0x1.2482ceae1ac12p-26), (double2)(0x1.62e42e0000000p-1, 0x1.efa39ef35793cp-25), }; TABLE_FUNCTION(double2, LN_TBL, ln_tbl); // Arrays atan_jby256_lead and atan_jby256_tail contain // leading and trailing parts respectively of precomputed // values of atan(j/256), for j = 16, 17, ..., 256. // atan_jby256_lead contains the first 21 bits of precision, // and atan_jby256_tail contains a further 53 bits precision. DECLARE_TABLE(double2, ATAN_JBY256_TBL, 241) = { (double2)(0x1.ff55b00000000p-5, 0x1.6e59fbd38db2cp-26), (double2)(0x1.0f99e00000000p-4, 0x1.4e3aa54dedf96p-25), (double2)(0x1.1f86d00000000p-4, 0x1.7e105ab1bda88p-25), (double2)(0x1.2f71900000000p-4, 0x1.8c5254d013fd0p-27), (double2)(0x1.3f59f00000000p-4, 0x1.cf8ab3ad62670p-29), (double2)(0x1.4f3fd00000000p-4, 0x1.9dca4bec80468p-26), (double2)(0x1.5f23200000000p-4, 0x1.3f4b5ec98a8dap-26), (double2)(0x1.6f03b00000000p-4, 0x1.b9d49619d81fep-25), (double2)(0x1.7ee1800000000p-4, 0x1.3017887460934p-27), (double2)(0x1.8ebc500000000p-4, 0x1.11e3eca0b9944p-26), (double2)(0x1.9e94100000000p-4, 0x1.4f3f73c5a332ep-26), (double2)(0x1.ae68a00000000p-4, 0x1.c71c8ae0e00a6p-26), (double2)(0x1.be39e00000000p-4, 0x1.7cde0f86fbdc7p-25), (double2)(0x1.ce07c00000000p-4, 0x1.70f328c889c72p-26), (double2)(0x1.ddd2100000000p-4, 0x1.c07ae9b994efep-26), (double2)(0x1.ed98c00000000p-4, 0x1.0c8021d7b1698p-27), (double2)(0x1.fd5ba00000000p-4, 0x1.35585edb8cb22p-25), (double2)(0x1.068d500000000p-3, 0x1.0842567b30e96p-24), (double2)(0x1.0e6ad00000000p-3, 0x1.99e811031472ep-24), (double2)(0x1.1646500000000p-3, 0x1.041821416bceep-25), (double2)(0x1.1e1fa00000000p-3, 0x1.f6086e4dc96f4p-24), (double2)(0x1.25f6e00000000p-3, 0x1.71a535c5f1b58p-27), (double2)(0x1.2dcbd00000000p-3, 0x1.65f743fe63ca1p-24), (double2)(0x1.359e800000000p-3, 0x1.dbd733472d014p-24), (double2)(0x1.3d6ee00000000p-3, 0x1.d18cc4d8b0d1dp-24), (double2)(0x1.453ce00000000p-3, 0x1.8c12553c8fb29p-24), (double2)(0x1.4d08700000000p-3, 0x1.53b49e2e8f991p-24), (double2)(0x1.54d1800000000p-3, 0x1.7422ae148c141p-24), (double2)(0x1.5c98100000000p-3, 0x1.e3ec269df56a8p-27), (double2)(0x1.645bf00000000p-3, 0x1.ff6754e7e0ac9p-24), (double2)(0x1.6c1d400000000p-3, 0x1.131267b1b5aadp-24), (double2)(0x1.73dbd00000000p-3, 0x1.d14fa403a94bcp-24), (double2)(0x1.7b97b00000000p-3, 0x1.2f396c089a3d8p-25), (double2)(0x1.8350b00000000p-3, 0x1.c731d78fa95bbp-24), (double2)(0x1.8b06e00000000p-3, 0x1.c50f385177399p-24), (double2)(0x1.92ba300000000p-3, 0x1.f41409c6f2c20p-25), (double2)(0x1.9a6a800000000p-3, 0x1.d2d90c4c39ec0p-24), (double2)(0x1.a217e00000000p-3, 0x1.80420696f2106p-25), (double2)(0x1.a9c2300000000p-3, 0x1.b40327943a2e8p-27), (double2)(0x1.b169600000000p-3, 0x1.5d35e02f3d2a2p-25), (double2)(0x1.b90d700000000p-3, 0x1.4a498288117b0p-25), (double2)(0x1.c0ae500000000p-3, 0x1.35da119afb324p-25), (double2)(0x1.c84bf00000000p-3, 0x1.14e85cdb9a908p-24), (double2)(0x1.cfe6500000000p-3, 0x1.38754e5547b9ap-25), (double2)(0x1.d77d500000000p-3, 0x1.be40ae6ce3246p-24), (double2)(0x1.df11000000000p-3, 0x1.0c993b3bea7e7p-24), (double2)(0x1.e6a1400000000p-3, 0x1.1d2dd89ac3359p-24), (double2)(0x1.ee2e100000000p-3, 0x1.1476603332c46p-25), (double2)(0x1.f5b7500000000p-3, 0x1.f25901bac55b7p-24), (double2)(0x1.fd3d100000000p-3, 0x1.f881b7c826e28p-24), (double2)(0x1.025fa00000000p-2, 0x1.441996d698d20p-24), (double2)(0x1.061ee00000000p-2, 0x1.407ac521ea089p-23), (double2)(0x1.09dc500000000p-2, 0x1.2fb0c6c4b1723p-23), (double2)(0x1.0d97e00000000p-2, 0x1.ca135966a3e18p-23), (double2)(0x1.1151a00000000p-2, 0x1.b1218e4d646e4p-25), (double2)(0x1.1509700000000p-2, 0x1.d4e72a350d288p-25), (double2)(0x1.18bf500000000p-2, 0x1.4617e2f04c329p-23), (double2)(0x1.1c73500000000p-2, 0x1.096ec41e82650p-25), (double2)(0x1.2025500000000p-2, 0x1.9f91f25773e6ep-24), (double2)(0x1.23d5600000000p-2, 0x1.59c0820f1d674p-25), (double2)(0x1.2783700000000p-2, 0x1.02bf7a2df1064p-25), (double2)(0x1.2b2f700000000p-2, 0x1.fb36bfc40508fp-23), (double2)(0x1.2ed9800000000p-2, 0x1.ea08f3f8dc892p-24), (double2)(0x1.3281800000000p-2, 0x1.3ed6254656a0ep-24), (double2)(0x1.3627700000000p-2, 0x1.b83f5e5e69c58p-25), (double2)(0x1.39cb400000000p-2, 0x1.d6ec2af768592p-23), (double2)(0x1.3d6d100000000p-2, 0x1.493889a226f94p-25), (double2)(0x1.410cb00000000p-2, 0x1.5ad8fa65279bap-23), (double2)(0x1.44aa400000000p-2, 0x1.b615784d45434p-25), (double2)(0x1.4845a00000000p-2, 0x1.09a184368f145p-23), (double2)(0x1.4bdee00000000p-2, 0x1.61a2439b0d91cp-24), (double2)(0x1.4f75f00000000p-2, 0x1.ce1a65e39a978p-24), (double2)(0x1.530ad00000000p-2, 0x1.32a39a93b6a66p-23), (double2)(0x1.569d800000000p-2, 0x1.1c3699af804e7p-23), (double2)(0x1.5a2e000000000p-2, 0x1.75e0f4e44ede8p-26), (double2)(0x1.5dbc300000000p-2, 0x1.f77ced1a7a83bp-23), (double2)(0x1.6148400000000p-2, 0x1.84e7f0cb1b500p-29), (double2)(0x1.64d1f00000000p-2, 0x1.ec6b838b02dfep-23), (double2)(0x1.6859700000000p-2, 0x1.3ebf4dfbeda87p-23), (double2)(0x1.6bdea00000000p-2, 0x1.9397aed9cb475p-23), (double2)(0x1.6f61900000000p-2, 0x1.07937bc239c54p-24), (double2)(0x1.72e2200000000p-2, 0x1.aa754553131b6p-23), (double2)(0x1.7660700000000p-2, 0x1.4a05d407c45dcp-24), (double2)(0x1.79dc600000000p-2, 0x1.132231a206dd0p-23), (double2)(0x1.7d56000000000p-2, 0x1.2d8ecfdd69c88p-24), (double2)(0x1.80cd400000000p-2, 0x1.a852c74218606p-24), (double2)(0x1.8442200000000p-2, 0x1.71bf2baeebb50p-23), (double2)(0x1.87b4b00000000p-2, 0x1.83d7db7491820p-27), (double2)(0x1.8b24d00000000p-2, 0x1.ca50d92b6da14p-25), (double2)(0x1.8e92900000000p-2, 0x1.6f5cde8530298p-26), (double2)(0x1.91fde00000000p-2, 0x1.f343198910740p-24), (double2)(0x1.9566d00000000p-2, 0x1.0e8d241ccd80ap-24), (double2)(0x1.98cd500000000p-2, 0x1.1535ac619e6c8p-24), (double2)(0x1.9c31600000000p-2, 0x1.7316041c36cd2p-24), (double2)(0x1.9f93000000000p-2, 0x1.985a000637d8ep-24), (double2)(0x1.a2f2300000000p-2, 0x1.f2f29858c0a68p-25), (double2)(0x1.a64ee00000000p-2, 0x1.879847f96d909p-23), (double2)(0x1.a9a9200000000p-2, 0x1.ab3d319e12e42p-23), (double2)(0x1.ad00f00000000p-2, 0x1.5088162dfc4c2p-24), (double2)(0x1.b056400000000p-2, 0x1.05749a1cd9d8cp-25), (double2)(0x1.b3a9100000000p-2, 0x1.da65c6c6b8618p-26), (double2)(0x1.b6f9600000000p-2, 0x1.739bf7df1ad64p-25), (double2)(0x1.ba47300000000p-2, 0x1.bc31252aa3340p-25), (double2)(0x1.bd92800000000p-2, 0x1.e528191ad3aa8p-26), (double2)(0x1.c0db400000000p-2, 0x1.929d93df19f18p-23), (double2)(0x1.c421900000000p-2, 0x1.ff11eb693a080p-26), (double2)(0x1.c765500000000p-2, 0x1.55ae3f145a3a0p-27), (double2)(0x1.caa6800000000p-2, 0x1.cbcd8c6c0ca82p-24), (double2)(0x1.cde5300000000p-2, 0x1.0cb04d425d304p-24), (double2)(0x1.d121500000000p-2, 0x1.9adfcab5be678p-24), (double2)(0x1.d45ae00000000p-2, 0x1.93d90c5662508p-23), (double2)(0x1.d791f00000000p-2, 0x1.68489bd35ff40p-24), (double2)(0x1.dac6700000000p-2, 0x1.586ed3da2b7e0p-28), (double2)(0x1.ddf8500000000p-2, 0x1.7604d2e850eeep-23), (double2)(0x1.e127b00000000p-2, 0x1.ac1d12bfb53d8p-24), (double2)(0x1.e454800000000p-2, 0x1.9b3d468274740p-28), (double2)(0x1.e77eb00000000p-2, 0x1.fc5d68d10e53cp-24), (double2)(0x1.eaa6500000000p-2, 0x1.8f9e51884becbp-23), (double2)(0x1.edcb600000000p-2, 0x1.a87f0869c06d1p-23), (double2)(0x1.f0ede00000000p-2, 0x1.31e7279f685fap-23), (double2)(0x1.f40dd00000000p-2, 0x1.6a8282f9719b0p-27), (double2)(0x1.f72b200000000p-2, 0x1.0d2724a8a44e0p-25), (double2)(0x1.fa45d00000000p-2, 0x1.a60524b11ad4ep-23), (double2)(0x1.fd5e000000000p-2, 0x1.75fdf832750f0p-26), (double2)(0x1.0039c00000000p-1, 0x1.cf06902e4cd36p-23), (double2)(0x1.01c3400000000p-1, 0x1.e82422d4f6d10p-25), (double2)(0x1.034b700000000p-1, 0x1.24a091063e6c0p-26), (double2)(0x1.04d2500000000p-1, 0x1.8a1a172dc6f38p-24), (double2)(0x1.0657e00000000p-1, 0x1.29b6619f8a92dp-22), (double2)(0x1.07dc300000000p-1, 0x1.9274d9c1b70c8p-24), (double2)(0x1.095f300000000p-1, 0x1.0c34b1fbb7930p-26), (double2)(0x1.0ae0e00000000p-1, 0x1.639866c20eb50p-25), (double2)(0x1.0c61400000000p-1, 0x1.6d6d0f6832e9ep-23), (double2)(0x1.0de0500000000p-1, 0x1.af54def99f25ep-22), (double2)(0x1.0f5e200000000p-1, 0x1.16cfc52a00262p-22), (double2)(0x1.10daa00000000p-1, 0x1.dcc1e83569c32p-23), (double2)(0x1.1255d00000000p-1, 0x1.37f7a551ed425p-22), (double2)(0x1.13cfb00000000p-1, 0x1.f6360adc98887p-22), (double2)(0x1.1548500000000p-1, 0x1.2c6ec8d35a2c1p-22), (double2)(0x1.16bfa00000000p-1, 0x1.bd44df84cb036p-23), (double2)(0x1.1835a00000000p-1, 0x1.117cf826e310ep-22), (double2)(0x1.19aa500000000p-1, 0x1.ca533f332cfc9p-22), (double2)(0x1.1b1dc00000000p-1, 0x1.0f208509dbc2ep-22), (double2)(0x1.1c8fe00000000p-1, 0x1.cd07d93c945dep-23), (double2)(0x1.1e00b00000000p-1, 0x1.57bdfd67e6d72p-22), (double2)(0x1.1f70400000000p-1, 0x1.aab89c516c658p-24), (double2)(0x1.20de800000000p-1, 0x1.3e823b1a1b8a0p-25), (double2)(0x1.224b700000000p-1, 0x1.307464a9d6d3cp-23), (double2)(0x1.23b7100000000p-1, 0x1.c5993cd438843p-22), (double2)(0x1.2521700000000p-1, 0x1.ba2fca02ab554p-22), (double2)(0x1.268a900000000p-1, 0x1.01a5b6983a268p-23), (double2)(0x1.27f2600000000p-1, 0x1.273d1b350efc8p-25), (double2)(0x1.2958e00000000p-1, 0x1.64c238c37b0c6p-23), (double2)(0x1.2abe200000000p-1, 0x1.aded07370a300p-25), (double2)(0x1.2c22100000000p-1, 0x1.78091197eb47ep-23), (double2)(0x1.2d84c00000000p-1, 0x1.4b0f245e0dabcp-24), (double2)(0x1.2ee6200000000p-1, 0x1.080d9794e2eafp-22), (double2)(0x1.3046400000000p-1, 0x1.d4ec242b60c76p-23), (double2)(0x1.31a5200000000p-1, 0x1.221d2f940caa0p-27), (double2)(0x1.3302b00000000p-1, 0x1.cdbc42b2bba5cp-24), (double2)(0x1.345f000000000p-1, 0x1.cce37bb440840p-25), (double2)(0x1.35ba000000000p-1, 0x1.6c1d999cf1dd0p-22), (double2)(0x1.3713d00000000p-1, 0x1.bed8a07eb0870p-26), (double2)(0x1.386c500000000p-1, 0x1.69ed88f490e3cp-24), (double2)(0x1.39c3900000000p-1, 0x1.cd41719b73ef0p-25), (double2)(0x1.3b19800000000p-1, 0x1.cbc4ac95b41b7p-22), (double2)(0x1.3c6e400000000p-1, 0x1.238f1b890f5d7p-22), (double2)(0x1.3dc1c00000000p-1, 0x1.50c4282259cc4p-24), (double2)(0x1.3f13f00000000p-1, 0x1.713d2de87b3e2p-22), (double2)(0x1.4064f00000000p-1, 0x1.1d5a7d2255276p-23), (double2)(0x1.41b4a00000000p-1, 0x1.c0dfd48227ac1p-22), (double2)(0x1.4303200000000p-1, 0x1.1c964dab76753p-22), (double2)(0x1.4450600000000p-1, 0x1.6de56d5704496p-23), (double2)(0x1.459c600000000p-1, 0x1.4aeb71fd19968p-23), (double2)(0x1.46e7200000000p-1, 0x1.fbf91c57b1918p-23), (double2)(0x1.4830a00000000p-1, 0x1.d6bef7fbe5d9ap-22), (double2)(0x1.4978f00000000p-1, 0x1.464d3dc249066p-22), (double2)(0x1.4ac0000000000p-1, 0x1.638e2ec4d9073p-22), (double2)(0x1.4c05e00000000p-1, 0x1.16f4a7247ea7cp-24), (double2)(0x1.4d4a800000000p-1, 0x1.1a0a740f1d440p-28), (double2)(0x1.4e8de00000000p-1, 0x1.6edbb0114a33cp-23), (double2)(0x1.4fd0100000000p-1, 0x1.dbee8bf1d513cp-24), (double2)(0x1.5111000000000p-1, 0x1.5b8bdb0248f73p-22), (double2)(0x1.5250c00000000p-1, 0x1.7de3d3f5eac64p-22), (double2)(0x1.538f500000000p-1, 0x1.ee24187ae448ap-23), (double2)(0x1.54cca00000000p-1, 0x1.e06c591ec5192p-22), (double2)(0x1.5608d00000000p-1, 0x1.4e3861a332738p-24), (double2)(0x1.5743c00000000p-1, 0x1.a9599dcc2bfe4p-24), (double2)(0x1.587d800000000p-1, 0x1.f732fbad43468p-25), (double2)(0x1.59b6000000000p-1, 0x1.eb9f573b727d9p-22), (double2)(0x1.5aed600000000p-1, 0x1.8b212a2eb9897p-22), (double2)(0x1.5c23900000000p-1, 0x1.384884c167215p-22), (double2)(0x1.5d58900000000p-1, 0x1.0e2d363020051p-22), (double2)(0x1.5e8c600000000p-1, 0x1.2820879fbd022p-22), (double2)(0x1.5fbf000000000p-1, 0x1.a1ab9893e4b30p-22), (double2)(0x1.60f0800000000p-1, 0x1.2d1b817a24478p-23), (double2)(0x1.6220d00000000p-1, 0x1.15d7b8ded4878p-25), (double2)(0x1.634ff00000000p-1, 0x1.8968f9db3a5e4p-24), (double2)(0x1.647de00000000p-1, 0x1.71c4171fe135fp-22), (double2)(0x1.65aab00000000p-1, 0x1.6d80f605d0d8cp-22), (double2)(0x1.66d6600000000p-1, 0x1.c91f043691590p-24), (double2)(0x1.6800e00000000p-1, 0x1.39f8a15fce2b2p-23), (double2)(0x1.692a400000000p-1, 0x1.55beda9d94b80p-27), (double2)(0x1.6a52700000000p-1, 0x1.b12c15d60949ap-23), (double2)(0x1.6b79800000000p-1, 0x1.24167b312bfe3p-22), (double2)(0x1.6c9f700000000p-1, 0x1.0ab8633070277p-22), (double2)(0x1.6dc4400000000p-1, 0x1.54554ebbc80eep-23), (double2)(0x1.6ee7f00000000p-1, 0x1.0204aef5a4bb8p-25), (double2)(0x1.700a700000000p-1, 0x1.8af08c679cf2cp-22), (double2)(0x1.712be00000000p-1, 0x1.0852a330ae6c8p-22), (double2)(0x1.724c300000000p-1, 0x1.6d3eb9ec32916p-23), (double2)(0x1.736b600000000p-1, 0x1.685cb7fcbbafep-23), (double2)(0x1.7489700000000p-1, 0x1.1f751c1e0bd95p-22), (double2)(0x1.75a6700000000p-1, 0x1.705b1b0f72560p-26), (double2)(0x1.76c2400000000p-1, 0x1.b98d8d808ca92p-22), (double2)(0x1.77dd100000000p-1, 0x1.2ea22c75cc980p-25), (double2)(0x1.78f6b00000000p-1, 0x1.7aba62bca0350p-22), (double2)(0x1.7a0f400000000p-1, 0x1.d73833442278cp-22), (double2)(0x1.7b26c00000000p-1, 0x1.5a5ca1fb18bf9p-22), (double2)(0x1.7c3d300000000p-1, 0x1.1a6092b6ecf28p-25), (double2)(0x1.7d52800000000p-1, 0x1.44fd049aac104p-24), (double2)(0x1.7e66c00000000p-1, 0x1.c114fd8df5180p-29), (double2)(0x1.7f79e00000000p-1, 0x1.5972f130feae5p-22), (double2)(0x1.808c000000000p-1, 0x1.ca034a55fe198p-24), (double2)(0x1.819d000000000p-1, 0x1.6e2b149990227p-22), (double2)(0x1.82ad000000000p-1, 0x1.b00000294592cp-24), (double2)(0x1.83bbe00000000p-1, 0x1.8b9bdc442620ep-22), (double2)(0x1.84c9c00000000p-1, 0x1.d94fdfabf3e4ep-23), (double2)(0x1.85d6900000000p-1, 0x1.5db30b145ad9ap-23), (double2)(0x1.86e2500000000p-1, 0x1.e3e1eb95022b0p-23), (double2)(0x1.87ed000000000p-1, 0x1.d5b8b45442bd6p-22), (double2)(0x1.88f6b00000000p-1, 0x1.7a046231ecd2ep-22), (double2)(0x1.89ff500000000p-1, 0x1.feafe3ef55232p-22), (double2)(0x1.8b06f00000000p-1, 0x1.839e7bfd78267p-22), (double2)(0x1.8c0d900000000p-1, 0x1.45cf49d6fa900p-25), (double2)(0x1.8d13200000000p-1, 0x1.be3132b27f380p-27), (double2)(0x1.8e17a00000000p-1, 0x1.533980bb84f9fp-22), (double2)(0x1.8f1b300000000p-1, 0x1.889e2ce3ba390p-26), (double2)(0x1.901db00000000p-1, 0x1.f7778c3ad0cc8p-24), (double2)(0x1.911f300000000p-1, 0x1.46660cec4eba2p-23), (double2)(0x1.921fb00000000p-1, 0x1.5110b4611a626p-23), }; DECLARE_TABLE(double2, TWO_TO_JBY64_EP, 64) = { (double2)(0x1.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.02c9a30000000p+0, 0x1.cef00c1dcdef9p-25), (double2)(0x1.059b0d0000000p+0, 0x1.8ac2ba1d73e2ap-27), (double2)(0x1.0874510000000p+0, 0x1.0eb37901186bep-25), (double2)(0x1.0b55860000000p+0, 0x1.9f3121ec53172p-25), (double2)(0x1.0e3ec30000000p+0, 0x1.69e8d10103a17p-27), (double2)(0x1.11301d0000000p+0, 0x1.25b50a4ebbf1ap-32), (double2)(0x1.1429aa0000000p+0, 0x1.d525bbf668203p-25), (double2)(0x1.172b830000000p+0, 0x1.8faa2f5b9bef9p-25), (double2)(0x1.1a35be0000000p+0, 0x1.6df96ea796d31p-25), (double2)(0x1.1d48730000000p+0, 0x1.68b9aa7805b80p-28), (double2)(0x1.2063b80000000p+0, 0x1.0c519ac771dd6p-25), (double2)(0x1.2387a60000000p+0, 0x1.ceac470cd83f5p-25), (double2)(0x1.26b4560000000p+0, 0x1.789f37495e99cp-26), (double2)(0x1.29e9df0000000p+0, 0x1.47f7b84b09745p-26), (double2)(0x1.2d285a0000000p+0, 0x1.b900c2d002475p-26), (double2)(0x1.306fe00000000p+0, 0x1.4636e2a5bd1abp-25), (double2)(0x1.33c08b0000000p+0, 0x1.320b7fa64e430p-27), (double2)(0x1.371a730000000p+0, 0x1.ceaa72a9c5154p-26), (double2)(0x1.3a7db30000000p+0, 0x1.3967fdba86f24p-26), (double2)(0x1.3dea640000000p+0, 0x1.82468446b6824p-25), (double2)(0x1.4160a20000000p+0, 0x1.f72e29f84325bp-28), (double2)(0x1.44e0860000000p+0, 0x1.8624b40c4dbd0p-30), (double2)(0x1.486a2b0000000p+0, 0x1.704f3404f068ep-26), (double2)(0x1.4bfdad0000000p+0, 0x1.4d8a89c750e5ep-26), (double2)(0x1.4f9b270000000p+0, 0x1.a74b29ab4cf62p-26), (double2)(0x1.5342b50000000p+0, 0x1.a753e077c2a0fp-26), (double2)(0x1.56f4730000000p+0, 0x1.ad49f699bb2c0p-26), (double2)(0x1.5ab07d0000000p+0, 0x1.a90a852b19260p-25), (double2)(0x1.5e76f10000000p+0, 0x1.6b48521ba6f93p-26), (double2)(0x1.6247eb0000000p+0, 0x1.d2ac258f87d03p-31), (double2)(0x1.6623880000000p+0, 0x1.2a91124893ecfp-27), (double2)(0x1.6a09e60000000p+0, 0x1.9fcef32422cbep-26), (double2)(0x1.6dfb230000000p+0, 0x1.8ca345de441c5p-25), (double2)(0x1.71f75e0000000p+0, 0x1.1d8bee7ba46e1p-25), (double2)(0x1.75feb50000000p+0, 0x1.9099f22fdba6ap-26), (double2)(0x1.7a11470000000p+0, 0x1.f580c36bea881p-27), (double2)(0x1.7e2f330000000p+0, 0x1.b3d398841740ap-26), (double2)(0x1.8258990000000p+0, 0x1.2999c25159f11p-25), (double2)(0x1.868d990000000p+0, 0x1.68925d901c83bp-25), (double2)(0x1.8ace540000000p+0, 0x1.15506dadd3e2ap-27), (double2)(0x1.8f1ae90000000p+0, 0x1.22aee6c57304ep-25), (double2)(0x1.93737b0000000p+0, 0x1.9b8bc9e8a0387p-29), (double2)(0x1.97d8290000000p+0, 0x1.fbc9c9f173d24p-25), (double2)(0x1.9c49180000000p+0, 0x1.51f8480e3e235p-27), (double2)(0x1.a0c6670000000p+0, 0x1.6bbcac96535b5p-25), (double2)(0x1.a5503b0000000p+0, 0x1.1f12ae45a1224p-27), (double2)(0x1.a9e6b50000000p+0, 0x1.5e7f6fd0fac90p-26), (double2)(0x1.ae89f90000000p+0, 0x1.2b5a75abd0e69p-25), (double2)(0x1.b33a2b0000000p+0, 0x1.09e2bf5ed7fa1p-25), (double2)(0x1.b7f76f0000000p+0, 0x1.7daf237553d84p-27), (double2)(0x1.bcc1e90000000p+0, 0x1.2f074891ee83dp-30), (double2)(0x1.c199bd0000000p+0, 0x1.b0aa538444196p-25), (double2)(0x1.c67f120000000p+0, 0x1.cafa29694426fp-25), (double2)(0x1.cb720d0000000p+0, 0x1.9df20d22a0797p-25), (double2)(0x1.d072d40000000p+0, 0x1.40f12f71a1e45p-25), (double2)(0x1.d5818d0000000p+0, 0x1.9f7490e4bb40bp-25), (double2)(0x1.da9e600000000p+0, 0x1.ed9942b84600dp-27), (double2)(0x1.dfc9730000000p+0, 0x1.bdcdaf5cb4656p-27), (double2)(0x1.e502ee0000000p+0, 0x1.e2cffd89cf44cp-26), (double2)(0x1.ea4afa0000000p+0, 0x1.52486cc2c7b9dp-27), (double2)(0x1.efa1be0000000p+0, 0x1.cc2b44eee3fa4p-25), (double2)(0x1.f507650000000p+0, 0x1.6dc8a80ce9f09p-25), (double2)(0x1.fa7c180000000p+0, 0x1.9e90d82e90a7ep-28) }; DECLARE_TABLE(double2, SINH_TBL, 37) = { (double2)(0x0.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.2cd9fc0000000p+0, 0x1.13ae6096a0092p-26), (double2)(0x1.d03cf60000000p+1, 0x1.db70cfb79a640p-26), (double2)(0x1.40926e0000000p+3, 0x1.c2526b66dc067p-23), (double2)(0x1.b4a3800000000p+4, 0x1.b81b18647f380p-23), (double2)(0x1.28d0160000000p+6, 0x1.bc1cdd1e1eb08p-20), (double2)(0x1.936d228000000p+7, 0x1.d9f201534fb09p-19), (double2)(0x1.1228768000000p+9, 0x1.d1c064a4e9954p-18), (double2)(0x1.749ea50000000p+10, 0x1.4eca65d06ea74p-18), (double2)(0x1.fa71570000000p+11, 0x1.0c259bcc0ecc5p-15), (double2)(0x1.5829dc8000000p+13, 0x1.b5a6647cf9016p-13), (double2)(0x1.d3c4488000000p+14, 0x1.9691adefb0870p-15), (double2)(0x1.3de1650000000p+16, 0x1.3410fc29cde38p-10), (double2)(0x1.b00b590000000p+17, 0x1.6a31a50b6fb3cp-11), (double2)(0x1.259ac48000000p+19, 0x1.7defc71805c40p-10), (double2)(0x1.8f0cca8000000p+20, 0x1.eb49fd80e0babp-6), (double2)(0x1.0f2ebd0000000p+22, 0x1.4fffc7bcd5920p-7), (double2)(0x1.7093488000000p+23, 0x1.03a93b6c63435p-3), (double2)(0x1.f4f2208000000p+24, 0x1.1940bb255fd1cp-4), (double2)(0x1.546d8f8000000p+26, 0x1.ed26e14260b50p-2), (double2)(0x1.ceb0888000000p+27, 0x1.b47401fc9f2a2p+0), (double2)(0x1.3a6e1f8000000p+29, 0x1.67bb3f55634f1p+3), (double2)(0x1.ab5adb8000000p+30, 0x1.c435ff8194ddcp+2), (double2)(0x1.226af30000000p+32, 0x1.d8fee052ba63ap+5), (double2)(0x1.8ab7fb0000000p+33, 0x1.51d7edccde3f6p+7), (double2)(0x1.0c3d390000000p+35, 0x1.04b1644557d1ap+8), (double2)(0x1.6c93268000000p+36, 0x1.6a6b5ca0a9dc4p+8), (double2)(0x1.ef822f0000000p+37, 0x1.fd9cc72249abap+11), (double2)(0x1.50bba30000000p+39, 0x1.e58de693edab5p+13), (double2)(0x1.c9aae40000000p+40, 0x1.8c70158ac6363p+14), (double2)(0x1.3704708000000p+42, 0x1.7614764f43e20p+15), (double2)(0x1.a6b7658000000p+43, 0x1.6337db36fc718p+17), (double2)(0x1.1f43fc8000000p+45, 0x1.12d98b1f611e2p+19), (double2)(0x1.866f348000000p+46, 0x1.392bc108b37ccp+19), (double2)(0x1.0953e28000000p+48, 0x1.ce87bdc3473dcp+22), (double2)(0x1.689e220000000p+49, 0x1.bc8d5ae99ad14p+21), (double2)(0x1.ea215a0000000p+50, 0x1.d20d76744835cp+22), }; DECLARE_TABLE(double2, COSH_TBL, 37) = { (double2)(0x1.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.8b07550000000p+0, 0x1.d9f5504c2bd28p-28), (double2)(0x1.e18fa08000000p+1, 0x1.7cb66f0a4c9fdp-25), (double2)(0x1.422a490000000p+3, 0x1.f58617928e588p-23), (double2)(0x1.b4ee858000000p+4, 0x1.bc7d000c38d48p-25), (double2)(0x1.28d6fc8000000p+6, 0x1.f7f9d4e329998p-21), (double2)(0x1.936e678000000p+7, 0x1.6e6e464885269p-19), (double2)(0x1.1228948000000p+9, 0x1.ba3a8b946c154p-19), (double2)(0x1.749eaa8000000p+10, 0x1.3f4e76110d5a4p-18), (double2)(0x1.fa71580000000p+11, 0x1.17622515a3e2bp-15), (double2)(0x1.5829dd0000000p+13, 0x1.4dc4b528af3d0p-17), (double2)(0x1.d3c4488000000p+14, 0x1.1156278615e10p-14), (double2)(0x1.3de1650000000p+16, 0x1.35ad50ed821f5p-10), (double2)(0x1.b00b590000000p+17, 0x1.6b61055f2935cp-11), (double2)(0x1.259ac48000000p+19, 0x1.7e2794a601240p-10), (double2)(0x1.8f0cca8000000p+20, 0x1.eb4b45f6aadd3p-6), (double2)(0x1.0f2ebd0000000p+22, 0x1.5000b967b3698p-7), (double2)(0x1.7093488000000p+23, 0x1.03a940fadc092p-3), (double2)(0x1.f4f2208000000p+24, 0x1.1940bf3bf874cp-4), (double2)(0x1.546d8f8000000p+26, 0x1.ed26e1a2a2110p-2), (double2)(0x1.ceb0888000000p+27, 0x1.b4740205796d6p+0), (double2)(0x1.3a6e1f8000000p+29, 0x1.67bb3f55cb85dp+3), (double2)(0x1.ab5adb8000000p+30, 0x1.c435ff81e18acp+2), (double2)(0x1.226af30000000p+32, 0x1.d8fee052bdea4p+5), (double2)(0x1.8ab7fb0000000p+33, 0x1.51d7edccde926p+7), (double2)(0x1.0c3d390000000p+35, 0x1.04b1644557e0ep+8), (double2)(0x1.6c93268000000p+36, 0x1.6a6b5ca0a9e1cp+8), (double2)(0x1.ef822f0000000p+37, 0x1.fd9cc72249abep+11), (double2)(0x1.50bba30000000p+39, 0x1.e58de693edab5p+13), (double2)(0x1.c9aae40000000p+40, 0x1.8c70158ac6364p+14), (double2)(0x1.3704708000000p+42, 0x1.7614764f43e20p+15), (double2)(0x1.a6b7658000000p+43, 0x1.6337db36fc718p+17), (double2)(0x1.1f43fc8000000p+45, 0x1.12d98b1f611e2p+19), (double2)(0x1.866f348000000p+46, 0x1.392bc108b37ccp+19), (double2)(0x1.0953e28000000p+48, 0x1.ce87bdc3473dcp+22), (double2)(0x1.689e220000000p+49, 0x1.bc8d5ae99ad14p+21), (double2)(0x1.ea215a0000000p+50, 0x1.d20d76744835cp+22) }; DECLARE_TABLE(double, CBRT_INV_TBL, 257) = { 0x1.0000000000000p+1, 0x1.fe01fe01fe020p+0, 0x1.fc07f01fc07f0p+0, 0x1.fa11caa01fa12p+0, 0x1.f81f81f81f820p+0, 0x1.f6310aca0dbb5p+0, 0x1.f44659e4a4271p+0, 0x1.f25f644230ab5p+0, 0x1.f07c1f07c1f08p+0, 0x1.ee9c7f8458e02p+0, 0x1.ecc07b301ecc0p+0, 0x1.eae807aba01ebp+0, 0x1.e9131abf0b767p+0, 0x1.e741aa59750e4p+0, 0x1.e573ac901e574p+0, 0x1.e3a9179dc1a73p+0, 0x1.e1e1e1e1e1e1ep+0, 0x1.e01e01e01e01ep+0, 0x1.de5d6e3f8868ap+0, 0x1.dca01dca01dcap+0, 0x1.dae6076b981dbp+0, 0x1.d92f2231e7f8ap+0, 0x1.d77b654b82c34p+0, 0x1.d5cac807572b2p+0, 0x1.d41d41d41d41dp+0, 0x1.d272ca3fc5b1ap+0, 0x1.d0cb58f6ec074p+0, 0x1.cf26e5c44bfc6p+0, 0x1.cd85689039b0bp+0, 0x1.cbe6d9601cbe7p+0, 0x1.ca4b3055ee191p+0, 0x1.c8b265afb8a42p+0, 0x1.c71c71c71c71cp+0, 0x1.c5894d10d4986p+0, 0x1.c3f8f01c3f8f0p+0, 0x1.c26b5392ea01cp+0, 0x1.c0e070381c0e0p+0, 0x1.bf583ee868d8bp+0, 0x1.bdd2b899406f7p+0, 0x1.bc4fd65883e7bp+0, 0x1.bacf914c1bad0p+0, 0x1.b951e2b18ff23p+0, 0x1.b7d6c3dda338bp+0, 0x1.b65e2e3beee05p+0, 0x1.b4e81b4e81b4fp+0, 0x1.b37484ad806cep+0, 0x1.b2036406c80d9p+0, 0x1.b094b31d922a4p+0, 0x1.af286bca1af28p+0, 0x1.adbe87f94905ep+0, 0x1.ac5701ac5701bp+0, 0x1.aaf1d2f87ebfdp+0, 0x1.a98ef606a63bep+0, 0x1.a82e65130e159p+0, 0x1.a6d01a6d01a6dp+0, 0x1.a574107688a4ap+0, 0x1.a41a41a41a41ap+0, 0x1.a2c2a87c51ca0p+0, 0x1.a16d3f97a4b02p+0, 0x1.a01a01a01a01ap+0, 0x1.9ec8e951033d9p+0, 0x1.9d79f176b682dp+0, 0x1.9c2d14ee4a102p+0, 0x1.9ae24ea5510dap+0, 0x1.999999999999ap+0, 0x1.9852f0d8ec0ffp+0, 0x1.970e4f80cb872p+0, 0x1.95cbb0be377aep+0, 0x1.948b0fcd6e9e0p+0, 0x1.934c67f9b2ce6p+0, 0x1.920fb49d0e229p+0, 0x1.90d4f120190d5p+0, 0x1.8f9c18f9c18fap+0, 0x1.8e6527af1373fp+0, 0x1.8d3018d3018d3p+0, 0x1.8bfce8062ff3ap+0, 0x1.8acb90f6bf3aap+0, 0x1.899c0f601899cp+0, 0x1.886e5f0abb04ap+0, 0x1.87427bcc092b9p+0, 0x1.8618618618618p+0, 0x1.84f00c2780614p+0, 0x1.83c977ab2beddp+0, 0x1.82a4a0182a4a0p+0, 0x1.8181818181818p+0, 0x1.8060180601806p+0, 0x1.7f405fd017f40p+0, 0x1.7e225515a4f1dp+0, 0x1.7d05f417d05f4p+0, 0x1.7beb3922e017cp+0, 0x1.7ad2208e0ecc3p+0, 0x1.79baa6bb6398bp+0, 0x1.78a4c8178a4c8p+0, 0x1.77908119ac60dp+0, 0x1.767dce434a9b1p+0, 0x1.756cac201756dp+0, 0x1.745d1745d1746p+0, 0x1.734f0c541fe8dp+0, 0x1.724287f46debcp+0, 0x1.713786d9c7c09p+0, 0x1.702e05c0b8170p+0, 0x1.6f26016f26017p+0, 0x1.6e1f76b4337c7p+0, 0x1.6d1a62681c861p+0, 0x1.6c16c16c16c17p+0, 0x1.6b1490aa31a3dp+0, 0x1.6a13cd1537290p+0, 0x1.691473a88d0c0p+0, 0x1.6816816816817p+0, 0x1.6719f3601671ap+0, 0x1.661ec6a5122f9p+0, 0x1.6524f853b4aa3p+0, 0x1.642c8590b2164p+0, 0x1.63356b88ac0dep+0, 0x1.623fa77016240p+0, 0x1.614b36831ae94p+0, 0x1.6058160581606p+0, 0x1.5f66434292dfcp+0, 0x1.5e75bb8d015e7p+0, 0x1.5d867c3ece2a5p+0, 0x1.5c9882b931057p+0, 0x1.5babcc647fa91p+0, 0x1.5ac056b015ac0p+0, 0x1.59d61f123ccaap+0, 0x1.58ed2308158edp+0, 0x1.5805601580560p+0, 0x1.571ed3c506b3ap+0, 0x1.56397ba7c52e2p+0, 0x1.5555555555555p+0, 0x1.54725e6bb82fep+0, 0x1.5390948f40febp+0, 0x1.52aff56a8054bp+0, 0x1.51d07eae2f815p+0, 0x1.50f22e111c4c5p+0, 0x1.5015015015015p+0, 0x1.4f38f62dd4c9bp+0, 0x1.4e5e0a72f0539p+0, 0x1.4d843bedc2c4cp+0, 0x1.4cab88725af6ep+0, 0x1.4bd3edda68fe1p+0, 0x1.4afd6a052bf5bp+0, 0x1.4a27fad76014ap+0, 0x1.49539e3b2d067p+0, 0x1.4880522014880p+0, 0x1.47ae147ae147bp+0, 0x1.46dce34596066p+0, 0x1.460cbc7f5cf9ap+0, 0x1.453d9e2c776cap+0, 0x1.446f86562d9fbp+0, 0x1.43a2730abee4dp+0, 0x1.42d6625d51f87p+0, 0x1.420b5265e5951p+0, 0x1.4141414141414p+0, 0x1.40782d10e6566p+0, 0x1.3fb013fb013fbp+0, 0x1.3ee8f42a5af07p+0, 0x1.3e22cbce4a902p+0, 0x1.3d5d991aa75c6p+0, 0x1.3c995a47babe7p+0, 0x1.3bd60d9232955p+0, 0x1.3b13b13b13b14p+0, 0x1.3a524387ac822p+0, 0x1.3991c2c187f63p+0, 0x1.38d22d366088ep+0, 0x1.3813813813814p+0, 0x1.3755bd1c945eep+0, 0x1.3698df3de0748p+0, 0x1.35dce5f9f2af8p+0, 0x1.3521cfb2b78c1p+0, 0x1.34679ace01346p+0, 0x1.33ae45b57bcb2p+0, 0x1.32f5ced6a1dfap+0, 0x1.323e34a2b10bfp+0, 0x1.3187758e9ebb6p+0, 0x1.30d190130d190p+0, 0x1.301c82ac40260p+0, 0x1.2f684bda12f68p+0, 0x1.2eb4ea1fed14bp+0, 0x1.2e025c04b8097p+0, 0x1.2d50a012d50a0p+0, 0x1.2c9fb4d812ca0p+0, 0x1.2bef98e5a3711p+0, 0x1.2b404ad012b40p+0, 0x1.2a91c92f3c105p+0, 0x1.29e4129e4129ep+0, 0x1.293725bb804a5p+0, 0x1.288b01288b013p+0, 0x1.27dfa38a1ce4dp+0, 0x1.27350b8812735p+0, 0x1.268b37cd60127p+0, 0x1.25e22708092f1p+0, 0x1.2539d7e9177b2p+0, 0x1.2492492492492p+0, 0x1.23eb79717605bp+0, 0x1.23456789abcdfp+0, 0x1.22a0122a0122ap+0, 0x1.21fb78121fb78p+0, 0x1.21579804855e6p+0, 0x1.20b470c67c0d9p+0, 0x1.2012012012012p+0, 0x1.1f7047dc11f70p+0, 0x1.1ecf43c7fb84cp+0, 0x1.1e2ef3b3fb874p+0, 0x1.1d8f5672e4abdp+0, 0x1.1cf06ada2811dp+0, 0x1.1c522fc1ce059p+0, 0x1.1bb4a4046ed29p+0, 0x1.1b17c67f2bae3p+0, 0x1.1a7b9611a7b96p+0, 0x1.19e0119e0119ep+0, 0x1.19453808ca29cp+0, 0x1.18ab083902bdbp+0, 0x1.1811811811812p+0, 0x1.1778a191bd684p+0, 0x1.16e0689427379p+0, 0x1.1648d50fc3201p+0, 0x1.15b1e5f75270dp+0, 0x1.151b9a3fdd5c9p+0, 0x1.1485f0e0acd3bp+0, 0x1.13f0e8d344724p+0, 0x1.135c81135c811p+0, 0x1.12c8b89edc0acp+0, 0x1.12358e75d3033p+0, 0x1.11a3019a74826p+0, 0x1.1111111111111p+0, 0x1.107fbbe011080p+0, 0x1.0fef010fef011p+0, 0x1.0f5edfab325a2p+0, 0x1.0ecf56be69c90p+0, 0x1.0e40655826011p+0, 0x1.0db20a88f4696p+0, 0x1.0d24456359e3ap+0, 0x1.0c9714fbcda3bp+0, 0x1.0c0a7868b4171p+0, 0x1.0b7e6ec259dc8p+0, 0x1.0af2f722eecb5p+0, 0x1.0a6810a6810a7p+0, 0x1.09ddba6af8360p+0, 0x1.0953f39010954p+0, 0x1.08cabb37565e2p+0, 0x1.0842108421084p+0, 0x1.07b9f29b8eae2p+0, 0x1.073260a47f7c6p+0, 0x1.06ab59c7912fbp+0, 0x1.0624dd2f1a9fcp+0, 0x1.059eea0727586p+0, 0x1.05197f7d73404p+0, 0x1.04949cc1664c5p+0, 0x1.0410410410410p+0, 0x1.038c6b78247fcp+0, 0x1.03091b51f5e1ap+0, 0x1.02864fc7729e9p+0, 0x1.0204081020408p+0, 0x1.0182436517a37p+0, 0x1.0101010101010p+0, 0x1.0080402010080p+0, 0x1.0000000000000p+0 }; DECLARE_TABLE(double2, CBRT_DBL_TBL, 257) = { (double2)(0x1.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.0055380000000p+0, 0x1.e6a24c81e4294p-25), (double2)(0x1.00aa390000000p+0, 0x1.8548511e3a785p-26), (double2)(0x1.00ff010000000p+0, 0x1.4eb9336ec07f6p-25), (double2)(0x1.0153920000000p+0, 0x1.0ea64b8b750e1p-27), (double2)(0x1.01a7eb0000000p+0, 0x1.61637cff8a53cp-27), (double2)(0x1.01fc0d0000000p+0, 0x1.0733bf7bd1943p-27), (double2)(0x1.024ff80000000p+0, 0x1.666911345ccedp-26), (double2)(0x1.02a3ad0000000p+0, 0x1.77b7a3f592f14p-27), (double2)(0x1.02f72b0000000p+0, 0x1.f18d3dd1a5402p-25), (double2)(0x1.034a750000000p+0, 0x1.be2f5a58ee9a4p-29), (double2)(0x1.039d880000000p+0, 0x1.8901f8f085fa7p-25), (double2)(0x1.03f0670000000p+0, 0x1.c68b8cd5b5d69p-26), (double2)(0x1.0443110000000p+0, 0x1.a6b0e8624be42p-26), (double2)(0x1.0495870000000p+0, 0x1.c4b22b06f68e7p-36), (double2)(0x1.04e7c80000000p+0, 0x1.0f3f0afcabe9bp-25), (double2)(0x1.0539d60000000p+0, 0x1.48495bca4e1b7p-26), (double2)(0x1.058bb00000000p+0, 0x1.6107f1abdfdc3p-25), (double2)(0x1.05dd570000000p+0, 0x1.e67261878288ap-25), (double2)(0x1.062ecc0000000p+0, 0x1.a6bc155286f1ep-26), (double2)(0x1.06800e0000000p+0, 0x1.8a759c64a85f2p-26), (double2)(0x1.06d11e0000000p+0, 0x1.5fce70a4a8d09p-27), (double2)(0x1.0721fc0000000p+0, 0x1.2f9cbf373fe1dp-28), (double2)(0x1.0772a80000000p+0, 0x1.90564ce4ac359p-26), (double2)(0x1.07c3230000000p+0, 0x1.ac29ce761b02fp-26), (double2)(0x1.08136d0000000p+0, 0x1.cb752f497381cp-26), (double2)(0x1.0863860000000p+0, 0x1.8bb9e1cfb35e0p-25), (double2)(0x1.08b36f0000000p+0, 0x1.5b4917099de90p-25), (double2)(0x1.0903280000000p+0, 0x1.cc77ac9c65ef2p-26), (double2)(0x1.0952b10000000p+0, 0x1.7a0f3e7be3dbap-26), (double2)(0x1.09a20a0000000p+0, 0x1.6ec851ee0c16fp-25), (double2)(0x1.09f1340000000p+0, 0x1.89449bf2946dap-25), (double2)(0x1.0a402f0000000p+0, 0x1.98f25301ba223p-25), (double2)(0x1.0a8efc0000000p+0, 0x1.47d5ec651f549p-28), (double2)(0x1.0add990000000p+0, 0x1.c33ec9a86007ap-25), (double2)(0x1.0b2c090000000p+0, 0x1.e0b6653e92649p-26), (double2)(0x1.0b7a4b0000000p+0, 0x1.bd64ac09d755fp-28), (double2)(0x1.0bc85f0000000p+0, 0x1.f537506f78167p-29), (double2)(0x1.0c16450000000p+0, 0x1.2c382d1b3735ep-25), (double2)(0x1.0c63fe0000000p+0, 0x1.e20ed659f99e1p-25), (double2)(0x1.0cb18b0000000p+0, 0x1.86b633a9c182ap-26), (double2)(0x1.0cfeeb0000000p+0, 0x1.45cfd5a65e777p-27), (double2)(0x1.0d4c1e0000000p+0, 0x1.0c8770f58bca4p-25), (double2)(0x1.0d99250000000p+0, 0x1.739e44b0933c5p-25), (double2)(0x1.0de6010000000p+0, 0x1.27dc3d9ce7bd8p-31), (double2)(0x1.0e32b00000000p+0, 0x1.3c53c7c5a7b64p-25), (double2)(0x1.0e7f340000000p+0, 0x1.9669683830cecp-25), (double2)(0x1.0ecb8d0000000p+0, 0x1.8d772c39bdcc4p-25), (double2)(0x1.0f17bb0000000p+0, 0x1.9b0008bcf6d7bp-25), (double2)(0x1.0f63bf0000000p+0, 0x1.bbb305825ce4fp-28), (double2)(0x1.0faf970000000p+0, 0x1.da3f4af13a406p-25), (double2)(0x1.0ffb460000000p+0, 0x1.f36b96f74ce86p-26), (double2)(0x1.1046cb0000000p+0, 0x1.65c002303f790p-30), (double2)(0x1.1092250000000p+0, 0x1.82f84095ba7d5p-25), (double2)(0x1.10dd560000000p+0, 0x1.d46433541b2c6p-25), (double2)(0x1.11285e0000000p+0, 0x1.71c3d56e93a89p-25), (double2)(0x1.11733d0000000p+0, 0x1.98dcef4e40012p-26), (double2)(0x1.11bdf30000000p+0, 0x1.530ebef17fe03p-27), (double2)(0x1.1208800000000p+0, 0x1.e8b8fa3715066p-27), (double2)(0x1.1252e40000000p+0, 0x1.ab26eb3b211dcp-25), (double2)(0x1.129d210000000p+0, 0x1.54dd4dc906307p-27), (double2)(0x1.12e7350000000p+0, 0x1.c9f962387984ep-26), (double2)(0x1.1331210000000p+0, 0x1.c62a959afec09p-25), (double2)(0x1.137ae60000000p+0, 0x1.638d9ac6a866ap-25), (double2)(0x1.13c4840000000p+0, 0x1.38704eca8a22dp-28), (double2)(0x1.140dfa0000000p+0, 0x1.e6c9e1db14f8fp-27), (double2)(0x1.1457490000000p+0, 0x1.8744b7f9c9eaap-26), (double2)(0x1.14a0710000000p+0, 0x1.6c2893486373bp-25), (double2)(0x1.14e9730000000p+0, 0x1.b36bce31699b7p-26), (double2)(0x1.15324e0000000p+0, 0x1.71e3813d200c7p-25), (double2)(0x1.157b030000000p+0, 0x1.99755ab40aa88p-25), (double2)(0x1.15c3920000000p+0, 0x1.b45ca0e4bcfc0p-25), (double2)(0x1.160bfc0000000p+0, 0x1.2dd090d869c5dp-28), (double2)(0x1.16543f0000000p+0, 0x1.4fe0516b917dap-25), (double2)(0x1.169c5d0000000p+0, 0x1.94563226317a2p-25), (double2)(0x1.16e4560000000p+0, 0x1.53d8fafc2c851p-25), (double2)(0x1.172c2a0000000p+0, 0x1.dcbd41fbd41a3p-26), (double2)(0x1.1773d90000000p+0, 0x1.862ff5285f59cp-26), (double2)(0x1.17bb630000000p+0, 0x1.3072ea97a1e1cp-25), (double2)(0x1.1802c90000000p+0, 0x1.2839075184805p-26), (double2)(0x1.184a0a0000000p+0, 0x1.4b0323e9eff42p-25), (double2)(0x1.1891270000000p+0, 0x1.b158893c45484p-25), (double2)(0x1.18d8210000000p+0, 0x1.149ef0fc35826p-28), (double2)(0x1.191ef60000000p+0, 0x1.f2e77ea96acaap-26), (double2)(0x1.1965a80000000p+0, 0x1.200074c471a95p-26), (double2)(0x1.19ac360000000p+0, 0x1.3f8cc517f6f04p-25), (double2)(0x1.19f2a10000000p+0, 0x1.60ba2e311bb55p-25), (double2)(0x1.1a38e90000000p+0, 0x1.4b788730bbec3p-25), (double2)(0x1.1a7f0e0000000p+0, 0x1.57090795ee20cp-25), (double2)(0x1.1ac5100000000p+0, 0x1.d9ffe983670b1p-25), (double2)(0x1.1b0af00000000p+0, 0x1.2a463ff61bfdap-25), (double2)(0x1.1b50ad0000000p+0, 0x1.9d1bc6a5e65cfp-25), (double2)(0x1.1b96480000000p+0, 0x1.8718abaa9e922p-25), (double2)(0x1.1bdbc10000000p+0, 0x1.3c2f52ffa342ep-25), (double2)(0x1.1c21180000000p+0, 0x1.0fae13ff42c80p-25), (double2)(0x1.1c664d0000000p+0, 0x1.5440f0ef00d57p-25), (double2)(0x1.1cab610000000p+0, 0x1.6fcd22d4e3c1ep-27), (double2)(0x1.1cf0530000000p+0, 0x1.e0c60b409e863p-27), (double2)(0x1.1d35230000000p+0, 0x1.f9cab5a5f0333p-25), (double2)(0x1.1d79d30000000p+0, 0x1.30f24744c333dp-25), (double2)(0x1.1dbe620000000p+0, 0x1.b50622a76b2fep-27), (double2)(0x1.1e02cf0000000p+0, 0x1.fdb94ba595375p-25), (double2)(0x1.1e471d0000000p+0, 0x1.861b9b945a171p-28), (double2)(0x1.1e8b490000000p+0, 0x1.54348015188c4p-25), (double2)(0x1.1ecf550000000p+0, 0x1.b54d149865523p-25), (double2)(0x1.1f13410000000p+0, 0x1.a0bb783d9de33p-25), (double2)(0x1.1f570d0000000p+0, 0x1.629d12b1a2157p-25), (double2)(0x1.1f9ab90000000p+0, 0x1.467fe35d179dfp-25), (double2)(0x1.1fde450000000p+0, 0x1.9763f3e26c8f7p-25), (double2)(0x1.2021b20000000p+0, 0x1.3f798bb9f7679p-26), (double2)(0x1.2064ff0000000p+0, 0x1.52e577e855898p-26), (double2)(0x1.20a82c0000000p+0, 0x1.fde47e5502c3ap-25), (double2)(0x1.20eb3b0000000p+0, 0x1.cbd0b548d96a0p-26), (double2)(0x1.212e2a0000000p+0, 0x1.a9cd9f7be8de8p-25), (double2)(0x1.2170fb0000000p+0, 0x1.22bbe704886dep-26), (double2)(0x1.21b3ac0000000p+0, 0x1.e3dea8317f020p-25), (double2)(0x1.21f63f0000000p+0, 0x1.e812085ac8855p-25), (double2)(0x1.2238b40000000p+0, 0x1.c87144f24cb07p-26), (double2)(0x1.227b0a0000000p+0, 0x1.1e128ee311fa2p-25), (double2)(0x1.22bd420000000p+0, 0x1.b5c163d61a2d3p-26), (double2)(0x1.22ff5c0000000p+0, 0x1.7d97e7fb90633p-27), (double2)(0x1.2341570000000p+0, 0x1.efe899d50f6a7p-25), (double2)(0x1.2383350000000p+0, 0x1.d0333eb75de5ap-25), (double2)(0x1.23c4f60000000p+0, 0x1.0e590be73a573p-27), (double2)(0x1.2406980000000p+0, 0x1.8ce8dcac3cdd2p-25), (double2)(0x1.24481d0000000p+0, 0x1.ee8a48954064bp-25), (double2)(0x1.2489850000000p+0, 0x1.aa62f18461e09p-25), (double2)(0x1.24cad00000000p+0, 0x1.01e5940986a15p-25), (double2)(0x1.250bfe0000000p+0, 0x1.b082f4f9b8d4cp-28), (double2)(0x1.254d0e0000000p+0, 0x1.876e0e5527f5ap-25), (double2)(0x1.258e020000000p+0, 0x1.3617080831e6bp-25), (double2)(0x1.25ced90000000p+0, 0x1.81b26e34aa4a2p-25), (double2)(0x1.260f940000000p+0, 0x1.52ee66dfab0c1p-26), (double2)(0x1.2650320000000p+0, 0x1.d85a5329e8819p-26), (double2)(0x1.2690b40000000p+0, 0x1.105c1b646b5d1p-26), (double2)(0x1.26d1190000000p+0, 0x1.bb6690c1a379cp-25), (double2)(0x1.2711630000000p+0, 0x1.86aeba73ce3a9p-26), (double2)(0x1.2751900000000p+0, 0x1.dd16198294dd4p-25), (double2)(0x1.2791a20000000p+0, 0x1.454e675775e83p-25), (double2)(0x1.27d1980000000p+0, 0x1.3842e026197eap-25), (double2)(0x1.2811720000000p+0, 0x1.f1ce0e70c44d2p-25), (double2)(0x1.2851310000000p+0, 0x1.ad636441a5627p-25), (double2)(0x1.2890d50000000p+0, 0x1.4c205d7212abbp-26), (double2)(0x1.28d05d0000000p+0, 0x1.167c86c116419p-25), (double2)(0x1.290fca0000000p+0, 0x1.38ec3ef16e294p-25), (double2)(0x1.294f1c0000000p+0, 0x1.473fceace9321p-25), (double2)(0x1.298e530000000p+0, 0x1.7af53a836dba7p-25), (double2)(0x1.29cd700000000p+0, 0x1.a51f3c383b652p-30), (double2)(0x1.2a0c710000000p+0, 0x1.3696da190822dp-25), (double2)(0x1.2a4b580000000p+0, 0x1.2f9adec77074bp-25), (double2)(0x1.2a8a250000000p+0, 0x1.8190fd5bee55fp-28), (double2)(0x1.2ac8d70000000p+0, 0x1.bfee8fac68e55p-27), (double2)(0x1.2b076f0000000p+0, 0x1.31c9d6bc5f68ap-28), (double2)(0x1.2b45ec0000000p+0, 0x1.89d0523737edfp-25), (double2)(0x1.2b84500000000p+0, 0x1.a295943bf47bbp-26), (double2)(0x1.2bc29a0000000p+0, 0x1.96be32e5b3207p-28), (double2)(0x1.2c00c90000000p+0, 0x1.e44c7d909fa0ep-25), (double2)(0x1.2c3ee00000000p+0, 0x1.b2505da94d9eap-29), (double2)(0x1.2c7cdc0000000p+0, 0x1.0c851f46c9c98p-25), (double2)(0x1.2cbabf0000000p+0, 0x1.da71f7d9aa3b7p-26), (double2)(0x1.2cf8880000000p+0, 0x1.f1b605d019ef1p-25), (double2)(0x1.2d36390000000p+0, 0x1.386e8a2189563p-27), (double2)(0x1.2d73d00000000p+0, 0x1.b19fa5d306ba7p-28), (double2)(0x1.2db14d0000000p+0, 0x1.dd749b67aef76p-25), (double2)(0x1.2deeb20000000p+0, 0x1.76ff6f1dc04b0p-25), (double2)(0x1.2e2bfe0000000p+0, 0x1.35a33d0b232a6p-25), (double2)(0x1.2e69310000000p+0, 0x1.4bdc80024a4e1p-25), (double2)(0x1.2ea64b0000000p+0, 0x1.ebd61770fd723p-25), (double2)(0x1.2ee34d0000000p+0, 0x1.4769fc537264dp-25), (double2)(0x1.2f20360000000p+0, 0x1.9021f429f3b98p-25), (double2)(0x1.2f5d070000000p+0, 0x1.ee7083efbd606p-26), (double2)(0x1.2f99bf0000000p+0, 0x1.ad985552a6b1ap-25), (double2)(0x1.2fd65f0000000p+0, 0x1.e3df778772160p-25), (double2)(0x1.3012e70000000p+0, 0x1.ca5d76ddc9b34p-25), (double2)(0x1.304f570000000p+0, 0x1.91154ffdbaf74p-25), (double2)(0x1.308baf0000000p+0, 0x1.67bdd57fb306ap-25), (double2)(0x1.30c7ef0000000p+0, 0x1.7dc255ac40886p-25), (double2)(0x1.3104180000000p+0, 0x1.219f38e8afafep-32), (double2)(0x1.3140280000000p+0, 0x1.2416bf9669a04p-25), (double2)(0x1.317c210000000p+0, 0x1.11c96b2b3987fp-25), (double2)(0x1.31b8020000000p+0, 0x1.f99ed447e1177p-25), (double2)(0x1.31f3cd0000000p+0, 0x1.3245826328a11p-30), (double2)(0x1.322f7f0000000p+0, 0x1.6f56dd1e645f8p-25), (double2)(0x1.326b1b0000000p+0, 0x1.6164946945535p-27), (double2)(0x1.32a69f0000000p+0, 0x1.e37d59d190028p-26), (double2)(0x1.32e20c0000000p+0, 0x1.68671f12bf828p-25), (double2)(0x1.331d620000000p+0, 0x1.e8ecbca6aabbdp-25), (double2)(0x1.3358a20000000p+0, 0x1.3f49e109a5912p-26), (double2)(0x1.3393ca0000000p+0, 0x1.b8a0e11ec3043p-25), (double2)(0x1.33cedc0000000p+0, 0x1.5fae00aed691ap-25), (double2)(0x1.3409d70000000p+0, 0x1.c0569bece3e4ap-25), (double2)(0x1.3444bc0000000p+0, 0x1.05e26744efbfep-25), (double2)(0x1.347f8a0000000p+0, 0x1.5b570a94be5c5p-25), (double2)(0x1.34ba420000000p+0, 0x1.d6f156ea0e063p-26), (double2)(0x1.34f4e30000000p+0, 0x1.e0ca7612fc484p-25), (double2)(0x1.352f6f0000000p+0, 0x1.963c927b25258p-27), (double2)(0x1.3569e40000000p+0, 0x1.47930aa725a5cp-26), (double2)(0x1.35a4430000000p+0, 0x1.8a79fe3af43b3p-26), (double2)(0x1.35de8c0000000p+0, 0x1.e6dc29c41bdafp-26), (double2)(0x1.3618bf0000000p+0, 0x1.57a2e76f863a5p-25), (double2)(0x1.3652dd0000000p+0, 0x1.ae3b61716354dp-29), (double2)(0x1.368ce40000000p+0, 0x1.65fb5df6906b1p-25), (double2)(0x1.36c6d60000000p+0, 0x1.6177d7f588f7bp-25), (double2)(0x1.3700b30000000p+0, 0x1.ad55abd091b67p-28), (double2)(0x1.373a7a0000000p+0, 0x1.55337b2422d76p-30), (double2)(0x1.37742b0000000p+0, 0x1.084ebe86972d5p-25), (double2)(0x1.37adc70000000p+0, 0x1.56395808e1ea3p-25), (double2)(0x1.37e74e0000000p+0, 0x1.1bce21b40fba7p-25), (double2)(0x1.3820c00000000p+0, 0x1.006f94605b515p-26), (double2)(0x1.385a1c0000000p+0, 0x1.aa676aceb1f7dp-25), (double2)(0x1.3893640000000p+0, 0x1.8229f76554ce6p-26), (double2)(0x1.38cc960000000p+0, 0x1.eabfc6cf57330p-25), (double2)(0x1.3905b40000000p+0, 0x1.4daed9c0ce8bcp-25), (double2)(0x1.393ebd0000000p+0, 0x1.0ff1768237141p-25), (double2)(0x1.3977b10000000p+0, 0x1.575f83051b085p-25), (double2)(0x1.39b0910000000p+0, 0x1.2667deb523e29p-27), (double2)(0x1.39e95c0000000p+0, 0x1.816996954f4fdp-30), (double2)(0x1.3a22120000000p+0, 0x1.87cfccf4d9cd4p-26), (double2)(0x1.3a5ab40000000p+0, 0x1.2c5d018198353p-26), (double2)(0x1.3a93410000000p+0, 0x1.a7a898dcc34aap-25), (double2)(0x1.3acbbb0000000p+0, 0x1.cead6dadc36d1p-29), (double2)(0x1.3b04200000000p+0, 0x1.a55759c498bdfp-29), (double2)(0x1.3b3c700000000p+0, 0x1.c414a9ef6de04p-25), (double2)(0x1.3b74ad0000000p+0, 0x1.3e2108a6e58fap-25), (double2)(0x1.3bacd60000000p+0, 0x1.587fd7643d77cp-26), (double2)(0x1.3be4eb0000000p+0, 0x1.901eb1d3ff3dfp-28), (double2)(0x1.3c1ceb0000000p+0, 0x1.f2ccd7c812fc6p-25), (double2)(0x1.3c54d90000000p+0, 0x1.1c8ee70a01049p-29), (double2)(0x1.3c8cb20000000p+0, 0x1.63e8d02831eecp-26), (double2)(0x1.3cc4770000000p+0, 0x1.f61a42a92c7ffp-25), (double2)(0x1.3cfc2a0000000p+0, 0x1.a917399c84d24p-34), (double2)(0x1.3d33c80000000p+0, 0x1.e9197c8eec2f0p-26), (double2)(0x1.3d6b530000000p+0, 0x1.e6f842f5a1378p-26), (double2)(0x1.3da2cb0000000p+0, 0x1.fac242a90a0fcp-29), (double2)(0x1.3dda2f0000000p+0, 0x1.35ed726610227p-26), (double2)(0x1.3e11800000000p+0, 0x1.0e0d64804b15bp-26), (double2)(0x1.3e48be0000000p+0, 0x1.560675daba814p-31), (double2)(0x1.3e7fe80000000p+0, 0x1.37388c8768032p-25), (double2)(0x1.3eb7000000000p+0, 0x1.ee3c89f9e01f5p-28), (double2)(0x1.3eee040000000p+0, 0x1.39f6f0d09747cp-25), (double2)(0x1.3f24f60000000p+0, 0x1.322c327abb8f0p-27), (double2)(0x1.3f5bd40000000p+0, 0x1.961b347c8ac80p-25), (double2)(0x1.3f92a00000000p+0, 0x1.3711fbbd0f118p-25), (double2)(0x1.3fc9590000000p+0, 0x1.4fad8d7718ffbp-25), (double2)(0x1.3fffff0000000p+0, 0x1.fffffffffffffp-25), (double2)(0x1.4036930000000p+0, 0x1.67efa79ec35b4p-25), (double2)(0x1.406d140000000p+0, 0x1.a737687a254a8p-25), (double2)(0x1.40a3830000000p+0, 0x1.bace0f87d924dp-26), (double2)(0x1.40d9df0000000p+0, 0x1.29e37c237e392p-25), (double2)(0x1.4110290000000p+0, 0x1.57ce7ac3f3012p-26), (double2)(0x1.4146600000000p+0, 0x1.82829359f8fbdp-25), (double2)(0x1.417c850000000p+0, 0x1.cc9be42d14676p-25), (double2)(0x1.41b2980000000p+0, 0x1.a8f001c137d0bp-25), (double2)(0x1.41e8990000000p+0, 0x1.36127687dda05p-25), (double2)(0x1.421e880000000p+0, 0x1.24dba322646f0p-26), (double2)(0x1.4254640000000p+0, 0x1.dc43f1ed210b4p-25), (double2)(0x1.428a2f0000000p+0, 0x1.31ae515c447bbp-25) }; DECLARE_TABLE(double2, CBRT_REM_TBL, 5) = { (double2)(0x1.428a2f0000000p-1, 0x1.31ae515c447bbp-26), (double2)(0x1.965fea0000000p-1, 0x1.4f5b8f20ac166p-27), (double2)(0x1.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.428a2f0000000p+0, 0x1.31ae515c447bbp-25), (double2)(0x1.965fea0000000p+0, 0x1.4f5b8f20ac166p-26), }; DECLARE_TABLE(double2, POWLOG_TBL, 258) = { (double2)(0x0.0000000000000p+0, 0x0.0000000000000p+0), (double2)(0x1.ff00aa0000000p-9, 0x1.5885e0250435ap-36), (double2)(0x1.fe02a60000000p-8, 0x1.620cf11f86ed2p-33), (double2)(0x1.7dc4750000000p-7, 0x1.f0214edba4a25p-32), (double2)(0x1.fc0a8b0000000p-7, 0x1.f807c79f3db4ep-36), (double2)(0x1.3cea440000000p-6, 0x1.a352ba779a52bp-33), (double2)(0x1.7b91b00000000p-6, 0x1.f56c46aa49fd5p-32), (double2)(0x1.b9fc020000000p-6, 0x1.ebe465fef5196p-32), (double2)(0x1.f829b00000000p-6, 0x1.cf0660099f1f8p-31), (double2)(0x1.1b0d980000000p-5, 0x1.247b2ff85945dp-30), (double2)(0x1.39e87b0000000p-5, 0x1.3fd7abf5202b6p-30), (double2)(0x1.58a5ba0000000p-5, 0x1.f91c9a918d51ep-30), (double2)(0x1.77458f0000000p-5, 0x1.8cb73f118d3cap-31), (double2)(0x1.95c8300000000p-5, 0x1.d91c7d6fad074p-30), (double2)(0x1.b42dd70000000p-5, 0x1.1971bec28d14cp-33), (double2)(0x1.d276b80000000p-5, 0x1.5b616a423c78ap-30), (double2)(0x1.f0a30c0000000p-5, 0x1.162a6617cc971p-37), (double2)(0x1.0759830000000p-4, 0x1.66391c4c06d29p-30), (double2)(0x1.16536e0000000p-4, 0x1.d46f5c1d0c4b8p-29), (double2)(0x1.253f620000000p-4, 0x1.e14282df1f6d3p-29), (double2)(0x1.341d790000000p-4, 0x1.86f47424a660dp-30), (double2)(0x1.42edcb0000000p-4, 0x1.d4c8de077753ep-29), (double2)(0x1.51b0730000000p-4, 0x1.e0c307ed24f1cp-29), (double2)(0x1.60658a0000000p-4, 0x1.26ea18763bdd3p-29), (double2)(0x1.6f0d280000000p-4, 0x1.5cad69737c933p-29), (double2)(0x1.7da7660000000p-4, 0x1.af62599088901p-29), (double2)(0x1.8c345d0000000p-4, 0x1.8c66c83d6b2d0p-30), (double2)(0x1.9ab4240000000p-4, 0x1.880ceb36fb30fp-30), (double2)(0x1.a926d30000000p-4, 0x1.495aac6ca17a4p-29), (double2)(0x1.b78c820000000p-4, 0x1.761db4210878cp-29), (double2)(0x1.c5e5480000000p-4, 0x1.eb78e862bac2fp-29), (double2)(0x1.d4313d0000000p-4, 0x1.9b2cd75790dd9p-30), (double2)(0x1.e270760000000p-4, 0x1.c55e5cbd3d50fp-29), (double2)(0x1.f0a30c0000000p-4, 0x1.162a6617cc971p-36), (double2)(0x1.fec9130000000p-4, 0x1.dbeabaaa2e519p-32), (double2)(0x1.0671510000000p-3, 0x1.652cb7150c647p-30), (double2)(0x1.0d77e70000000p-3, 0x1.9a11cb2cd2ee2p-28), (double2)(0x1.1478580000000p-3, 0x1.19d0ab1a28813p-29), (double2)(0x1.1b72ad0000000p-3, 0x1.4bd9e80a41811p-29), (double2)(0x1.2266f10000000p-3, 0x1.214b596faa3dfp-28), (double2)(0x1.29552f0000000p-3, 0x1.03fea46980bb8p-28), (double2)(0x1.303d710000000p-3, 0x1.1c8ffa5fd28c7p-28), (double2)(0x1.371fc20000000p-3, 0x1.e8f743bcd96c5p-35), (double2)(0x1.3dfc2b0000000p-3, 0x1.d98c5395315c6p-32), (double2)(0x1.44d2b60000000p-3, 0x1.996fa3ccfa7b2p-28), (double2)(0x1.4ba36f0000000p-3, 0x1.cd2af2ad13037p-30), (double2)(0x1.526e5e0000000p-3, 0x1.d0da1bd17200ep-30), (double2)(0x1.59338d0000000p-3, 0x1.330410ba68b75p-28), (double2)(0x1.5ff3070000000p-3, 0x1.4f27a790e7c41p-32), (double2)(0x1.66acd40000000p-3, 0x1.3956a86f6ff1bp-30), (double2)(0x1.6d60fe0000000p-3, 0x1.c6748723551d9p-29), (double2)(0x1.740f8f0000000p-3, 0x1.500de9326cdfcp-29), (double2)(0x1.7ab8900000000p-3, 0x1.086c848df1b59p-30), (double2)(0x1.815c0a0000000p-3, 0x1.4357ead6836ffp-31), (double2)(0x1.87fa060000000p-3, 0x1.4832442408024p-29), (double2)(0x1.8e928d0000000p-3, 0x1.d10da8154b13dp-28), (double2)(0x1.9525a90000000p-3, 0x1.9e8ad68ec8260p-28), (double2)(0x1.9bb3620000000p-3, 0x1.cfbf706abaf18p-28), (double2)(0x1.a23bc10000000p-3, 0x1.fc56ac6326e23p-28), (double2)(0x1.a8becf0000000p-3, 0x1.9105e3185cf21p-28), (double2)(0x1.af3c940000000p-3, 0x1.d017fe5b19cc0p-28), (double2)(0x1.b5b5190000000p-3, 0x1.d1f6b48dd13fep-28), (double2)(0x1.bc28670000000p-3, 0x1.0b63358a7e73ap-29), (double2)(0x1.c296850000000p-3, 0x1.63063028c211cp-29), (double2)(0x1.c8ff7c0000000p-3, 0x1.e6a6886b09760p-29), (double2)(0x1.cf63540000000p-3, 0x1.c138bb891cd03p-28), (double2)(0x1.d5c2160000000p-3, 0x1.69f7722b7221ap-28), (double2)(0x1.dc1bca0000000p-3, 0x1.57d8fac1a628cp-32), (double2)(0x1.e270760000000p-3, 0x1.c55e5cbd3d50fp-28), (double2)(0x1.e8c0250000000p-3, 0x1.552d2ff48fe2ep-30), (double2)(0x1.ef0adc0000000p-3, 0x1.7b8b26ca431bcp-28), (double2)(0x1.f550a50000000p-3, 0x1.92decdc1c5f6dp-29), (double2)(0x1.fb91860000000p-3, 0x1.abc7c551aaa8cp-28), (double2)(0x1.00e6c40000000p-2, 0x1.6b540731a354bp-28), (double2)(0x1.0402590000000p-2, 0x1.2d341036b89efp-28), (double2)(0x1.071b850000000p-2, 0x1.f9ab21a3a2e0fp-27), (double2)(0x1.0a324e0000000p-2, 0x1.39c871afb9fbdp-29), (double2)(0x1.0d46b50000000p-2, 0x1.e6add2c81f640p-28), (double2)(0x1.1058bf0000000p-2, 0x1.35c95aa313f41p-27), (double2)(0x1.1368700000000p-2, 0x1.49d4582f6cc53p-29), (double2)(0x1.1675ca0000000p-2, 0x1.7574c1c07398fp-27), (double2)(0x1.1980d20000000p-2, 0x1.ba846dece9e8dp-27), (double2)(0x1.1c898c0000000p-2, 0x1.6999fafbc68e7p-30), (double2)(0x1.1f8ff90000000p-2, 0x1.c9145e51b0103p-27), (double2)(0x1.22941f0000000p-2, 0x1.79ef2cb44850ap-27), (double2)(0x1.2596010000000p-2, 0x1.beec73de11275p-31), (double2)(0x1.2895a10000000p-2, 0x1.ef4351af5a498p-29), (double2)(0x1.2b93030000000p-2, 0x1.5713a493b4a50p-27), (double2)(0x1.2e8e2b0000000p-2, 0x1.5c23a61385992p-27), (double2)(0x1.31871c0000000p-2, 0x1.2a88309f57299p-27), (double2)(0x1.347dd90000000p-2, 0x1.530faa9ac8acep-27), (double2)(0x1.3772660000000p-2, 0x1.5fec2d792a758p-29), (double2)(0x1.3a64c50000000p-2, 0x1.5a517a71cbcd7p-28), (double2)(0x1.3d54fa0000000p-2, 0x1.707dc3e1cd9a3p-28), (double2)(0x1.4043080000000p-2, 0x1.a1a9f8ef43049p-28), (double2)(0x1.432ef20000000p-2, 0x1.409d0276b3674p-27), (double2)(0x1.4618bc0000000p-2, 0x1.0e2f613e85bd9p-29), (double2)(0x1.4900680000000p-2, 0x1.0027433001e5fp-32), (double2)(0x1.4be5f90000000p-2, 0x1.5dde2836d3265p-28), (double2)(0x1.4ec9730000000p-2, 0x1.300134d7aaf04p-29), (double2)(0x1.51aad80000000p-2, 0x1.cb7e0b42724f5p-28), (double2)(0x1.548a2c0000000p-2, 0x1.d6e93167e6308p-29), (double2)(0x1.5767710000000p-2, 0x1.d1569b1526adbp-28), (double2)(0x1.5a42ab0000000p-2, 0x1.e99fc338a1a41p-31), (double2)(0x1.5d1bdb0000000p-2, 0x1.eb01394a11b1cp-27), (double2)(0x1.5ff3070000000p-2, 0x1.4f27a790e7c41p-31), (double2)(0x1.62c82f0000000p-2, 0x1.5ce3ca97b7af9p-29), (double2)(0x1.659b570000000p-2, 0x1.81f0f940ed857p-29), (double2)(0x1.686c810000000p-2, 0x1.d36295d88857cp-27), (double2)(0x1.6b3bb20000000p-2, 0x1.1aca1ec4af526p-29), (double2)(0x1.6e08ea0000000p-2, 0x1.45743c7182726p-27), (double2)(0x1.70d42e0000000p-2, 0x1.3c491aead337ep-29), (double2)(0x1.739d7f0000000p-2, 0x1.aef401a738931p-28), (double2)(0x1.7664e10000000p-2, 0x1.1cede76092a29p-29), (double2)(0x1.792a550000000p-2, 0x1.fba8f44f82bb4p-27), (double2)(0x1.7bede00000000p-2, 0x1.46f5f7f3c3e1ap-27), (double2)(0x1.7eaf830000000p-2, 0x1.7055f86c9674bp-27), (double2)(0x1.816f410000000p-2, 0x1.b41a92b6b6e1ap-27), (double2)(0x1.842d1d0000000p-2, 0x1.43d162e927628p-27), (double2)(0x1.86e9190000000p-2, 0x1.466174013f9b1p-27), (double2)(0x1.89a3380000000p-2, 0x1.b05096ad69c62p-28), (double2)(0x1.8c5b7c0000000p-2, 0x1.0b169150faa58p-27), (double2)(0x1.8f11e80000000p-2, 0x1.cd98b1df85da7p-28), (double2)(0x1.91c67e0000000p-2, 0x1.68b507b0f8fa8p-27), (double2)(0x1.9479410000000p-2, 0x1.8422df57499bap-27), (double2)(0x1.972a340000000p-2, 0x1.1351586970274p-30), (double2)(0x1.99d9580000000p-2, 0x1.17e08acba92eep-30), (double2)(0x1.9c86b00000000p-2, 0x1.6e04314dd0229p-29), (double2)(0x1.9f323e0000000p-2, 0x1.97f3097e56d1ap-27), (double2)(0x1.a1dc060000000p-2, 0x1.356e655901286p-28), (double2)(0x1.a484090000000p-2, 0x1.cb761457f94d6p-31), (double2)(0x1.a72a490000000p-2, 0x1.9af67a85a9dacp-28), (double2)(0x1.a9cec90000000p-2, 0x1.53410931a909fp-27), (double2)(0x1.ac718c0000000p-2, 0x1.2c587206058f5p-29), (double2)(0x1.af12930000000p-2, 0x1.23bc358899c22p-29), (double2)(0x1.b1b1e00000000p-2, 0x1.d7bf8b6d223cbp-27), (double2)(0x1.b44f770000000p-2, 0x1.7991ec5197ddbp-27), (double2)(0x1.b6eb590000000p-2, 0x1.a79e6bb3a9219p-27), (double2)(0x1.b985890000000p-2, 0x1.a4c43ed663ec5p-28), (double2)(0x1.bc1e080000000p-2, 0x1.61b5a1484f438p-27), (double2)(0x1.beb4d90000000p-2, 0x1.b4e36f7ef0c3ap-27), (double2)(0x1.c149ff0000000p-2, 0x1.15f026acd0d1bp-30), (double2)(0x1.c3dd7a0000000p-2, 0x1.f36b535cecf05p-28), (double2)(0x1.c66f4e0000000p-2, 0x1.ffb7fbf3eb5c6p-29), (double2)(0x1.c8ff7c0000000p-2, 0x1.e6a6886b09760p-28), (double2)(0x1.cb8e070000000p-2, 0x1.135eb27f5bbc3p-28), (double2)(0x1.ce1af00000000p-2, 0x1.70be7d6f6fa57p-27), (double2)(0x1.d0a63a0000000p-2, 0x1.ce43cc84ab338p-27), (double2)(0x1.d32fe70000000p-2, 0x1.c01d7aac3bd91p-27), (double2)(0x1.d5b7f90000000p-2, 0x1.5c58d07961060p-27), (double2)(0x1.d83e720000000p-2, 0x1.628bcf941456ep-28), (double2)(0x1.dac3530000000p-2, 0x1.c58b2a8461cd2p-27), (double2)(0x1.dd46a00000000p-2, 0x1.3071282fb989ap-28), (double2)(0x1.dfc8590000000p-2, 0x1.20dab6a80f09cp-27), (double2)(0x1.e248810000000p-2, 0x1.4f8d84c397b1ep-27), (double2)(0x1.e4c71a0000000p-2, 0x1.0d0ee08599e48p-27), (double2)(0x1.e744260000000p-2, 0x1.d68787e37da36p-30), (double2)(0x1.e9bfa60000000p-2, 0x1.66187d591bafcp-28), (double2)(0x1.ec399d0000000p-2, 0x1.2346600bae772p-29), (double2)(0x1.eeb20c0000000p-2, 0x1.90377d0d61b8ep-28), (double2)(0x1.f128f50000000p-2, 0x1.f5e0dd966b907p-27), (double2)(0x1.f39e5b0000000p-2, 0x1.9023cb79a00e2p-27), (double2)(0x1.f6123f0000000p-2, 0x1.4e05158c28ad8p-27), (double2)(0x1.f884a30000000p-2, 0x1.bfa7b08b18ae4p-28), (double2)(0x1.faf5880000000p-2, 0x1.ef1e63db35f67p-27), (double2)(0x1.fd64f20000000p-2, 0x1.ec2ae39493d4fp-31), (double2)(0x1.ffd2e00000000p-2, 0x1.0afe930ab2fa0p-27), (double2)(0x1.011fab0000000p-1, 0x1.25ff8a1810dd4p-29), (double2)(0x1.02552a0000000p-1, 0x1.69743fb1a71a5p-27), (double2)(0x1.0389ee0000000p-1, 0x1.f9cc676785571p-26), (double2)(0x1.04bdf90000000p-1, 0x1.b524da4cbf982p-26), (double2)(0x1.05f14b0000000p-1, 0x1.a4c8b381535b8p-26), (double2)(0x1.0723e50000000p-1, 0x1.839be809caf2cp-26), (double2)(0x1.0855c80000000p-1, 0x1.0968a1cb82c13p-26), (double2)(0x1.0986f40000000p-1, 0x1.eae6a41723fb5p-26), (double2)(0x1.0ab76b0000000p-1, 0x1.d9c29a380a4dbp-26), (double2)(0x1.0be72e0000000p-1, 0x1.094aa0ada625ep-27), (double2)(0x1.0d163c0000000p-1, 0x1.973ad6fc108cap-26), (double2)(0x1.0e44980000000p-1, 0x1.747322fdbab97p-27), (double2)(0x1.0f72410000000p-1, 0x1.93692fa9d4221p-26), (double2)(0x1.109f390000000p-1, 0x1.c5a992dfbc7d9p-26), (double2)(0x1.11cb810000000p-1, 0x1.e1f33e102387ap-27), (double2)(0x1.12f7190000000p-1, 0x1.64fbef14c048cp-27), (double2)(0x1.1422020000000p-1, 0x1.490f513ca5e3bp-27), (double2)(0x1.154c3d0000000p-1, 0x1.7a6af4d4c799dp-28), (double2)(0x1.1675ca0000000p-1, 0x1.7574c1c07398fp-26), (double2)(0x1.179eab0000000p-1, 0x1.7b133417f8c1cp-26), (double2)(0x1.18c6e00000000p-1, 0x1.feb9e0c176514p-26), (double2)(0x1.19ee6b0000000p-1, 0x1.19f25bb3172f7p-27), (double2)(0x1.1b154b0000000p-1, 0x1.5f68a7bbfb852p-27), (double2)(0x1.1c3b810000000p-1, 0x1.ee278497929f1p-26), (double2)(0x1.1d610f0000000p-1, 0x1.ccee006109d58p-26), (double2)(0x1.1e85f50000000p-1, 0x1.ce081a07bd8b3p-26), (double2)(0x1.1faa340000000p-1, 0x1.70e12981817b8p-26), (double2)(0x1.20cdcd0000000p-1, 0x1.92ab6d93503d0p-29), (double2)(0x1.21f0bf0000000p-1, 0x1.8cb7dd7c3b61ep-26), (double2)(0x1.23130d0000000p-1, 0x1.efafd0a0b78dap-27), (double2)(0x1.2434b60000000p-1, 0x1.e907267c4288ep-26), (double2)(0x1.2555bc0000000p-1, 0x1.d31ef96780875p-26), (double2)(0x1.2676200000000p-1, 0x1.3430dfcd2ad50p-29), (double2)(0x1.2795e10000000p-1, 0x1.44d88d75bc1f9p-28), (double2)(0x1.28b5000000000p-1, 0x1.bec0f055e04fcp-26), (double2)(0x1.29d37f0000000p-1, 0x1.d85611590b9adp-26), (double2)(0x1.2af15f0000000p-1, 0x1.320568e583229p-32), (double2)(0x1.2c0e9e0000000p-1, 0x1.a891d1772f538p-26), (double2)(0x1.2d2b400000000p-1, 0x1.2edc9dabba74dp-29), (double2)(0x1.2e47430000000p-1, 0x1.b9009a1015086p-27), (double2)(0x1.2f62a90000000p-1, 0x1.2a12a8c5b1a19p-26), (double2)(0x1.307d730000000p-1, 0x1.a7885f0fdac85p-28), (double2)(0x1.3197a00000000p-1, 0x1.f4ffcd43ac691p-26), (double2)(0x1.32b1330000000p-1, 0x1.2243ae2640aadp-26), (double2)(0x1.33ca2b0000000p-1, 0x1.46513299035d3p-26), (double2)(0x1.34e2890000000p-1, 0x1.b39c3a62dd725p-26), (double2)(0x1.35fa4e0000000p-1, 0x1.ba6dd40049f51p-26), (double2)(0x1.37117b0000000p-1, 0x1.51d1ed7177409p-27), (double2)(0x1.38280f0000000p-1, 0x1.cb0f2fd7f5216p-26), (double2)(0x1.393e0d0000000p-1, 0x1.ab150cd4e2213p-28), (double2)(0x1.3a53730000000p-1, 0x1.cfd7bf3193844p-26), (double2)(0x1.3b68440000000p-1, 0x1.3fff8455f1dbdp-26), (double2)(0x1.3c7c7f0000000p-1, 0x1.fee640b905fc9p-26), (double2)(0x1.3d90260000000p-1, 0x1.4e2adf548084cp-26), (double2)(0x1.3ea3390000000p-1, 0x1.b597adc1ecdd2p-28), (double2)(0x1.3fb5b80000000p-1, 0x1.345bd096d3a75p-27), (double2)(0x1.40c7a40000000p-1, 0x1.101b9d2453c8bp-26), (double2)(0x1.41d8fe0000000p-1, 0x1.08ce55cc8c979p-26), (double2)(0x1.42e9c60000000p-1, 0x1.bbf017e595f71p-26), (double2)(0x1.43f9fe0000000p-1, 0x1.7ce733bd393dcp-28), (double2)(0x1.4509a50000000p-1, 0x1.33bb0a503f8a1p-29), (double2)(0x1.4618bc0000000p-1, 0x1.0e2f613e85bd9p-28), (double2)(0x1.4727430000000p-1, 0x1.e67555a635b3cp-26), (double2)(0x1.48353d0000000p-1, 0x1.ea88df73d5e8bp-29), (double2)(0x1.4942a80000000p-1, 0x1.d17e03bda18a8p-28), (double2)(0x1.4a4f850000000p-1, 0x1.b607d76044f7ep-26), (double2)(0x1.4b5bd60000000p-1, 0x1.2adc4e71bc2fcp-26), (double2)(0x1.4c679a0000000p-1, 0x1.f99dc7362d1d9p-26), (double2)(0x1.4d72d30000000p-1, 0x1.473fa008e6a6ap-26), (double2)(0x1.4e7d810000000p-1, 0x1.b75bb09cb0985p-29), (double2)(0x1.4f87a30000000p-1, 0x1.ea04dd10b9abap-26), (double2)(0x1.50913c0000000p-1, 0x1.802d0d6979674p-26), (double2)(0x1.519a4c0000000p-1, 0x1.74688ccd99094p-30), (double2)(0x1.52a2d20000000p-1, 0x1.96f16abb9df22p-27), (double2)(0x1.53aad00000000p-1, 0x1.6e66df2aa374fp-27), (double2)(0x1.54b2460000000p-1, 0x1.e66525ea4550ap-27), (double2)(0x1.55b9350000000p-1, 0x1.2d02f34f20cbdp-27), (double2)(0x1.56bf9d0000000p-1, 0x1.6cfce65047188p-27), (double2)(0x1.57c57f0000000p-1, 0x1.9b78c842d58b8p-28), (double2)(0x1.58cadb0000000p-1, 0x1.735e624c24bc9p-27), (double2)(0x1.59cfb20000000p-1, 0x1.7eba1f7dd1adfp-27), (double2)(0x1.5ad4040000000p-1, 0x1.86b3e59f65355p-26), (double2)(0x1.5bd7d30000000p-1, 0x1.ce38e637f1b4dp-30), (double2)(0x1.5cdb1d0000000p-1, 0x1.8d82ec919edc7p-26), (double2)(0x1.5ddde50000000p-1, 0x1.c52648ddcfa37p-27), (double2)(0x1.5ee02a0000000p-1, 0x1.2482ceae1ac12p-26), (double2)(0x1.5fe1ed0000000p-1, 0x1.5a312311aba4fp-26), (double2)(0x1.60e32f0000000p-1, 0x1.11e236329f225p-27), (double2)(0x1.61e3ef0000000p-1, 0x1.b48c8cd2f246cp-26), (double2)(0x1.62e42e0000000p-1, 0x1.efa39ef35793cp-25), (double2)(0x0.0000000000000p+0, 0x0.0000000000000p+0), }; DECLARE_TABLE(double2, LOG_F_INV_TBL, 258) = { (double2)(0x1.0000000000000p+1, 0x0.0000000000000p+0), (double2)(0x1.fe00000000000p+0, 0x1.fe01fe01fe020p-16), (double2)(0x1.fc00000000000p+0, 0x1.fc07f01fc07f0p-14), (double2)(0x1.fa00000000000p+0, 0x1.1caa01fa11caap-12), (double2)(0x1.f800000000000p+0, 0x1.f81f81f81f820p-12), (double2)(0x1.f600000000000p+0, 0x1.8856506ddaba6p-11), (double2)(0x1.f400000000000p+0, 0x1.196792909c560p-10), (double2)(0x1.f200000000000p+0, 0x1.7d9108c2ad433p-10), (double2)(0x1.f000000000000p+0, 0x1.f07c1f07c1f08p-10), (double2)(0x1.ee00000000000p+0, 0x1.38ff08b1c03ddp-9), (double2)(0x1.ec00000000000p+0, 0x1.80f6603d980f6p-9), (double2)(0x1.ea00000000000p+0, 0x1.d00f57403d5d0p-9), (double2)(0x1.e900000000000p+0, 0x1.31abf0b7672a0p-12), (double2)(0x1.e700000000000p+0, 0x1.06a965d43919bp-10), (double2)(0x1.e500000000000p+0, 0x1.ceb240795ceb2p-10), (double2)(0x1.e300000000000p+0, 0x1.522f3b834e67fp-9), (double2)(0x1.e100000000000p+0, 0x1.c3c3c3c3c3c3cp-9), (double2)(0x1.e000000000000p+0, 0x1.e01e01e01e01ep-12), (double2)(0x1.de00000000000p+0, 0x1.75b8fe21a291cp-10), (double2)(0x1.dc00000000000p+0, 0x1.403b9403b9404p-9), (double2)(0x1.da00000000000p+0, 0x1.cc0ed7303b5ccp-9), (double2)(0x1.d900000000000p+0, 0x1.79118f3fc4da2p-11), (double2)(0x1.d700000000000p+0, 0x1.ed952e0b0ce46p-10), (double2)(0x1.d500000000000p+0, 0x1.95900eae56404p-9), (double2)(0x1.d400000000000p+0, 0x1.d41d41d41d41dp-12), (double2)(0x1.d200000000000p+0, 0x1.cb28ff16c69aep-10), (double2)(0x1.d000000000000p+0, 0x1.96b1edd80e866p-9), (double2)(0x1.cf00000000000p+0, 0x1.372e225fe30d9p-11), (double2)(0x1.cd00000000000p+0, 0x1.0ad12073615a2p-9), (double2)(0x1.cb00000000000p+0, 0x1.cdb2c0397cdb3p-9), (double2)(0x1.ca00000000000p+0, 0x1.2cc157b864407p-10), (double2)(0x1.c800000000000p+0, 0x1.64cb5f7148404p-9), (double2)(0x1.c700000000000p+0, 0x1.c71c71c71c71cp-12), (double2)(0x1.c500000000000p+0, 0x1.129a21a930b84p-9), (double2)(0x1.c300000000000p+0, 0x1.f1e0387f1e038p-9), (double2)(0x1.c200000000000p+0, 0x1.ad4e4ba80709bp-10), (double2)(0x1.c000000000000p+0, 0x1.c0e070381c0e0p-9), (double2)(0x1.bf00000000000p+0, 0x1.60fba1a362bb0p-10), (double2)(0x1.bd00000000000p+0, 0x1.a5713280dee96p-9), (double2)(0x1.bc00000000000p+0, 0x1.3f59620f9ece9p-10), (double2)(0x1.ba00000000000p+0, 0x1.9f22983759f23p-9), (double2)(0x1.b900000000000p+0, 0x1.478ac63fc8d5cp-10), (double2)(0x1.b700000000000p+0, 0x1.ad87bb4671656p-9), (double2)(0x1.b600000000000p+0, 0x1.78b8efbb8148cp-10), (double2)(0x1.b400000000000p+0, 0x1.d0369d0369d03p-9), (double2)(0x1.b300000000000p+0, 0x1.d212b601b3748p-10), (double2)(0x1.b200000000000p+0, 0x1.b2036406c80d9p-15), (double2)(0x1.b000000000000p+0, 0x1.29663b24547d1p-9), (double2)(0x1.af00000000000p+0, 0x1.435e50d79435ep-11), (double2)(0x1.ad00000000000p+0, 0x1.7d0ff2920bc03p-9), (double2)(0x1.ac00000000000p+0, 0x1.5c06b15c06b16p-10), (double2)(0x1.aa00000000000p+0, 0x1.e3a5f0fd7f954p-9), (double2)(0x1.a900000000000p+0, 0x1.1dec0d4c77b03p-9), (double2)(0x1.a800000000000p+0, 0x1.73289870ac52ep-11), (double2)(0x1.a600000000000p+0, 0x1.a034da034da03p-9), (double2)(0x1.a500000000000p+0, 0x1.d041da2292856p-10), (double2)(0x1.a400000000000p+0, 0x1.a41a41a41a41ap-12), (double2)(0x1.a200000000000p+0, 0x1.8550f8a39409dp-9), (double2)(0x1.a100000000000p+0, 0x1.b4fe5e92c0686p-10), (double2)(0x1.a000000000000p+0, 0x1.a01a01a01a01ap-12), (double2)(0x1.9e00000000000p+0, 0x1.91d2a2067b23ap-9), (double2)(0x1.9d00000000000p+0, 0x1.e7c5dada0b4e5p-10), (double2)(0x1.9c00000000000p+0, 0x1.68a7725080ce1p-11), (double2)(0x1.9a00000000000p+0, 0x1.c49d4aa21b490p-9), (double2)(0x1.9900000000000p+0, 0x1.3333333333333p-9), (double2)(0x1.9800000000000p+0, 0x1.4bc363b03fccfp-10), (double2)(0x1.9700000000000p+0, 0x1.c9f01970e4f81p-13), (double2)(0x1.9500000000000p+0, 0x1.97617c6ef5b25p-9), (double2)(0x1.9400000000000p+0, 0x1.161f9add3c0cap-9), (double2)(0x1.9300000000000p+0, 0x1.319fe6cb39806p-10), (double2)(0x1.9200000000000p+0, 0x1.f693a1c451ab3p-13), (double2)(0x1.9000000000000p+0, 0x1.a9e240321a9e2p-9), (double2)(0x1.8f00000000000p+0, 0x1.3831f3831f383p-9), (double2)(0x1.8e00000000000p+0, 0x1.949ebc4dcfc1cp-10), (double2)(0x1.8d00000000000p+0, 0x1.80c6980c6980cp-11), (double2)(0x1.8b00000000000p+0, 0x1.f9d00c5fe7403p-9), (double2)(0x1.8a00000000000p+0, 0x1.9721ed7e75347p-9), (double2)(0x1.8900000000000p+0, 0x1.381ec0313381fp-9), (double2)(0x1.8800000000000p+0, 0x1.b97c2aec12653p-10), (double2)(0x1.8700000000000p+0, 0x1.09ef3024ae3bap-10), (double2)(0x1.8600000000000p+0, 0x1.8618618618618p-12), (double2)(0x1.8400000000000p+0, 0x1.e0184f00c2780p-9), (double2)(0x1.8300000000000p+0, 0x1.92ef5657dba52p-9), (double2)(0x1.8200000000000p+0, 0x1.4940305494030p-9), (double2)(0x1.8100000000000p+0, 0x1.0303030303030p-9), (double2)(0x1.8000000000000p+0, 0x1.8060180601806p-10), (double2)(0x1.7f00000000000p+0, 0x1.017f405fd017fp-10), (double2)(0x1.7e00000000000p+0, 0x1.12a8ad278e8ddp-11), (double2)(0x1.7d00000000000p+0, 0x1.7d05f417d05f4p-14), (double2)(0x1.7b00000000000p+0, 0x1.d67245c02f7d6p-9), (double2)(0x1.7a00000000000p+0, 0x1.a4411c1d986a9p-9), (double2)(0x1.7900000000000p+0, 0x1.754d76c7316dfp-9), (double2)(0x1.7800000000000p+0, 0x1.49902f149902fp-9), (double2)(0x1.7700000000000p+0, 0x1.21023358c1a68p-9), (double2)(0x1.7600000000000p+0, 0x1.f7390d2a6c406p-10), (double2)(0x1.7500000000000p+0, 0x1.b2b0805d5b2b1p-10), (double2)(0x1.7400000000000p+0, 0x1.745d1745d1746p-10), (double2)(0x1.7300000000000p+0, 0x1.3c31507fa32c4p-10), (double2)(0x1.7200000000000p+0, 0x1.0a1fd1b7af017p-10), (double2)(0x1.7100000000000p+0, 0x1.bc36ce3e0453ap-11), (double2)(0x1.7000000000000p+0, 0x1.702e05c0b8170p-11), (double2)(0x1.6f00000000000p+0, 0x1.300b79300b793p-11), (double2)(0x1.6e00000000000p+0, 0x1.f76b4337c6cb1p-12), (double2)(0x1.6d00000000000p+0, 0x1.a62681c860fb0p-12), (double2)(0x1.6c00000000000p+0, 0x1.6c16c16c16c17p-12), (double2)(0x1.6b00000000000p+0, 0x1.490aa31a3cfc7p-12), (double2)(0x1.6a00000000000p+0, 0x1.3cd153729043ep-12), (double2)(0x1.6900000000000p+0, 0x1.473a88d0bfd2ep-12), (double2)(0x1.6800000000000p+0, 0x1.6816816816817p-12), (double2)(0x1.6700000000000p+0, 0x1.9f36016719f36p-12), (double2)(0x1.6600000000000p+0, 0x1.ec6a5122f9016p-12), (double2)(0x1.6500000000000p+0, 0x1.27c29da5519cfp-11), (double2)(0x1.6400000000000p+0, 0x1.642c8590b2164p-11), (double2)(0x1.6300000000000p+0, 0x1.ab5c45606f00bp-11), (double2)(0x1.6200000000000p+0, 0x1.fd3b80b11fd3cp-11), (double2)(0x1.6100000000000p+0, 0x1.2cda0c6ba4eaap-10), (double2)(0x1.6000000000000p+0, 0x1.6058160581606p-10), (double2)(0x1.5f00000000000p+0, 0x1.990d0a4b7ef87p-10), (double2)(0x1.5e00000000000p+0, 0x1.d6ee340579d6fp-10), (double2)(0x1.5d00000000000p+0, 0x1.0cf87d9c54a69p-9), (double2)(0x1.5c00000000000p+0, 0x1.310572620ae4cp-9), (double2)(0x1.5b00000000000p+0, 0x1.5798c8ff522a2p-9), (double2)(0x1.5a00000000000p+0, 0x1.80ad602b580adp-9), (double2)(0x1.5900000000000p+0, 0x1.ac3e24799546fp-9), (double2)(0x1.5800000000000p+0, 0x1.da46102b1da46p-9), (double2)(0x1.5800000000000p+0, 0x1.5805601580560p-14), (double2)(0x1.5700000000000p+0, 0x1.ed3c506b39a23p-12), (double2)(0x1.5600000000000p+0, 0x1.cbdd3e2970f60p-11), (double2)(0x1.5500000000000p+0, 0x1.5555555555555p-10), (double2)(0x1.5400000000000p+0, 0x1.c979aee0bf805p-10), (double2)(0x1.5300000000000p+0, 0x1.21291e81fd58ep-9), (double2)(0x1.5200000000000p+0, 0x1.5fead500a9580p-9), (double2)(0x1.5100000000000p+0, 0x1.a0fd5c5f02a3ap-9), (double2)(0x1.5000000000000p+0, 0x1.e45c223898adcp-9), (double2)(0x1.5000000000000p+0, 0x1.5015015015015p-12), (double2)(0x1.4f00000000000p+0, 0x1.c7b16ea64d422p-11), (double2)(0x1.4e00000000000p+0, 0x1.7829cbc14e5e1p-10), (double2)(0x1.4d00000000000p+0, 0x1.0877db8589720p-9), (double2)(0x1.4c00000000000p+0, 0x1.5710e4b5edceap-9), (double2)(0x1.4b00000000000p+0, 0x1.a7dbb4d1fc1c8p-9), (double2)(0x1.4a00000000000p+0, 0x1.fad40a57eb503p-9), (double2)(0x1.4a00000000000p+0, 0x1.3fd6bb00a5140p-11), (double2)(0x1.4900000000000p+0, 0x1.4e78ecb419ba9p-10), (double2)(0x1.4800000000000p+0, 0x1.00a44029100a4p-9), (double2)(0x1.4700000000000p+0, 0x1.5c28f5c28f5c3p-9), (double2)(0x1.4600000000000p+0, 0x1.b9c68b2c0cc4ap-9), (double2)(0x1.4600000000000p+0, 0x1.978feb9f34381p-13), (double2)(0x1.4500000000000p+0, 0x1.ecf163bb6500ap-11), (double2)(0x1.4400000000000p+0, 0x1.be1958b67ebb9p-10), (double2)(0x1.4300000000000p+0, 0x1.44e6157dc9a3bp-9), (double2)(0x1.4200000000000p+0, 0x1.acc4baa3f0ddfp-9), (double2)(0x1.4200000000000p+0, 0x1.6a4cbcb2a247bp-13), (double2)(0x1.4100000000000p+0, 0x1.0505050505050p-10), (double2)(0x1.4000000000000p+0, 0x1.e0b4439959819p-10), (double2)(0x1.3f00000000000p+0, 0x1.6027f6027f602p-9), (double2)(0x1.3e00000000000p+0, 0x1.d1e854b5e0db4p-9), (double2)(0x1.3e00000000000p+0, 0x1.165e7254813e2p-11), (double2)(0x1.3d00000000000p+0, 0x1.76646a9d716efp-10), (double2)(0x1.3c00000000000p+0, 0x1.32b48f757ce88p-9), (double2)(0x1.3b00000000000p+0, 0x1.ac1b24652a906p-9), (double2)(0x1.3b00000000000p+0, 0x1.3b13b13b13b14p-12), (double2)(0x1.3a00000000000p+0, 0x1.490e1eb208984p-10), (double2)(0x1.3900000000000p+0, 0x1.2385830fec66ep-9), (double2)(0x1.3800000000000p+0, 0x1.a45a6cc111b7ep-9), (double2)(0x1.3800000000000p+0, 0x1.3813813813814p-12), (double2)(0x1.3700000000000p+0, 0x1.56f472517b708p-10), (double2)(0x1.3600000000000p+0, 0x1.31be7bc0e8f2ap-9), (double2)(0x1.3500000000000p+0, 0x1.b9cbf3e55f044p-9), (double2)(0x1.3500000000000p+0, 0x1.0e7d95bc609a9p-11), (double2)(0x1.3400000000000p+0, 0x1.9e6b3804d19e7p-10), (double2)(0x1.3300000000000p+0, 0x1.5c8b6af7963c2p-9), (double2)(0x1.3200000000000p+0, 0x1.eb9dad43bf402p-9), (double2)(0x1.3200000000000p+0, 0x1.f1a515885fb37p-11), (double2)(0x1.3100000000000p+0, 0x1.0eeb1d3d76c02p-9), (double2)(0x1.3000000000000p+0, 0x1.a320261a32026p-9), (double2)(0x1.3000000000000p+0, 0x1.c82ac40260390p-12), (double2)(0x1.2f00000000000p+0, 0x1.a12f684bda12fp-10), (double2)(0x1.2e00000000000p+0, 0x1.69d43fda2962cp-9), (double2)(0x1.2e00000000000p+0, 0x1.2e025c04b8097p-15), (double2)(0x1.2d00000000000p+0, 0x1.42804b542804bp-10), (double2)(0x1.2c00000000000p+0, 0x1.3f69b02593f6ap-9), (double2)(0x1.2b00000000000p+0, 0x1.df31cb46e21fap-9), (double2)(0x1.2b00000000000p+0, 0x1.012b404ad012bp-10), (double2)(0x1.2a00000000000p+0, 0x1.23925e7820a7fp-9), (double2)(0x1.2900000000000p+0, 0x1.c8253c8253c82p-9), (double2)(0x1.2900000000000p+0, 0x1.b92ddc02526e5p-11), (double2)(0x1.2800000000000p+0, 0x1.1602511602511p-9), (double2)(0x1.2700000000000p+0, 0x1.bf471439c9adfp-9), (double2)(0x1.2700000000000p+0, 0x1.a85c40939a85cp-11), (double2)(0x1.2600000000000p+0, 0x1.166f9ac024d16p-9), (double2)(0x1.2500000000000p+0, 0x1.c44e10125e227p-9), (double2)(0x1.2500000000000p+0, 0x1.cebf48bbd90e5p-11), (double2)(0x1.2400000000000p+0, 0x1.2492492492492p-9), (double2)(0x1.2300000000000p+0, 0x1.d6f2e2ec0b673p-9), (double2)(0x1.2300000000000p+0, 0x1.159e26af37c05p-10), (double2)(0x1.2200000000000p+0, 0x1.4024540245402p-9), (double2)(0x1.2100000000000p+0, 0x1.f6f0243f6f024p-9), (double2)(0x1.2100000000000p+0, 0x1.5e60121579805p-10), (double2)(0x1.2000000000000p+0, 0x1.68e18cf81b10fp-9), (double2)(0x1.2000000000000p+0, 0x1.2012012012012p-12), (double2)(0x1.1f00000000000p+0, 0x1.c11f7047dc11fp-10), (double2)(0x1.1e00000000000p+0, 0x1.9e878ff70985ep-9), (double2)(0x1.1e00000000000p+0, 0x1.779d9fdc3a219p-11), (double2)(0x1.1d00000000000p+0, 0x1.1eace5c957907p-9), (double2)(0x1.1c00000000000p+0, 0x1.e0d5b450239e1p-9), (double2)(0x1.1c00000000000p+0, 0x1.48bf073816367p-10), (double2)(0x1.1b00000000000p+0, 0x1.694808dda5202p-9), (double2)(0x1.1b00000000000p+0, 0x1.7c67f2bae2b21p-12), (double2)(0x1.1a00000000000p+0, 0x1.ee58469ee5847p-10), (double2)(0x1.1900000000000p+0, 0x1.c0233c0233c02p-9), (double2)(0x1.1900000000000p+0, 0x1.14e02328a7012p-10), (double2)(0x1.1800000000000p+0, 0x1.561072057b573p-9), (double2)(0x1.1800000000000p+0, 0x1.1811811811812p-12), (double2)(0x1.1700000000000p+0, 0x1.e28646f5a1060p-10), (double2)(0x1.1600000000000p+0, 0x1.c0d1284e6f1d7p-9), (double2)(0x1.1600000000000p+0, 0x1.23543f0c80459p-10), (double2)(0x1.1500000000000p+0, 0x1.63cbeea4e1a09p-9), (double2)(0x1.1500000000000p+0, 0x1.b9a3fdd5c8cb8p-12), (double2)(0x1.1400000000000p+0, 0x1.0be1c159a76d2p-9), (double2)(0x1.1300000000000p+0, 0x1.e1d1a688e4838p-9), (double2)(0x1.1300000000000p+0, 0x1.72044d72044d7p-10), (double2)(0x1.1200000000000p+0, 0x1.91713db81577bp-9), (double2)(0x1.1200000000000p+0, 0x1.ac73ae9819b50p-11), (double2)(0x1.1100000000000p+0, 0x1.460334e904cf6p-9), (double2)(0x1.1100000000000p+0, 0x1.1111111111111p-12), (double2)(0x1.1000000000000p+0, 0x1.feef80441fef0p-10), (double2)(0x1.0f00000000000p+0, 0x1.de021fde021fep-9), (double2)(0x1.0f00000000000p+0, 0x1.7b7eacc9686a0p-10), (double2)(0x1.0e00000000000p+0, 0x1.9ead7cd391fbcp-9), (double2)(0x1.0e00000000000p+0, 0x1.0195609804390p-10), (double2)(0x1.0d00000000000p+0, 0x1.641511e8d2b32p-9), (double2)(0x1.0d00000000000p+0, 0x1.222b1acf1ce96p-11), (double2)(0x1.0c00000000000p+0, 0x1.2e29f79b47582p-9), (double2)(0x1.0c00000000000p+0, 0x1.4f0d1682e11cdp-13), (double2)(0x1.0b00000000000p+0, 0x1.f9bb096771e4dp-10), (double2)(0x1.0a00000000000p+0, 0x1.e5ee45dd96ae2p-9), (double2)(0x1.0a00000000000p+0, 0x1.a0429a0429a04p-10), (double2)(0x1.0900000000000p+0, 0x1.bb74d5f06c021p-9), (double2)(0x1.0900000000000p+0, 0x1.4fce404254fcep-10), (double2)(0x1.0800000000000p+0, 0x1.95766eacbc402p-9), (double2)(0x1.0800000000000p+0, 0x1.0842108421084p-10), (double2)(0x1.0700000000000p+0, 0x1.73e5371d5c338p-9), (double2)(0x1.0700000000000p+0, 0x1.930523fbe3368p-11), (double2)(0x1.0600000000000p+0, 0x1.56b38f225f6c4p-9), (double2)(0x1.0600000000000p+0, 0x1.26e978d4fdf3bp-11), (double2)(0x1.0500000000000p+0, 0x1.3dd40e4eb0cc6p-9), (double2)(0x1.0500000000000p+0, 0x1.97f7d73404146p-12), (double2)(0x1.0400000000000p+0, 0x1.293982cc98af1p-9), (double2)(0x1.0400000000000p+0, 0x1.0410410410410p-12), (double2)(0x1.0300000000000p+0, 0x1.18d6f048ff7e4p-9), (double2)(0x1.0300000000000p+0, 0x1.236a3ebc349dep-13), (double2)(0x1.0200000000000p+0, 0x1.0c9f8ee53d18cp-9), (double2)(0x1.0200000000000p+0, 0x1.0204081020408p-14), (double2)(0x1.0100000000000p+0, 0x1.0486ca2f46ea6p-9), (double2)(0x1.0100000000000p+0, 0x1.0101010101010p-16), (double2)(0x1.0000000000000p+0, 0x1.0080402010080p-9), (double2)(0x1.0000000000000p+0, 0x0.0000000000000p+0), }; TABLE_FUNCTION(double2, ATAN_JBY256_TBL, atan_jby256_tbl); TABLE_FUNCTION(double2, TWO_TO_JBY64_EP, two_to_jby64_ep_tbl); TABLE_FUNCTION(double2, SINH_TBL, sinh_tbl); TABLE_FUNCTION(double2, COSH_TBL, cosh_tbl); TABLE_FUNCTION(double, CBRT_INV_TBL, cbrt_inv_tbl); TABLE_FUNCTION(double2, CBRT_DBL_TBL, cbrt_dbl_tbl); TABLE_FUNCTION(double2, CBRT_REM_TBL, cbrt_rem_tbl); TABLE_FUNCTION(double2, POWLOG_TBL, powlog_tbl); TABLE_FUNCTION(double2, LOG_F_INV_TBL, log_f_inv_tbl); #endif // cl_khr_fp64 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tables.h��������������������������������������������������0000664�0000000�0000000�00000004613�13251554454�0021113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #define TABLE_SPACE __constant #define TABLE_MANGLE(NAME) __clc_##NAME #define DECLARE_TABLE(TYPE,NAME,LENGTH) \ TABLE_SPACE TYPE NAME [ LENGTH ] #define TABLE_FUNCTION(TYPE,TABLE,NAME) \ TYPE TABLE_MANGLE(NAME)(size_t idx) { \ return TABLE[idx]; \ } #define TABLE_FUNCTION_DECL(TYPE, NAME) \ TYPE TABLE_MANGLE(NAME)(size_t idx); #define USE_TABLE(NAME, IDX) \ TABLE_MANGLE(NAME)(IDX) TABLE_FUNCTION_DECL(float2, loge_tbl); TABLE_FUNCTION_DECL(float, log_inv_tbl); TABLE_FUNCTION_DECL(float2, log_inv_tbl_ep); TABLE_FUNCTION_DECL(float2, log2_tbl); TABLE_FUNCTION_DECL(uint4, pibits_tbl); TABLE_FUNCTION_DECL(float2, sinhcosh_tbl); TABLE_FUNCTION_DECL(float2, cbrt_tbl); TABLE_FUNCTION_DECL(float, exp_tbl); TABLE_FUNCTION_DECL(float2, exp_tbl_ep); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable TABLE_FUNCTION_DECL(double2, ln_tbl); TABLE_FUNCTION_DECL(double2, atan_jby256_tbl); TABLE_FUNCTION_DECL(double2, two_to_jby64_ep_tbl); TABLE_FUNCTION_DECL(double2, sinh_tbl); TABLE_FUNCTION_DECL(double2, cosh_tbl); TABLE_FUNCTION_DECL(double, cbrt_inv_tbl); TABLE_FUNCTION_DECL(double2, cbrt_dbl_tbl); TABLE_FUNCTION_DECL(double2, cbrt_rem_tbl); TABLE_FUNCTION_DECL(double2, powlog_tbl); TABLE_FUNCTION_DECL(double2, log_f_inv_tbl); #endif // cl_khr_fp64 ���������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tan.cl����������������������������������������������������0000664�0000000�0000000�00000000216�13251554454�0020565�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_FUNC tan #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tanh.cl���������������������������������������������������0000664�0000000�0000000�00000011577�13251554454�0020751�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float tanh(float x) { // The definition of tanh(x) is sinh(x)/cosh(x), which is also equivalent // to the following three formulae: // 1. (exp(x) - exp(-x))/(exp(x) + exp(-x)) // 2. (1 - (2/(exp(2*x) + 1 ))) // 3. (exp(2*x) - 1)/(exp(2*x) + 1) // but computationally, some formulae are better on some ranges. const float large_threshold = 0x1.0a2b24p+3f; uint ux = as_uint(x); uint aux = ux & EXSIGNBIT_SP32; uint xs = ux ^ aux; float y = as_float(aux); float y2 = y*y; float a1 = mad(y2, mad(y2, 0.4891631088530669873e-4F, -0.14628356048797849e-2F), -0.28192806108402678e0F); float b1 = mad(y2, 0.3427017942262751343e0F, 0.845784192581041099e0F); float a2 = mad(y2, mad(y2, 0.3827534993599483396e-4F, -0.12325644183611929e-2F), -0.24069858695196524e0F); float b2 = mad(y2, 0.292529068698052819e0F, 0.72209738473684982e0F); int c = y < 0.9f; float a = c ? a1 : a2; float b = c ? b1 : b2; float zlo = mad(MATH_DIVIDE(a, b), y*y2, y); float p = exp(2.0f * y) + 1.0f; float zhi = 1.0F - MATH_DIVIDE(2.0F, p); float z = y <= 1.0f ? zlo : zhi; z = as_float(xs | as_uint(z)); // Edge cases float sone = as_float(0x3f800000U | xs); z = y > large_threshold ? sone : z; z = aux < 0x39000000 | aux > 0x7f800000 ? x : z; return z; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, tanh, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double tanh(double x) { // The definition of tanh(x) is sinh(x)/cosh(x), which is also equivalent // to the following three formulae: // 1. (exp(x) - exp(-x))/(exp(x) + exp(-x)) // 2. (1 - (2/(exp(2*x) + 1 ))) // 3. (exp(2*x) - 1)/(exp(2*x) + 1) // but computationally, some formulae are better on some ranges. // The point at which e^-x is insignificant compared to e^x = ln(2^27) const double large_threshold = 0x1.2b708872320e2p+4; ulong ux = as_ulong(x); ulong ax = ux & ~SIGNBIT_DP64; ulong sx = ux ^ ax; double y = as_double(ax); double y2 = y * y; // y < 0.9 double znl = fma(y2, fma(y2, fma(y2, -0.142077926378834722618091e-7, -0.200047621071909498730453e-3), -0.176016349003044679402273e-1), -0.274030424656179760118928e0); double zdl = fma(y2, fma(y2, fma(y2, 0.2091140262529164482568557e-3, 0.201562166026937652780575e-1), 0.381641414288328849317962e0), 0.822091273968539282568011e0); // 0.9 <= y <= 1 double znm = fma(y2, fma(y2, fma(y2, -0.115475878996143396378318e-7, -0.165597043903549960486816e-3), -0.146173047288731678404066e-1), -0.227793870659088295252442e0); double zdm = fma(y2, fma(y2, fma(y2, 0.173076050126225961768710e-3, 0.167358775461896562588695e-1), 0.317204558977294374244770e0), 0.683381611977295894959554e0); int c = y < 0.9; double zn = c ? znl : znm; double zd = c ? zdl : zdm; double z = y + y*y2 * MATH_DIVIDE(zn, zd); // y > 1 double p = exp(2.0 * y) + 1.0; double zg = 1.0 - 2.0 / p; z = y > 1.0 ? zg : z; // Other cases z = y < 0x1.0p-28 | ax > PINFBITPATT_DP64 ? x : z; z = y > large_threshold ? 1.0 : z; return as_double(sx | as_ulong(z)); } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, tanh, double); #endif // cl_khr_fp64 ���������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tanpi.cl��������������������������������������������������0000664�0000000�0000000�00000000222�13251554454�0021113�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_FUNC tanpi #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/math/tgamma.cl�������������������������������������������������0000664�0000000�0000000�00000004321�13251554454�0021252�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2016 Aaron Watry * Copyright (c) 2014 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "math.h" #include "../clcmacro.h" _CLC_OVERLOAD _CLC_DEF float tgamma(float x) { const float pi = 3.1415926535897932384626433832795f; float ax = fabs(x); float lg = lgamma(ax); float g = exp(lg); if (x < 0.0f) { float z = sinpi(x); g = g * ax * z; g = pi / g; g = g == 0 ? as_float(PINFBITPATT_SP32) : g; g = z == 0 ? as_float(QNANBITPATT_SP32) : g; } return g; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, tgamma, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_OVERLOAD _CLC_DEF double tgamma(double x) { const double pi = 3.1415926535897932384626433832795; double ax = fabs(x); double lg = lgamma(ax); double g = exp(lg); if (x < 0.0) { double z = sinpi(x); g = g * ax * z; g = pi / g; g = g == 0 ? as_double(PINFBITPATT_DP64) : g; g = z == 0 ? as_double(QNANBITPATT_DP64) : g; } return g; } _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, tgamma, double); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/misc/����������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017466�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/misc/shuffle.cl������������������������������������������������0000664�0000000�0000000�00000013704�13251554454�0021447�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//===-- generic/lib/misc/shuffle.cl ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under both the University of Illinois Open Source // License and the MIT license. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include #define _CLC_ELEMENT_CASES2(VAR) \ case 0: return VAR.s0; \ case 1: return VAR.s1; #define _CLC_ELEMENT_CASES4(VAR) \ _CLC_ELEMENT_CASES2(VAR) \ case 2: return VAR.s2; \ case 3: return VAR.s3; #define _CLC_ELEMENT_CASES8(VAR) \ _CLC_ELEMENT_CASES4(VAR) \ case 4: return VAR.s4; \ case 5: return VAR.s5; \ case 6: return VAR.s6; \ case 7: return VAR.s7; #define _CLC_ELEMENT_CASES16(VAR) \ _CLC_ELEMENT_CASES8(VAR) \ case 8: return VAR.s8; \ case 9: return VAR.s9; \ case 10: return VAR.sA; \ case 11: return VAR.sB; \ case 12: return VAR.sC; \ case 13: return VAR.sD; \ case 14: return VAR.sE; \ case 15: return VAR.sF; #define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \ inline ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE(ARGTYPE##ARGSIZE x, IDXTYPE idx) {\ switch (idx){ \ _CLC_ELEMENT_CASES##ARGSIZE(x) \ default: return 0; \ } \ } \ #define _CLC_SHUFFLE_SET_ONE_ELEMENT(ARGTYPE, ARGSIZE, INDEX, MASKTYPE) \ ret_val.s##INDEX = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s##INDEX); \ #define _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s0 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s0); \ ret_val.s1 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s1); #define _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s2 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s2); \ ret_val.s3 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s3); #define _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s4 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s4); \ ret_val.s5 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s5); \ ret_val.s6 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s6); \ ret_val.s7 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s7); #define _CLC_SHUFFLE_SET_16_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s8 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s8); \ ret_val.s9 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.s9); \ ret_val.sA = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sA); \ ret_val.sB = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sB); \ ret_val.sC = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sC); \ ret_val.sD = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sD); \ ret_val.sE = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sE); \ ret_val.sF = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, mask.sF); \ #define _CLC_SHUFFLE_DEFINE2(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##2 shuffle(ARGTYPE##ARGSIZE x, MASKTYPE##2 mask){ \ ARGTYPE##2 ret_val; \ mask &= (MASKTYPE##2)(ARGSIZE-1); \ _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE4(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##4 shuffle(ARGTYPE##ARGSIZE x, MASKTYPE##4 mask){ \ ARGTYPE##4 ret_val; \ mask &= (MASKTYPE##4)(ARGSIZE-1); \ _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE8(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##8 shuffle(ARGTYPE##ARGSIZE x, MASKTYPE##8 mask){ \ ARGTYPE##8 ret_val; \ mask &= (MASKTYPE##8)(ARGSIZE-1); \ _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE16(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##16 shuffle(ARGTYPE##ARGSIZE x, MASKTYPE##16 mask){ \ ARGTYPE##16 ret_val; \ mask &= (MASKTYPE##16)(ARGSIZE-1); \ _CLC_SHUFFLE_SET_16_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_VECTOR_SHUFFLE_MASKSIZE(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_GET_ELEMENT_DEFINE(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE2(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE4(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE8(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE16(INTYPE, ARGSIZE, MASKTYPE) \ #define _CLC_VECTOR_SHUFFLE_INSIZE(TYPE, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 2, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 4, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 8, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 16, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_INSIZE(char, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(short, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(int, uint) _CLC_VECTOR_SHUFFLE_INSIZE(long, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(uchar, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(ushort, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(uint, uint) _CLC_VECTOR_SHUFFLE_INSIZE(ulong, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(float, uint) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_VECTOR_SHUFFLE_INSIZE(double, ulong) #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16 : enable _CLC_VECTOR_SHUFFLE_INSIZE(half, ushort) #endif #undef _CLC_ELEMENT_CASES2 #undef _CLC_ELEMENT_CASES4 #undef _CLC_ELEMENT_CASES8 #undef _CLC_ELEMENT_CASES16 #undef _CLC_GET_ELEMENT_DEFINE #undef _CLC_SHUFFLE_SET_ONE_ELEMENT #undef _CLC_SHUFFLE_SET_2_ELEMENTS #undef _CLC_SHUFFLE_SET_4_ELEMENTS #undef _CLC_SHUFFLE_SET_8_ELEMENTS #undef _CLC_SHUFFLE_SET_16_ELEMENTS #undef _CLC_SHUFFLE_DEFINE2 #undef _CLC_SHUFFLE_DEFINE4 #undef _CLC_SHUFFLE_DEFINE8 #undef _CLC_SHUFFLE_DEFINE16 #undef _CLC_VECTOR_SHUFFLE_MASKSIZE #undef _CLC_VECTOR_SHUFFLE_INSIZE ������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/misc/shuffle2.cl�����������������������������������������������0000664�0000000�0000000�00000014225�13251554454�0021530�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������//===-- generic/lib/misc/shuffle2.cl ------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under both the University of Illinois Open Source // License and the MIT license. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include #define _CLC_ELEMENT_CASES2(VAR) \ case 0: return VAR.s0; \ case 1: return VAR.s1; #define _CLC_ELEMENT_CASES4(VAR) \ _CLC_ELEMENT_CASES2(VAR) \ case 2: return VAR.s2; \ case 3: return VAR.s3; #define _CLC_ELEMENT_CASES8(VAR) \ _CLC_ELEMENT_CASES4(VAR) \ case 4: return VAR.s4; \ case 5: return VAR.s5; \ case 6: return VAR.s6; \ case 7: return VAR.s7; #define _CLC_ELEMENT_CASES16(VAR) \ _CLC_ELEMENT_CASES8(VAR) \ case 8: return VAR.s8; \ case 9: return VAR.s9; \ case 10: return VAR.sA; \ case 11: return VAR.sB; \ case 12: return VAR.sC; \ case 13: return VAR.sD; \ case 14: return VAR.sE; \ case 15: return VAR.sF; #define _CLC_GET_ELEMENT_DEFINE(ARGTYPE, ARGSIZE, IDXTYPE) \ __attribute__((always_inline)) \ ARGTYPE __clc_get_el_##ARGTYPE##ARGSIZE##_##IDXTYPE(ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, IDXTYPE idx) {\ if (idx < ARGSIZE) \ switch (idx){ \ _CLC_ELEMENT_CASES##ARGSIZE(x) \ default: return 0; \ } \ else \ switch (idx - ARGSIZE){ \ _CLC_ELEMENT_CASES##ARGSIZE(y) \ default: return 0; \ } \ } \ #define _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s0 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s0); \ ret_val.s1 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s1); #define _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s2 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s2); \ ret_val.s3 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s3); #define _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s4 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s4); \ ret_val.s5 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s5); \ ret_val.s6 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s6); \ ret_val.s7 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s7); #define _CLC_SHUFFLE_SET_16_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ ret_val.s8 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s8); \ ret_val.s9 = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.s9); \ ret_val.sA = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sA); \ ret_val.sB = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sB); \ ret_val.sC = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sC); \ ret_val.sD = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sD); \ ret_val.sE = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sE); \ ret_val.sF = __clc_get_el_##ARGTYPE##ARGSIZE##_##MASKTYPE(x, y, mask.sF); \ #define _CLC_SHUFFLE_DEFINE2(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##2 shuffle2(ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, MASKTYPE##2 mask){ \ ARGTYPE##2 ret_val; \ mask &= (MASKTYPE##2)(ARGSIZE * 2 - 1); \ _CLC_SHUFFLE_SET_2_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE4(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##4 shuffle2(ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, MASKTYPE##4 mask){ \ ARGTYPE##4 ret_val; \ mask &= (MASKTYPE##4)(ARGSIZE * 2 - 1); \ _CLC_SHUFFLE_SET_4_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE8(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##8 shuffle2(ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, MASKTYPE##8 mask){ \ ARGTYPE##8 ret_val; \ mask &= (MASKTYPE##8)(ARGSIZE * 2 - 1); \ _CLC_SHUFFLE_SET_8_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_SHUFFLE_DEFINE16(ARGTYPE, ARGSIZE, MASKTYPE) \ _CLC_DEF _CLC_OVERLOAD ARGTYPE##16 shuffle2(ARGTYPE##ARGSIZE x, ARGTYPE##ARGSIZE y, MASKTYPE##16 mask){ \ ARGTYPE##16 ret_val; \ mask &= (MASKTYPE##16)(ARGSIZE * 2 - 1); \ _CLC_SHUFFLE_SET_16_ELEMENTS(ARGTYPE, ARGSIZE, MASKTYPE) \ return ret_val; \ } #define _CLC_VECTOR_SHUFFLE_MASKSIZE(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_GET_ELEMENT_DEFINE(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE2(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE4(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE8(INTYPE, ARGSIZE, MASKTYPE) \ _CLC_SHUFFLE_DEFINE16(INTYPE, ARGSIZE, MASKTYPE) \ #define _CLC_VECTOR_SHUFFLE_INSIZE(TYPE, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 2, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 4, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 8, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_MASKSIZE(TYPE, 16, MASKTYPE) \ _CLC_VECTOR_SHUFFLE_INSIZE(char, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(short, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(int, uint) _CLC_VECTOR_SHUFFLE_INSIZE(long, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(uchar, uchar) _CLC_VECTOR_SHUFFLE_INSIZE(ushort, ushort) _CLC_VECTOR_SHUFFLE_INSIZE(uint, uint) _CLC_VECTOR_SHUFFLE_INSIZE(ulong, ulong) _CLC_VECTOR_SHUFFLE_INSIZE(float, uint) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_VECTOR_SHUFFLE_INSIZE(double, ulong) #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16 : enable _CLC_VECTOR_SHUFFLE_INSIZE(half, ushort) #endif #undef _CLC_ELEMENT_CASES2 #undef _CLC_ELEMENT_CASES4 #undef _CLC_ELEMENT_CASES8 #undef _CLC_ELEMENT_CASES16 #undef _CLC_GET_ELEMENT_DEFINE #undef _CLC_SHUFFLE_SET_2_ELEMENTS #undef _CLC_SHUFFLE_SET_4_ELEMENTS #undef _CLC_SHUFFLE_SET_8_ELEMENTS #undef _CLC_SHUFFLE_SET_16_ELEMENTS #undef _CLC_SHUFFLE_DEFINE2 #undef _CLC_SHUFFLE_DEFINE4 #undef _CLC_SHUFFLE_DEFINE8 #undef _CLC_SHUFFLE_DEFINE16 #undef _CLC_VECTOR_SHUFFLE_MASKSIZE #undef _CLC_VECTOR_SHUFFLE_INSIZE ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/����������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020665�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/all.cl����������������������������������������������0000664�0000000�0000000�00000002212�13251554454�0021752�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define _CLC_ALL(v) (((v) >> ((sizeof(v) * 8) - 1)) & 0x1) #define _CLC_ALL2(v) (_CLC_ALL((v).s0) & _CLC_ALL((v).s1)) #define _CLC_ALL3(v) (_CLC_ALL2((v)) & _CLC_ALL((v).s2)) #define _CLC_ALL4(v) (_CLC_ALL3((v)) & _CLC_ALL((v).s3)) #define _CLC_ALL8(v) (_CLC_ALL4((v)) & _CLC_ALL((v).s4) & _CLC_ALL((v).s5) \ & _CLC_ALL((v).s6) & _CLC_ALL((v).s7)) #define _CLC_ALL16(v) (_CLC_ALL8((v)) & _CLC_ALL((v).s8) & _CLC_ALL((v).s9) \ & _CLC_ALL((v).sA) & _CLC_ALL((v).sB) \ & _CLC_ALL((v).sC) & _CLC_ALL((v).sD) \ & _CLC_ALL((v).sE) & _CLC_ALL((v).sf)) #define ALL_ID(TYPE) \ _CLC_OVERLOAD _CLC_DEF int all(TYPE v) #define ALL_VECTORIZE(TYPE) \ ALL_ID(TYPE) { return _CLC_ALL(v); } \ ALL_ID(TYPE##2) { return _CLC_ALL2(v); } \ ALL_ID(TYPE##3) { return _CLC_ALL3(v); } \ ALL_ID(TYPE##4) { return _CLC_ALL4(v); } \ ALL_ID(TYPE##8) { return _CLC_ALL8(v); } \ ALL_ID(TYPE##16) { return _CLC_ALL16(v); } ALL_VECTORIZE(char) ALL_VECTORIZE(short) ALL_VECTORIZE(int) ALL_VECTORIZE(long) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/any.cl����������������������������������������������0000664�0000000�0000000�00000002213�13251554454�0021772�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define _CLC_ANY(v) (((v) >> ((sizeof(v) * 8) - 1)) & 0x1) #define _CLC_ANY2(v) (_CLC_ANY((v).s0) | _CLC_ANY((v).s1)) #define _CLC_ANY3(v) (_CLC_ANY2((v)) | _CLC_ANY((v).s2)) #define _CLC_ANY4(v) (_CLC_ANY3((v)) | _CLC_ANY((v).s3)) #define _CLC_ANY8(v) (_CLC_ANY4((v)) | _CLC_ANY((v).s4) | _CLC_ANY((v).s5) \ | _CLC_ANY((v).s6) | _CLC_ANY((v).s7)) #define _CLC_ANY16(v) (_CLC_ANY8((v)) | _CLC_ANY((v).s8) | _CLC_ANY((v).s9) \ | _CLC_ANY((v).sA) | _CLC_ANY((v).sB) \ | _CLC_ANY((v).sC) | _CLC_ANY((v).sD) \ | _CLC_ANY((v).sE) | _CLC_ANY((v).sf)) #define ANY_ID(TYPE) \ _CLC_OVERLOAD _CLC_DEF int any(TYPE v) #define ANY_VECTORIZE(TYPE) \ ANY_ID(TYPE) { return _CLC_ANY(v); } \ ANY_ID(TYPE##2) { return _CLC_ANY2(v); } \ ANY_ID(TYPE##3) { return _CLC_ANY3(v); } \ ANY_ID(TYPE##4) { return _CLC_ANY4(v); } \ ANY_ID(TYPE##8) { return _CLC_ANY8(v); } \ ANY_ID(TYPE##16) { return _CLC_ANY16(v); } ANY_VECTORIZE(char) ANY_VECTORIZE(short) ANY_VECTORIZE(int) ANY_VECTORIZE(long) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/bitselect.cl����������������������������������������0000664�0000000�0000000�00000003736�13251554454�0023174�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "../clcmacro.h" #define __CLC_BODY #include #undef __CLC_BODY #define FLOAT_BITSELECT(f_type, i_type, width) \ _CLC_OVERLOAD _CLC_DEF f_type##width bitselect(f_type##width x, f_type##width y, f_type##width z) { \ return as_##f_type##width(bitselect(as_##i_type##width(x), as_##i_type##width(y), as_##i_type##width(z))); \ } FLOAT_BITSELECT(float, uint, ) FLOAT_BITSELECT(float, uint, 2) FLOAT_BITSELECT(float, uint, 3) FLOAT_BITSELECT(float, uint, 4) FLOAT_BITSELECT(float, uint, 8) FLOAT_BITSELECT(float, uint, 16) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable FLOAT_BITSELECT(double, ulong, ) FLOAT_BITSELECT(double, ulong, 2) FLOAT_BITSELECT(double, ulong, 3) FLOAT_BITSELECT(double, ulong, 4) FLOAT_BITSELECT(double, ulong, 8) FLOAT_BITSELECT(double, ulong, 16) #endif ����������������������������������libclc-0.2.0+git20180312/generic/lib/relational/bitselect.inc���������������������������������������0000664�0000000�0000000�00000002377�13251554454�0023347�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2014,2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE bitselect(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z) { return ((x) ^ ((z) & ((y) ^ (x)))); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isequal.cl������������������������������������������0000664�0000000�0000000�00000001774�13251554454�0022661�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define _CLC_DEFINE_ISEQUAL(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \ return (x == y); \ } \ _CLC_DEFINE_ISEQUAL(int, isequal, float, float) _CLC_DEFINE_ISEQUAL(int2, isequal, float2, float2) _CLC_DEFINE_ISEQUAL(int3, isequal, float3, float3) _CLC_DEFINE_ISEQUAL(int4, isequal, float4, float4) _CLC_DEFINE_ISEQUAL(int8, isequal, float8, float8) _CLC_DEFINE_ISEQUAL(int16, isequal, float16, float16) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isequal(double) returns an int, but the vector versions // return long. _CLC_DEFINE_ISEQUAL(int, isequal, double, double) _CLC_DEFINE_ISEQUAL(long2, isequal, double2, double2) _CLC_DEFINE_ISEQUAL(long3, isequal, double3, double3) _CLC_DEFINE_ISEQUAL(long4, isequal, double4, double4) _CLC_DEFINE_ISEQUAL(long8, isequal, double8, double8) _CLC_DEFINE_ISEQUAL(long16, isequal, double16, double16) #endif #undef _CLC_DEFINE_ISEQUAL����libclc-0.2.0+git20180312/generic/lib/relational/isfinite.cl�����������������������������������������0000664�0000000�0000000�00000000663�13251554454�0023024�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" _CLC_DEFINE_RELATIONAL_UNARY(int, isfinite, __builtin_isfinite, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isfinite(double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isfinite(double x) { return __builtin_isfinite(x); } _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isfinite, double) #endif �����������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isgreater.cl����������������������������������������0000664�0000000�0000000�00000001235�13251554454�0023173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_isgreater with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, isgreater, __builtin_isgreater, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isgreater(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isgreater(double x, double y){ return __builtin_isgreater(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isgreater, double, double) #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isgreaterequal.cl�����������������������������������0000664�0000000�0000000�00000001300�13251554454�0024214�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_isgreaterequal with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, isgreaterequal, __builtin_isgreaterequal, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isgreaterequal(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isgreaterequal(double x, double y){ return __builtin_isgreaterequal(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isgreaterequal, double, double) #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isinf.cl��������������������������������������������0000664�0000000�0000000�00000000641�13251554454�0022316�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" _CLC_DEFINE_RELATIONAL_UNARY(int, isinf, __builtin_isinf, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isinf(double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isinf(double x) { return __builtin_isinf(x); } _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isinf, double) #endif �����������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isless.cl�������������������������������������������0000664�0000000�0000000�00000001210�13251554454�0022501�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_isless with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, isless, __builtin_isless, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isless(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isless(double x, double y){ return __builtin_isless(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isless, double, double) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/islessequal.cl��������������������������������������0000664�0000000�0000000�00000001253�13251554454�0023540�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_islessequal with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, islessequal, __builtin_islessequal, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of islessequal(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int islessequal(double x, double y){ return __builtin_islessequal(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, islessequal, double, double) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/islessgreater.cl������������������������������������0000664�0000000�0000000�00000001271�13251554454�0024062�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_islessgreater with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, islessgreater, __builtin_islessgreater, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of islessgreater(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int islessgreater(double x, double y){ return __builtin_islessgreater(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, islessgreater, double, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isnan.cl��������������������������������������������0000664�0000000�0000000�00000000641�13251554454�0022316�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" _CLC_DEFINE_RELATIONAL_UNARY(int, isnan, __builtin_isnan, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isnan(double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isnan(double x) { return __builtin_isnan(x); } _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isnan, double) #endif �����������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isnormal.cl�����������������������������������������0000664�0000000�0000000�00000000663�13251554454�0023036�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" _CLC_DEFINE_RELATIONAL_UNARY(int, isnormal, __builtin_isnormal, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isnormal(double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isnormal(double x) { return __builtin_isnormal(x); } _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isnormal, double) #endif �����������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isnotequal.cl���������������������������������������0000664�0000000�0000000�00000001254�13251554454�0023373�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" #define _CLC_DEFINE_ISNOTEQUAL(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \ return (x != y); \ } \ _CLC_DEFINE_ISNOTEQUAL(int, isnotequal, float, float) _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(int, isnotequal, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isnotequal(double, double) returns an int, but the vector versions // return long. _CLC_DEFINE_ISNOTEQUAL(int, isnotequal, double, double) _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isnotequal, double, double) #endif #undef _CLC_DEFINE_ISNOTEQUAL ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isordered.cl����������������������������������������0000664�0000000�0000000�00000001271�13251554454�0023166�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" #define _CLC_DEFINE_ISORDERED(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \ return isequal(x, x) && isequal(y, y); \ } \ _CLC_DEFINE_ISORDERED(int, isordered, float, float) _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(int, isordered, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isordered(double, double) returns an int, but the vector versions // return long. _CLC_DEFINE_ISORDERED(int, isordered, double, double) _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isordered, double, double) #endif #undef _CLC_DEFINE_ISORDERED ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/isunordered.cl��������������������������������������0000664�0000000�0000000�00000001253�13251554454�0023531�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" //Note: It would be nice to use __builtin_isunordered with vector inputs, but it seems to only take scalar values as // input, which will produce incorrect output for vector input types. _CLC_DEFINE_RELATIONAL_BINARY(int, isunordered, __builtin_isunordered, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of isunordered(double, double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int isunordered(double x, double y){ return __builtin_isunordered(x, y); } _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isunordered, double, double) #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/relational.h����������������������������������������0000664�0000000�0000000�00000012731�13251554454�0023174�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Contains relational macros that have to return 1 for scalar and -1 for vector * when the result is true. */ #define _CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_NAME, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x){ \ return BUILTIN_NAME(x); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ return (RET_TYPE)( (RET_TYPE){FUNCTION(x.lo), FUNCTION(x.hi)} != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ return (RET_TYPE)( (RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2)} != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3), \ FUNCTION(x.s4), FUNCTION(x.s5), FUNCTION(x.s6), FUNCTION(x.s7) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3), \ FUNCTION(x.s4), FUNCTION(x.s5), FUNCTION(x.s6), FUNCTION(x.s7), \ FUNCTION(x.s8), FUNCTION(x.s9), FUNCTION(x.sa), FUNCTION(x.sb), \ FUNCTION(x.sc), FUNCTION(x.sd), FUNCTION(x.se), FUNCTION(x.sf) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, FUNCTION, ARG_TYPE) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE##2, FUNCTION, ARG_TYPE##2) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE##3, FUNCTION, ARG_TYPE##3) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE##4, FUNCTION, ARG_TYPE##4) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE##8, FUNCTION, ARG_TYPE##8) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE##16, FUNCTION, ARG_TYPE##16) #define _CLC_DEFINE_RELATIONAL_UNARY(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG_TYPE) \ _CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG_TYPE) \ _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(RET_TYPE, FUNCTION, ARG_TYPE) \ #define _CLC_DEFINE_RELATIONAL_BINARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_NAME, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y){ \ return BUILTIN_NAME(x, y); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( (RET_TYPE){FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)} != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC2(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( (RET_TYPE){FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)} != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC3(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( (RET_TYPE){FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2)} != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC4(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2), FUNCTION(x.s3, y.s3) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC8(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2), FUNCTION(x.s3, y.s3), \ FUNCTION(x.s4, y.s4), FUNCTION(x.s5, y.s5), FUNCTION(x.s6, y.s6), FUNCTION(x.s7, y.s7) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC16(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG0_TYPE x, ARG1_TYPE y) { \ return (RET_TYPE)( \ (RET_TYPE){ \ FUNCTION(x.s0, y.s0), FUNCTION(x.s1, y.s1), FUNCTION(x.s2, y.s2), FUNCTION(x.s3, y.s3), \ FUNCTION(x.s4, y.s4), FUNCTION(x.s5, y.s5), FUNCTION(x.s6, y.s6), FUNCTION(x.s7, y.s7), \ FUNCTION(x.s8, y.s8), FUNCTION(x.s9, y.s9), FUNCTION(x.sa, y.sa), FUNCTION(x.sb, y.sb), \ FUNCTION(x.sc, y.sc), FUNCTION(x.sd, y.sd), FUNCTION(x.se, y.se), FUNCTION(x.sf, y.sf) \ } != (RET_TYPE)0); \ } #define _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC2(RET_TYPE##2, FUNCTION, ARG0_TYPE##2, ARG1_TYPE##2) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC3(RET_TYPE##3, FUNCTION, ARG0_TYPE##3, ARG1_TYPE##3) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC4(RET_TYPE##4, FUNCTION, ARG0_TYPE##4, ARG1_TYPE##4) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC8(RET_TYPE##8, FUNCTION, ARG0_TYPE##8, ARG1_TYPE##8) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC16(RET_TYPE##16, FUNCTION, ARG0_TYPE##16, ARG1_TYPE##16) #define _CLC_DEFINE_RELATIONAL_BINARY(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEFINE_RELATIONAL_BINARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG0_TYPE, ARG1_TYPE) \ _CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(RET_TYPE, FUNCTION, ARG0_TYPE, ARG1_TYPE) ���������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/select.cl�������������������������������������������0000664�0000000�0000000�00000000254�13251554454�0022465�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include #define __CLC_BODY #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/select.inc������������������������������������������0000664�0000000�0000000�00000002440�13251554454�0022637�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifdef __CLC_SCALAR #define __CLC_VECSIZE #endif #if __CLC_FPSIZE == 64 #define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE) #elif __CLC_FPSIZE == 32 #define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE) #elif __CLC_FPSIZE == 16 #define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE) #define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE) #endif #ifdef __CLC_FPSIZE #define __CLC_GENSIZE __CLC_FPSIZE #endif #define __CLC_AS_S_GENTYPE __CLC_XCONCAT(as_, __CLC_S_GENTYPE) #define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE) _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z) { #ifdef __CLC_SCALAR return z ? y : x; #else __CLC_S_GENTYPE bitmask = z >> (__CLC_GENSIZE - 1); return __CLC_AS_GENTYPE(bitselect(__CLC_AS_S_GENTYPE(x), __CLC_AS_S_GENTYPE(y), bitmask)); #endif } _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z) { return select(x, y, __CLC_AS_S_GENTYPE(z)); } #undef __CLC_AS_S_GENTYPE #undef __CLC_AS_GENTYPE #ifdef __CLC_FPSIZE #undef __CLC_S_GENTYPE #undef __CLC_U_GENTYPE #undef __CLC_GENSIZE #endif #ifdef __CLC_SCALAR #undef __CLC_VECSIZE #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/relational/signbit.cl������������������������������������������0000664�0000000�0000000�00000000655�13251554454�0022652�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "relational.h" _CLC_DEFINE_RELATIONAL_UNARY(int, signbit, __builtin_signbitf, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable // The scalar version of signbit(double) returns an int, but the vector versions // return long. _CLC_DEF _CLC_OVERLOAD int signbit(double x){ return __builtin_signbit(x); } _CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, signbit, double) #endif �����������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/��������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020001�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/clamp.cl������������������������������������������������0000664�0000000�0000000�00000000230�13251554454�0021410�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include #define __CLC_BODY #include ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/clamp.inc�����������������������������������������������0000664�0000000�0000000�00000000573�13251554454�0021575�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z) { return (x > z ? z : (x < y ? y : x)); } #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE clamp(__CLC_GENTYPE x, __CLC_SCALAR_GENTYPE y, __CLC_SCALAR_GENTYPE z) { return (x > (__CLC_GENTYPE)z ? (__CLC_GENTYPE)z : (x < (__CLC_GENTYPE)y ? (__CLC_GENTYPE)y : x)); } #endif �������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/max.cl��������������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0021104�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/max.inc�������������������������������������������������0000664�0000000�0000000�00000000424�13251554454�0021261�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE max(__CLC_GENTYPE a, __CLC_GENTYPE b) { return (a > b ? a : b); } #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE max(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b) { return (a > (__CLC_GENTYPE)b ? a : (__CLC_GENTYPE)b); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/min.cl��������������������������������������������������0000664�0000000�0000000�00000000224�13251554454�0021102�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define __CLC_BODY #include #define __CLC_BODY #include ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/min.inc�������������������������������������������������0000664�0000000�0000000�00000000424�13251554454�0021257�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_GENTYPE b) { return (b < a ? b : a); } #ifndef __CLC_SCALAR _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b) { return (b < (__CLC_GENTYPE)a ? (__CLC_GENTYPE)b : a); } #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/vload.cl������������������������������������������������0000664�0000000�0000000�00000010251�13251554454�0021425�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #define VLOAD_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \ typedef PRIM_TYPE##2 less_aligned_##ADDR_SPACE##PRIM_TYPE##2 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF PRIM_TYPE##2 vload2(size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \ return *((const ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##2*) (&x[2*offset])); \ } \ \ typedef PRIM_TYPE##3 less_aligned_##ADDR_SPACE##PRIM_TYPE##3 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF PRIM_TYPE##3 vload3(size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \ PRIM_TYPE##2 vec = *((const ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##2*) (&x[3*offset])); \ return (PRIM_TYPE##3)(vec.s0, vec.s1, x[offset*3+2]); \ } \ \ typedef PRIM_TYPE##4 less_aligned_##ADDR_SPACE##PRIM_TYPE##4 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF PRIM_TYPE##4 vload4(size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \ return *((const ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##4*) (&x[4*offset])); \ } \ \ typedef PRIM_TYPE##8 less_aligned_##ADDR_SPACE##PRIM_TYPE##8 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF PRIM_TYPE##8 vload8(size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \ return *((const ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##8*) (&x[8*offset])); \ } \ \ typedef PRIM_TYPE##16 less_aligned_##ADDR_SPACE##PRIM_TYPE##16 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF PRIM_TYPE##16 vload16(size_t offset, const ADDR_SPACE PRIM_TYPE *x) { \ return *((const ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##16*) (&x[16*offset])); \ } \ #define VLOAD_ADDR_SPACES(__CLC_SCALAR_GENTYPE) \ VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __private) \ VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __local) \ VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __constant) \ VLOAD_VECTORIZE(__CLC_SCALAR_GENTYPE, __global) \ #define VLOAD_TYPES() \ VLOAD_ADDR_SPACES(char) \ VLOAD_ADDR_SPACES(uchar) \ VLOAD_ADDR_SPACES(short) \ VLOAD_ADDR_SPACES(ushort) \ VLOAD_ADDR_SPACES(int) \ VLOAD_ADDR_SPACES(uint) \ VLOAD_ADDR_SPACES(long) \ VLOAD_ADDR_SPACES(ulong) \ VLOAD_ADDR_SPACES(float) \ VLOAD_TYPES() #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable VLOAD_ADDR_SPACES(double) #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16 : enable VLOAD_ADDR_SPACES(half) #endif /* vload_half are legal even without cl_khr_fp16 */ /* no vload_half for double */ #if __clang_major__ < 6 float __clc_vload_half_float_helper__constant(const __constant half *); float __clc_vload_half_float_helper__global(const __global half *); float __clc_vload_half_float_helper__local(const __local half *); float __clc_vload_half_float_helper__private(const __private half *); #define VEC_LOAD1(val, AS) val = __clc_vload_half_float_helper##AS (&mem[offset++]); #else #define VEC_LOAD1(val, AS) val = __builtin_load_halff(&mem[offset++]); #endif #define VEC_LOAD2(val, AS) \ VEC_LOAD1(val.lo, AS) \ VEC_LOAD1(val.hi, AS) #define VEC_LOAD3(val, AS) \ VEC_LOAD1(val.s0, AS) \ VEC_LOAD1(val.s1, AS) \ VEC_LOAD1(val.s2, AS) #define VEC_LOAD4(val, AS) \ VEC_LOAD2(val.lo, AS) \ VEC_LOAD2(val.hi, AS) #define VEC_LOAD8(val, AS) \ VEC_LOAD4(val.lo, AS) \ VEC_LOAD4(val.hi, AS) #define VEC_LOAD16(val, AS) \ VEC_LOAD8(val.lo, AS) \ VEC_LOAD8(val.hi, AS) #define __FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \ _CLC_OVERLOAD _CLC_DEF TYPE vload_half##SUFFIX(size_t offset, const AS half *mem) { \ offset *= VEC_SIZE; \ TYPE __tmp; \ VEC_LOAD##VEC_SIZE(__tmp, AS) \ return __tmp; \ } \ _CLC_OVERLOAD _CLC_DEF TYPE vloada_half##SUFFIX(size_t offset, const AS half *mem) { \ offset *= OFFSET_SIZE; \ TYPE __tmp; \ VEC_LOAD##VEC_SIZE(__tmp, AS) \ return __tmp; \ } #define FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) #define __CLC_BODY "vload_half.inc" #include #undef __CLC_BODY #undef FUNC #undef __FUNC #undef VEC_LOAD16 #undef VEC_LOAD8 #undef VEC_LOAD4 #undef VEC_LOAD3 #undef VEC_LOAD2 #undef VEC_LOAD1 #undef VLOAD_TYPES #undef VLOAD_ADDR_SPACES #undef VLOAD_VECTORIZE �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/vload_half.inc������������������������������������������0000664�0000000�0000000�00000001226�13251554454�0022574�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#if __CLC_FPSIZE == 32 #ifdef __CLC_VECSIZE #if __CLC_VECSIZE == 3 # define __CLC_OFFSET 4 #else # define __CLC_OFFSET __CLC_VECSIZE #endif FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private); FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local); FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global); FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __constant); #undef __CLC_OFFSET #else FUNC(, 1, 1, __CLC_GENTYPE, __private); FUNC(, 1, 1, __CLC_GENTYPE, __local); FUNC(, 1, 1, __CLC_GENTYPE, __global); FUNC(, 1, 1, __CLC_GENTYPE, __constant); #endif #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/vstore.cl�����������������������������������������������0000664�0000000�0000000�00000022366�13251554454�0021654�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable #define VSTORE_VECTORIZE(PRIM_TYPE, ADDR_SPACE) \ typedef PRIM_TYPE##2 less_aligned_##ADDR_SPACE##PRIM_TYPE##2 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF void vstore2(PRIM_TYPE##2 vec, size_t offset, ADDR_SPACE PRIM_TYPE *mem) { \ *((ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##2*) (&mem[2*offset])) = vec; \ } \ \ _CLC_OVERLOAD _CLC_DEF void vstore3(PRIM_TYPE##3 vec, size_t offset, ADDR_SPACE PRIM_TYPE *mem) { \ *((ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##2*) (&mem[3*offset])) = (PRIM_TYPE##2)(vec.s0, vec.s1); \ mem[3 * offset + 2] = vec.s2;\ } \ \ typedef PRIM_TYPE##4 less_aligned_##ADDR_SPACE##PRIM_TYPE##4 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF void vstore4(PRIM_TYPE##4 vec, size_t offset, ADDR_SPACE PRIM_TYPE *mem) { \ *((ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##4*) (&mem[4*offset])) = vec; \ } \ \ typedef PRIM_TYPE##8 less_aligned_##ADDR_SPACE##PRIM_TYPE##8 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF void vstore8(PRIM_TYPE##8 vec, size_t offset, ADDR_SPACE PRIM_TYPE *mem) { \ *((ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##8*) (&mem[8*offset])) = vec; \ } \ \ typedef PRIM_TYPE##16 less_aligned_##ADDR_SPACE##PRIM_TYPE##16 __attribute__ ((aligned (sizeof(PRIM_TYPE))));\ _CLC_OVERLOAD _CLC_DEF void vstore16(PRIM_TYPE##16 vec, size_t offset, ADDR_SPACE PRIM_TYPE *mem) { \ *((ADDR_SPACE less_aligned_##ADDR_SPACE##PRIM_TYPE##16*) (&mem[16*offset])) = vec; \ } \ #define VSTORE_ADDR_SPACES(__CLC_SCALAR___CLC_GENTYPE) \ VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __private) \ VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __local) \ VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __global) \ VSTORE_ADDR_SPACES(char) VSTORE_ADDR_SPACES(uchar) VSTORE_ADDR_SPACES(short) VSTORE_ADDR_SPACES(ushort) VSTORE_ADDR_SPACES(int) VSTORE_ADDR_SPACES(uint) VSTORE_ADDR_SPACES(long) VSTORE_ADDR_SPACES(ulong) VSTORE_ADDR_SPACES(float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable VSTORE_ADDR_SPACES(double) #endif #ifdef cl_khr_fp16 #pragma OPENCL EXTENSION cl_khr_fp16 : enable VSTORE_ADDR_SPACES(half) #endif /* vstore_half are legal even without cl_khr_fp16 */ #if __clang_major__ < 6 #define DECLARE_HELPER(STYPE, AS, builtin) void __clc_vstore_half_##STYPE##_helper##AS(STYPE, AS half *); #else #define DECLARE_HELPER(STYPE, AS, __builtin) \ _CLC_DEF void __clc_vstore_half_##STYPE##_helper##AS(STYPE s, AS half *d) \ { \ __builtin(s, d); \ } #endif DECLARE_HELPER(float, __private, __builtin_store_halff); DECLARE_HELPER(float, __global, __builtin_store_halff); DECLARE_HELPER(float, __local, __builtin_store_halff); #ifdef cl_khr_fp64 DECLARE_HELPER(double, __private, __builtin_store_half); DECLARE_HELPER(double, __global, __builtin_store_half); DECLARE_HELPER(double, __local, __builtin_store_half); #endif #define VEC_STORE1(STYPE, AS, val, ROUNDF) __clc_vstore_half_##STYPE##_helper##AS (ROUNDF(val), &mem[offset++]); #define VEC_STORE2(STYPE, AS, val, ROUNDF) \ VEC_STORE1(STYPE, AS, val.lo, ROUNDF) \ VEC_STORE1(STYPE, AS, val.hi, ROUNDF) #define VEC_STORE3(STYPE, AS, val, ROUNDF) \ VEC_STORE1(STYPE, AS, val.s0, ROUNDF) \ VEC_STORE1(STYPE, AS, val.s1, ROUNDF) \ VEC_STORE1(STYPE, AS, val.s2, ROUNDF) #define VEC_STORE4(STYPE, AS, val, ROUNDF) \ VEC_STORE2(STYPE, AS, val.lo, ROUNDF) \ VEC_STORE2(STYPE, AS, val.hi, ROUNDF) #define VEC_STORE8(STYPE, AS, val, ROUNDF) \ VEC_STORE4(STYPE, AS, val.lo, ROUNDF) \ VEC_STORE4(STYPE, AS, val.hi, ROUNDF) #define VEC_STORE16(STYPE, AS, val, ROUNDF) \ VEC_STORE8(STYPE, AS, val.lo, ROUNDF) \ VEC_STORE8(STYPE, AS, val.hi, ROUNDF) #define __FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS, ROUNDF) \ _CLC_OVERLOAD _CLC_DEF void vstore_half##SUFFIX(TYPE vec, size_t offset, AS half *mem) { \ offset *= VEC_SIZE; \ VEC_STORE##VEC_SIZE(STYPE, AS, vec, ROUNDF) \ } \ _CLC_OVERLOAD _CLC_DEF void vstorea_half##SUFFIX(TYPE vec, size_t offset, AS half *mem) { \ offset *= OFFSET; \ VEC_STORE##VEC_SIZE(STYPE, AS, vec, ROUNDF) \ } _CLC_DEF _CLC_OVERLOAD float __clc_noop(float x) { return x; } _CLC_DEF _CLC_OVERLOAD float __clc_rtz(float x) { /* Remove lower 13 bits to make sure the number is rounded down */ int mask = 0xffffe000; const int exp = (as_uint(x) >> 23 & 0xff) - 127; /* Denormals cannot be flushed, and they use different bit for rounding */ if (exp < -14) mask <<= min(-(exp + 14), 10); /* RTZ does not produce Inf for large numbers */ if (fabs(x) > 65504.0f && !isinf(x)) return copysign(65504.0f, x); /* Handle nan corner case */ if (isnan(x)) return x; return as_float(as_uint(x) & mask); } _CLC_DEF _CLC_OVERLOAD float __clc_rti(float x) { const float inf = copysign(INFINITY, x); /* Set lower 13 bits */ int mask = (1 << 13) - 1; const int exp = (as_uint(x) >> 23 & 0xff) - 127; /* Denormals cannot be flushed, and they use different bit for rounding */ if (exp < -14) mask = (1 << (13 + min(-(exp + 14), 10))) - 1; /* Handle nan corner case */ if (isnan(x)) return x; const float next = nextafter(as_float(as_uint(x) | mask), inf); return ((as_uint(x) & mask) == 0) ? x : next; } _CLC_DEF _CLC_OVERLOAD float __clc_rtn(float x) { return ((as_uint(x) & 0x80000000) == 0) ? __clc_rtz(x) : __clc_rti(x); } _CLC_DEF _CLC_OVERLOAD float __clc_rtp(float x) { return ((as_uint(x) & 0x80000000) == 0) ? __clc_rti(x) : __clc_rtz(x); } _CLC_DEF _CLC_OVERLOAD float __clc_rte(float x) { /* Mantisa + implicit bit */ const uint mantissa = (as_uint(x) & 0x7fffff) | (1u << 23); const int exp = (as_uint(x) >> 23 & 0xff) - 127; int shift = 13; if (exp < -14) { /* The default assumes lower 13 bits are rounded, * but it might be more for denormals. * Shifting beyond last == 0b, and qr == 00b is not necessary */ shift += min(-(exp + 14), 15); } int mask = (1 << shift) - 1; const uint grs = mantissa & mask; const uint last = mantissa & (1 << shift); /* IEEE round up rule is: grs > 101b or grs == 100b and last == 1. * exp > 15 should round to inf. */ bool roundup = (grs > (1 << (shift - 1))) || (grs == (1 << (shift - 1)) && last != 0) || (exp > 15); return roundup ? __clc_rti(x) : __clc_rtz(x); } #ifdef cl_khr_fp64 _CLC_DEF _CLC_OVERLOAD double __clc_noop(double x) { return x; } _CLC_DEF _CLC_OVERLOAD double __clc_rtz(double x) { /* Remove lower 42 bits to make sure the number is rounded down */ ulong mask = 0xfffffc0000000000UL; const int exp = (as_ulong(x) >> 52 & 0x7ff) - 1023; /* Denormals cannot be flushed, and they use different bit for rounding */ if (exp < -14) mask <<= min(-(exp + 14), 10); /* RTZ does not produce Inf for large numbers */ if (fabs(x) > 65504.0 && !isinf(x)) return copysign(65504.0, x); /* Handle nan corner case */ if (isnan(x)) return x; return as_double(as_ulong(x) & mask); } _CLC_DEF _CLC_OVERLOAD double __clc_rti(double x) { const double inf = copysign((double)INFINITY, x); /* Set lower 42 bits */ long mask = (1UL << 42UL) - 1UL; const int exp = (as_ulong(x) >> 52 & 0x7ff) - 1023; /* Denormals cannot be flushed, and they use different bit for rounding */ if (exp < -14) mask = (1UL << (42UL + min(-(exp + 14), 10))) - 1; /* Handle nan corner case */ if (isnan(x)) return x; const double next = nextafter(as_double(as_ulong(x) | mask), inf); return ((as_ulong(x) & mask) == 0) ? x : next; } _CLC_DEF _CLC_OVERLOAD double __clc_rtn(double x) { return ((as_ulong(x) & 0x8000000000000000UL) == 0) ? __clc_rtz(x) : __clc_rti(x); } _CLC_DEF _CLC_OVERLOAD double __clc_rtp(double x) { return ((as_ulong(x) & 0x8000000000000000UL) == 0) ? __clc_rti(x) : __clc_rtz(x); } _CLC_DEF _CLC_OVERLOAD double __clc_rte(double x) { /* Mantisa + implicit bit */ const ulong mantissa = (as_ulong(x) & 0xfffffffffffff) | (1UL << 52); const int exp = (as_ulong(x) >> 52 & 0x7ff) - 1023; int shift = 42; if (exp < -14) { /* The default assumes lower 13 bits are rounded, * but it might be more for denormals. * Shifting beyond last == 0b, and qr == 00b is not necessary */ shift += min(-(exp + 14), 15); } ulong mask = (1UL << shift) - 1UL; const ulong grs = mantissa & mask; const ulong last = mantissa & (1UL << shift); /* IEEE round up rule is: grs > 101b or grs == 100b and last == 1. * exp > 15 should round to inf. */ bool roundup = (grs > (1UL << (shift - 1UL))) || (grs == (1UL << (shift - 1UL)) && last != 0) || (exp > 15); return roundup ? __clc_rti(x) : __clc_rtz(x); } #endif #define __XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS) \ __FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS, __clc_noop) \ __FUNC(SUFFIX ## _rtz, VEC_SIZE, OFFSET, TYPE, STYPE, AS, __clc_rtz) \ __FUNC(SUFFIX ## _rtn, VEC_SIZE, OFFSET, TYPE, STYPE, AS, __clc_rtn) \ __FUNC(SUFFIX ## _rtp, VEC_SIZE, OFFSET, TYPE, STYPE, AS, __clc_rtp) \ __FUNC(SUFFIX ## _rte, VEC_SIZE, OFFSET, TYPE, STYPE, AS, __clc_rte) #define FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS) \ __XFUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS) #define __CLC_BODY "vstore_half.inc" #include #undef __CLC_BODY #undef FUNC #undef __XFUNC #undef __FUNC #undef VEC_LOAD16 #undef VEC_LOAD8 #undef VEC_LOAD4 #undef VEC_LOAD3 #undef VEC_LOAD2 #undef VEC_LOAD1 #undef DECLARE_HELPER #undef VSTORE_ADDR_SPACES #undef VSTORE_VECTORIZE ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/shared/vstore_half.inc�����������������������������������������0000664�0000000�0000000�00000001202�13251554454�0023003�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ #ifdef __CLC_VECSIZE #if __CLC_VECSIZE == 3 # define __CLC_OFFSET 4 #else # define __CLC_OFFSET __CLC_VECSIZE #endif FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __private); FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __local); FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __global); #undef __CLC_OFFSET #else FUNC(, 1, 1, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __private); FUNC(, 1, 1, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __local); FUNC(, 1, 1, __CLC_GENTYPE, __CLC_SCALAR_GENTYPE, __global); #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/subnormal_config.cl��������������������������������������������0000664�0000000�0000000�00000002576�13251554454�0022414�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * Copyright (c) 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include "config.h" _CLC_DEF bool __clc_fp16_subnormals_supported() { return false; } _CLC_DEF bool __clc_fp32_subnormals_supported() { return false; } _CLC_DEF bool __clc_fp64_subnormals_supported() { return !__clc_subnormals_disabled(); } ����������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/subnormal_disable.ll�������������������������������������������0000664�0000000�0000000�00000000071�13251554454�0022547�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@__CLC_SUBNORMAL_DISABLE = unnamed_addr constant i1 true �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/subnormal_helper_func.ll���������������������������������������0000664�0000000�0000000�00000000304�13251554454�0023435�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@__CLC_SUBNORMAL_DISABLE = external global i1 define i1 @__clc_subnormals_disabled() #0 { %disable = load i1, i1* @__CLC_SUBNORMAL_DISABLE ret i1 %disable } attributes #0 = { alwaysinline } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/subnormal_use_default.ll���������������������������������������0000664�0000000�0000000�00000000072�13251554454�0023445�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@__CLC_SUBNORMAL_DISABLE = unnamed_addr constant i1 false ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/workitem/������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0020374�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/workitem/get_global_id.cl��������������������������������������0000664�0000000�0000000�00000000241�13251554454�0023464�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_global_id(uint dim) { return get_group_id(dim) * get_local_size(dim) + get_local_id(dim) + get_global_offset(dim); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/generic/lib/workitem/get_global_size.cl������������������������������������0000664�0000000�0000000�00000000166�13251554454�0024050�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_global_size(uint dim) { return get_num_groups(dim)*get_local_size(dim); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/��������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0016753�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/����������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017521�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/SOURCES���������������������������������������������������0000664�0000000�0000000�00000000260�13251554454�0020565�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������mem_fence/fence.cl synchronization/barrier.cl workitem/get_global_id.cl workitem/get_group_id.cl workitem/get_local_id.cl workitem/get_local_size.cl workitem/get_num_groups.cl ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/mem_fence/������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021437�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/mem_fence/fence.cl����������������������������������������0000664�0000000�0000000�00000000604�13251554454�0023037�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF void mem_fence(cl_mem_fence_flags flags) { if (flags & (CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE)) __nvvm_membar_cta(); } // We do not have separate mechanism for read and write fences. _CLC_DEF void read_mem_fence(cl_mem_fence_flags flags) { mem_fence(flags); } _CLC_DEF void write_mem_fence(cl_mem_fence_flags flags) { mem_fence(flags); } ����������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/synchronization/������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0022762�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/synchronization/barrier.cl��������������������������������0000664�0000000�0000000�00000000136�13251554454�0024730�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF void barrier(cl_mem_fence_flags flags) { __syncthreads(); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/�������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021362�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/get_global_id.cl���������������������������������0000664�0000000�0000000�00000000210�13251554454�0024446�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_global_id(uint dim) { return get_group_id(dim) * get_local_size(dim) + get_local_id(dim); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/get_group_id.cl����������������������������������0000664�0000000�0000000�00000000401�13251554454�0024344�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_group_id(uint dim) { switch (dim) { case 0: return __nvvm_read_ptx_sreg_ctaid_x(); case 1: return __nvvm_read_ptx_sreg_ctaid_y(); case 2: return __nvvm_read_ptx_sreg_ctaid_z(); default: return 0; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/get_local_id.cl����������������������������������0000664�0000000�0000000�00000000373�13251554454�0024312�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_local_id(uint dim) { switch (dim) { case 0: return __nvvm_read_ptx_sreg_tid_x(); case 1: return __nvvm_read_ptx_sreg_tid_y(); case 2: return __nvvm_read_ptx_sreg_tid_z(); default: return 0; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/get_local_size.cl��������������������������������0000664�0000000�0000000�00000000400�13251554454�0024657�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_local_size(uint dim) { switch (dim) { case 0: return __nvvm_read_ptx_sreg_ntid_x(); case 1: return __nvvm_read_ptx_sreg_ntid_y(); case 2: return __nvvm_read_ptx_sreg_ntid_z(); default: return 0; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx-nvidiacl/lib/workitem/get_num_groups.cl��������������������������������0000664�0000000�0000000�00000000406�13251554454�0024737�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF size_t get_num_groups(uint dim) { switch (dim) { case 0: return __nvvm_read_ptx_sreg_nctaid_x(); case 1: return __nvvm_read_ptx_sreg_nctaid_y(); case 2: return __nvvm_read_ptx_sreg_nctaid_z(); default: return 0; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/�����������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015164�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/�������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015732�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/SOURCES������������������������������������������������������������0000664�0000000�0000000�00000000022�13251554454�0016772�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������math/nextafter.cl ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/SOURCES_3.9��������������������������������������������������������0000664�0000000�0000000�00000000073�13251554454�0017371�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������shared/vload_half_helpers.ll shared/vstore_half_helpers.ll ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/SOURCES_4.0��������������������������������������������������������0000664�0000000�0000000�00000000073�13251554454�0017361�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������shared/vload_half_helpers.ll shared/vstore_half_helpers.ll ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/SOURCES_5.0��������������������������������������������������������0000664�0000000�0000000�00000000073�13251554454�0017362�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������shared/vload_half_helpers.ll shared/vstore_half_helpers.ll ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/math/��������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0016663�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/math/nextafter.cl��������������������������������������������������0000664�0000000�0000000�00000000467�13251554454�0021212�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include #include "../lib/clcmacro.h" #include _CLC_DEFINE_BINARY_BUILTIN(float, nextafter, __clc_nextafter, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable _CLC_DEFINE_BINARY_BUILTIN(double, nextafter, __clc_nextafter, double, double) #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/shared/������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017200�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/shared/vload_half_helpers.ll���������������������������������������0000664�0000000�0000000�00000001515�13251554454�0023354�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������define float @__clc_vload_half_float_helper__private(half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(0)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__global(half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(1)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__local(half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(3)* %ptr %res = fpext half %data to float ret float %res } define float @__clc_vload_half_float_helper__constant(half addrspace(4)* nocapture %ptr) nounwind alwaysinline { %data = load half, half addrspace(4)* %ptr %res = fpext half %data to float ret float %res } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/ptx/lib/shared/vstore_half_helpers.ll��������������������������������������0000664�0000000�0000000�00000002444�13251554454�0023573�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������define void @__clc_vstore_half_float_helper__private(float %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(0)* %ptr ret void } define void @__clc_vstore_half_float_helper__global(float %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(1)* %ptr ret void } define void @__clc_vstore_half_float_helper__local(float %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc float %data to half store half %res, half addrspace(3)* %ptr ret void } define void @__clc_vstore_half_double_helper__private(double %data, half addrspace(0)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(0)* %ptr ret void } define void @__clc_vstore_half_double_helper__global(double %data, half addrspace(1)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(1)* %ptr ret void } define void @__clc_vstore_half_double_helper__local(double %data, half addrspace(3)* nocapture %ptr) nounwind alwaysinline { %res = fptrunc double %data to half store half %res, half addrspace(3)* %ptr ret void } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/����������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015040�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015606�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/OVERRIDES���������������������������������������������������������0000664�0000000�0000000�00000000000�13251554454�0017061�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/OVERRIDES_3.9�����������������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0017463�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/OVERRIDES_4.0�����������������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0017453�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/OVERRIDES_5.0�����������������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0017454�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/OVERRIDES_6.0�����������������������������������������������������0000664�0000000�0000000�00000000162�13251554454�0017455�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.ll workitem/get_global_size.ll workitem/get_local_size.ll workitem/get_num_groups.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/SOURCES�����������������������������������������������������������0000664�0000000�0000000�00000000333�13251554454�0016653�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.ll workitem/get_global_offset.cl workitem/get_group_id.cl workitem/get_global_size.ll workitem/get_local_id.cl workitem/get_local_size.ll workitem/get_num_groups.ll workitem/get_work_dim.cl �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/SOURCES_3.9�������������������������������������������������������0000664�0000000�0000000�00000001000�13251554454�0017234�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������image/get_image_dim.cl image/get_image_width.cl image/get_image_height.cl image/get_image_depth.cl image/get_image_channel_data_type.cl image/get_image_channel_order.cl image/get_image_attributes_impl.ll image/read_imagef.cl image/read_imagei.cl image/read_imageui.cl image/read_image_impl.ll image/write_imagef.cl image/write_imagei.cl image/write_imageui.cl image/write_image_impl.ll synchronization/barrier_impl.39.ll workitem/get_global_size.39.ll workitem/get_local_size.39.ll workitem/get_num_groups.39.ll libclc-0.2.0+git20180312/r600/lib/SOURCES_4.0�������������������������������������������������������0000664�0000000�0000000�00000000176�13251554454�0017241�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.39.ll workitem/get_global_size.39.ll workitem/get_local_size.39.ll workitem/get_num_groups.39.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/SOURCES_5.0�������������������������������������������������������0000664�0000000�0000000�00000000176�13251554454�0017242�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.39.ll workitem/get_global_size.39.ll workitem/get_local_size.39.ll workitem/get_num_groups.39.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/SOURCES_6.0�������������������������������������������������������0000664�0000000�0000000�00000000176�13251554454�0017243�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������synchronization/barrier_impl.39.ll workitem/get_global_size.39.ll workitem/get_local_size.39.ll workitem/get_num_groups.39.ll ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0016670�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_attributes_impl.ll��������������������������������0000664�0000000�0000000�00000006223�13251554454�0024434�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������%opencl.image2d_t = type opaque %opencl.image3d_t = type opaque declare i32 @llvm.OpenCL.image.get.resource.id.2d( %opencl.image2d_t addrspace(1)*) nounwind readnone declare i32 @llvm.OpenCL.image.get.resource.id.3d( %opencl.image3d_t addrspace(1)*) nounwind readnone declare [3 x i32] @llvm.OpenCL.image.get.size.2d( %opencl.image2d_t addrspace(1)*) nounwind readnone declare [3 x i32] @llvm.OpenCL.image.get.size.3d( %opencl.image3d_t addrspace(1)*) nounwind readnone declare [2 x i32] @llvm.OpenCL.image.get.format.2d( %opencl.image2d_t addrspace(1)*) nounwind readnone declare [2 x i32] @llvm.OpenCL.image.get.format.3d( %opencl.image3d_t addrspace(1)*) nounwind readnone define i32 @__clc_get_image_width_2d( %opencl.image2d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d( %opencl.image2d_t addrspace(1)* %img) %2 = extractvalue [3 x i32] %1, 0 ret i32 %2 } define i32 @__clc_get_image_width_3d( %opencl.image3d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d( %opencl.image3d_t addrspace(1)* %img) %2 = extractvalue [3 x i32] %1, 0 ret i32 %2 } define i32 @__clc_get_image_height_2d( %opencl.image2d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d( %opencl.image2d_t addrspace(1)* %img) %2 = extractvalue [3 x i32] %1, 1 ret i32 %2 } define i32 @__clc_get_image_height_3d( %opencl.image3d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d( %opencl.image3d_t addrspace(1)* %img) %2 = extractvalue [3 x i32] %1, 1 ret i32 %2 } define i32 @__clc_get_image_depth_3d( %opencl.image3d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d( %opencl.image3d_t addrspace(1)* %img) %2 = extractvalue [3 x i32] %1, 2 ret i32 %2 } define i32 @__clc_get_image_channel_data_type_2d( %opencl.image2d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d( %opencl.image2d_t addrspace(1)* %img) %2 = extractvalue [2 x i32] %1, 0 ret i32 %2 } define i32 @__clc_get_image_channel_data_type_3d( %opencl.image3d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d( %opencl.image3d_t addrspace(1)* %img) %2 = extractvalue [2 x i32] %1, 0 ret i32 %2 } define i32 @__clc_get_image_channel_order_2d( %opencl.image2d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d( %opencl.image2d_t addrspace(1)* %img) %2 = extractvalue [2 x i32] %1, 1 ret i32 %2 } define i32 @__clc_get_image_channel_order_3d( %opencl.image3d_t addrspace(1)* nocapture %img) #0 { %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d( %opencl.image3d_t addrspace(1)* %img) %2 = extractvalue [2 x i32] %1, 1 ret i32 %2 } attributes #0 = { nounwind readnone alwaysinline } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_channel_data_type.cl������������������������������0000664�0000000�0000000�00000000631�13251554454�0024653�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL int __clc_get_image_channel_data_type_2d(image2d_t); _CLC_DECL int __clc_get_image_channel_data_type_3d(image3d_t); _CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type(image2d_t image) { return __clc_get_image_channel_data_type_2d(image); } _CLC_OVERLOAD _CLC_DEF int get_image_channel_data_type(image3d_t image) { return __clc_get_image_channel_data_type_3d(image); } �������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_channel_order.cl����������������������������������0000664�0000000�0000000�00000000601�13251554454�0024011�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL int __clc_get_image_channel_order_2d(image2d_t); _CLC_DECL int __clc_get_image_channel_order_3d(image3d_t); _CLC_OVERLOAD _CLC_DEF int get_image_channel_order(image2d_t image) { return __clc_get_image_channel_order_2d(image); } _CLC_OVERLOAD _CLC_DEF int get_image_channel_order(image3d_t image) { return __clc_get_image_channel_order_3d(image); } �������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_depth.cl������������������������������������������0000664�0000000�0000000�00000000263�13251554454�0022316�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL int __clc_get_image_depth_3d(image3d_t); _CLC_OVERLOAD _CLC_DEF int get_image_depth(image3d_t image) { return __clc_get_image_depth_3d(image); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_dim.cl��������������������������������������������0000664�0000000�0000000�00000000505�13251554454�0021762�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_OVERLOAD _CLC_DEF int2 get_image_dim (image2d_t image) { return (int2)(get_image_width(image), get_image_height(image)); } _CLC_OVERLOAD _CLC_DEF int4 get_image_dim (image3d_t image) { return (int4)(get_image_width(image), get_image_height(image), get_image_depth(image), 0); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_height.cl�����������������������������������������0000664�0000000�0000000�00000000527�13251554454�0022465�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL int __clc_get_image_height_2d(image2d_t); _CLC_DECL int __clc_get_image_height_3d(image3d_t); _CLC_OVERLOAD _CLC_DEF int get_image_height(image2d_t image) { return __clc_get_image_height_2d(image); } _CLC_OVERLOAD _CLC_DEF int get_image_height(image3d_t image) { return __clc_get_image_height_3d(image); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/get_image_width.cl������������������������������������������0000664�0000000�0000000�00000000521�13251554454�0022326�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL int __clc_get_image_width_2d(image2d_t); _CLC_DECL int __clc_get_image_width_3d(image3d_t); _CLC_OVERLOAD _CLC_DEF int get_image_width(image2d_t image) { return __clc_get_image_width_2d(image); } _CLC_OVERLOAD _CLC_DEF int get_image_width(image3d_t image) { return __clc_get_image_width_3d(image); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/read_image_impl.ll������������������������������������������0000664�0000000�0000000�00000003516�13251554454�0022324�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������%opencl.image2d_t = type opaque declare <4 x float> @llvm.R600.tex(<4 x float>, i32, i32, i32, i32, i32, i32, i32, i32, i32) readnone declare i32 @llvm.OpenCL.image.get.resource.id.2d( %opencl.image2d_t addrspace(1)*) nounwind readnone declare i32 @llvm.OpenCL.sampler.get.resource.id(i32) readnone define <4 x float> @__clc_v4f_from_v2f(<2 x float> %v) alwaysinline { %e0 = extractelement <2 x float> %v, i32 0 %e1 = extractelement <2 x float> %v, i32 1 %res.0 = insertelement <4 x float> undef, float %e0, i32 0 %res.1 = insertelement <4 x float> %res.0, float %e1, i32 1 %res.2 = insertelement <4 x float> %res.1, float 0.0, i32 2 %res.3 = insertelement <4 x float> %res.2, float 0.0, i32 3 ret <4 x float> %res.3 } define <4 x float> @__clc_read_imagef_tex( %opencl.image2d_t addrspace(1)* nocapture %img, i32 %sampler, <2 x float> %coord) alwaysinline { entry: %coord_v4 = call <4 x float> @__clc_v4f_from_v2f(<2 x float> %coord) %smp_id = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %sampler) %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d( %opencl.image2d_t addrspace(1)* %img) %tex_id = add i32 %img_id, 2 ; First 2 IDs are reserved. %coord_norm = and i32 %sampler, 1 %is_norm = icmp eq i32 %coord_norm, 1 br i1 %is_norm, label %NormCoord, label %UnnormCoord NormCoord: %data.norm = call <4 x float> @llvm.R600.tex( <4 x float> %coord_v4, i32 0, i32 0, i32 0, ; Offset. i32 2, i32 %smp_id, i32 1, i32 1, i32 1, i32 1) ; Normalized coords. ret <4 x float> %data.norm UnnormCoord: %data.unnorm = call <4 x float> @llvm.R600.tex( <4 x float> %coord_v4, i32 0, i32 0, i32 0, ; Offset. i32 %tex_id, i32 %smp_id, i32 0, i32 0, i32 0, i32 0) ; Unnormalized coords. ret <4 x float> %data.unnorm } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/read_imagef.cl����������������������������������������������0000664�0000000�0000000�00000001027�13251554454�0021433�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL float4 __clc_read_imagef_tex(image2d_t, sampler_t, float2); _CLC_OVERLOAD _CLC_DEF float4 read_imagef(image2d_t image, sampler_t sampler, int2 coord) { float2 coord_float = (float2)(coord.x, coord.y); return __clc_read_imagef_tex(image, sampler, coord_float); } _CLC_OVERLOAD _CLC_DEF float4 read_imagef(image2d_t image, sampler_t sampler, float2 coord) { return __clc_read_imagef_tex(image, sampler, coord); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/read_imagei.cl����������������������������������������������0000664�0000000�0000000�00000001326�13251554454�0021440�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL float4 __clc_read_imagef_tex(image2d_t, sampler_t, float2); int4 __clc_reinterpret_v4f_to_v4i(float4 v) { union { int4 v4i; float4 v4f; } res = { .v4f = v}; return res.v4i; } _CLC_OVERLOAD _CLC_DEF int4 read_imagei(image2d_t image, sampler_t sampler, int2 coord) { float2 coord_float = (float2)(coord.x, coord.y); return __clc_reinterpret_v4f_to_v4i( __clc_read_imagef_tex(image, sampler, coord_float)); } _CLC_OVERLOAD _CLC_DEF int4 read_imagei(image2d_t image, sampler_t sampler, float2 coord) { return __clc_reinterpret_v4f_to_v4i( __clc_read_imagef_tex(image, sampler, coord)); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/read_imageui.cl���������������������������������������������0000664�0000000�0000000�00000001345�13251554454�0021626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL float4 __clc_read_imagef_tex(image2d_t, sampler_t, float2); uint4 __clc_reinterpret_v4f_to_v4ui(float4 v) { union { uint4 v4ui; float4 v4f; } res = { .v4f = v}; return res.v4ui; } _CLC_OVERLOAD _CLC_DEF uint4 read_imageui(image2d_t image, sampler_t sampler, int2 coord) { float2 coord_float = (float2)(coord.x, coord.y); return __clc_reinterpret_v4f_to_v4ui( __clc_read_imagef_tex(image, sampler, coord_float)); } _CLC_OVERLOAD _CLC_DEF uint4 read_imageui(image2d_t image, sampler_t sampler, float2 coord) { return __clc_reinterpret_v4f_to_v4ui( __clc_read_imagef_tex(image, sampler, coord)); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/write_image_impl.ll�����������������������������������������0000664�0000000�0000000�00000003415�13251554454�0022541�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������%opencl.image2d_t = type opaque %opencl.image3d_t = type opaque declare i32 @llvm.OpenCL.image.get.resource.id.2d( %opencl.image2d_t addrspace(1)*) nounwind readnone declare i32 @llvm.OpenCL.image.get.resource.id.3d( %opencl.image3d_t addrspace(1)*) nounwind readnone declare void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord, i32 %rat_id) define void @__clc_write_imageui_2d( %opencl.image2d_t addrspace(1)* nocapture %img, <2 x i32> %coord, <4 x i32> %color) #0 { ; Coordinate int2 -> int4. %e0 = extractelement <2 x i32> %coord, i32 0 %e1 = extractelement <2 x i32> %coord, i32 1 %coord.0 = insertelement <4 x i32> undef, i32 %e0, i32 0 %coord.1 = insertelement <4 x i32> %coord.0, i32 %e1, i32 1 %coord.2 = insertelement <4 x i32> %coord.1, i32 0, i32 2 %coord.3 = insertelement <4 x i32> %coord.2, i32 0, i32 3 ; Get RAT ID. %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d( %opencl.image2d_t addrspace(1)* %img) %rat_id = add i32 %img_id, 1 ; Call store intrinsic. call void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord.3, i32 %rat_id) ret void } define void @__clc_write_imagei_2d( %opencl.image2d_t addrspace(1)* nocapture %img, <2 x i32> %coord, <4 x i32> %color) #0 { call void @__clc_write_imageui_2d( %opencl.image2d_t addrspace(1)* nocapture %img, <2 x i32> %coord, <4 x i32> %color) ret void } define void @__clc_write_imagef_2d( %opencl.image2d_t addrspace(1)* nocapture %img, <2 x i32> %coord, <4 x float> %color) #0 { %color.i32 = bitcast <4 x float> %color to <4 x i32> call void @__clc_write_imageui_2d( %opencl.image2d_t addrspace(1)* nocapture %img, <2 x i32> %coord, <4 x i32> %color.i32) ret void } attributes #0 = { alwaysinline } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/write_imagef.cl���������������������������������������������0000664�0000000�0000000�00000000356�13251554454�0021656�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL void __clc_write_imagef_2d(image2d_t image, int2 coord, float4 color); _CLC_OVERLOAD _CLC_DEF void write_imagef(image2d_t image, int2 coord, float4 color) { __clc_write_imagef_2d(image, coord, color); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/write_imagei.cl���������������������������������������������0000664�0000000�0000000�00000000352�13251554454�0021655�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL void __clc_write_imagei_2d(image2d_t image, int2 coord, int4 color); _CLC_OVERLOAD _CLC_DEF void write_imagei(image2d_t image, int2 coord, int4 color) { __clc_write_imagei_2d(image, coord, color); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/image/write_imageui.cl��������������������������������������������0000664�0000000�0000000�00000000357�13251554454�0022047�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DECL void __clc_write_imageui_2d(image2d_t image, int2 coord, uint4 color); _CLC_OVERLOAD _CLC_DEF void write_imageui(image2d_t image, int2 coord, uint4 color) { __clc_write_imageui_2d(image, coord, color); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/synchronization/��������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0021047�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/synchronization/barrier_impl.39.ll��������������������������������0000664�0000000�0000000�00000000700�13251554454�0024276�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare void @llvm.r600.group.barrier() #0 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define void @barrier(i32 %flags) #1 { entry: ; We should call mem_fence here, but that is not implemented for r600 yet tail call void @llvm.r600.group.barrier() ret void } attributes #0 = { nounwind convergent } attributes #1 = { nounwind convergent alwaysinline } ����������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/synchronization/barrier_impl.ll�����������������������������������0000664�0000000�0000000�00000000703�13251554454�0024047�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare void @llvm.r600.group.barrier() #0 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define void @barrier(i32 %flags) #1 { entry: ; We should call mem_fence here, but that is not implemented for r600 yet tail call void @llvm.r600.group.barrier() ret void } attributes #0 = { nounwind convergent } attributes #1 = { nounwind convergent alwaysinline } �������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/���������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0017447�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_global_offset.cl�������������������������������������0000664�0000000�0000000�00000000365�13251554454�0023440�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF uint get_global_offset(uint dim) { __attribute__((address_space(7))) uint * ptr = (__attribute__((address_space(7))) uint *) __builtin_r600_implicitarg_ptr(); if (dim < 3) return ptr[dim + 1]; return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_global_size.39.ll������������������������������������0000664�0000000�0000000�00000001377�13251554454�0023373�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.global.size.x() nounwind readnone declare i32 @llvm.r600.read.global.size.y() nounwind readnone declare i32 @llvm.r600.read.global.size.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.global.size.x() nounwind readnone ret i32 %x y_dim: %y = call i32 @llvm.r600.read.global.size.y() nounwind readnone ret i32 %y z_dim: %z = call i32 @llvm.r600.read.global.size.z() nounwind readnone ret i32 %z default: ret i32 1 } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_global_size.ll���������������������������������������0000664�0000000�0000000�00000001402�13251554454�0023126�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.global.size.x() nounwind readnone declare i32 @llvm.r600.read.global.size.y() nounwind readnone declare i32 @llvm.r600.read.global.size.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.global.size.x() nounwind readnone ret i32 %x y_dim: %y = call i32 @llvm.r600.read.global.size.y() nounwind readnone ret i32 %y z_dim: %z = call i32 @llvm.r600.read.global.size.z() nounwind readnone ret i32 %z default: ret i32 1 } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_group_id.cl������������������������������������������0000664�0000000�0000000�00000000357�13251554454�0022443�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF uint get_group_id(uint dim) { switch(dim) { case 0: return __builtin_r600_read_tgid_x(); case 1: return __builtin_r600_read_tgid_y(); case 2: return __builtin_r600_read_tgid_z(); default: return 1; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_local_id.cl������������������������������������������0000664�0000000�0000000�00000000362�13251554454�0022375�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF uint get_local_id(uint dim) { switch(dim) { case 0: return __builtin_r600_read_tidig_x(); case 1: return __builtin_r600_read_tidig_y(); case 2: return __builtin_r600_read_tidig_z(); default: return 1; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_local_size.39.ll�������������������������������������0000664�0000000�0000000�00000001302�13251554454�0023211�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.local.size.x() nounwind readnone declare i32 @llvm.r600.read.local.size.y() nounwind readnone declare i32 @llvm.r600.read.local.size.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_local_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.local.size.x() ret i32 %x y_dim: %y = call i32 @llvm.r600.read.local.size.y() ret i32 %y z_dim: %z = call i32 @llvm.r600.read.local.size.z() ret i32 %z default: ret i32 1 } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_local_size.ll����������������������������������������0000664�0000000�0000000�00000001305�13251554454�0022762�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.local.size.x() nounwind readnone declare i32 @llvm.r600.read.local.size.y() nounwind readnone declare i32 @llvm.r600.read.local.size.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i32 @get_local_size(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.local.size.x() ret i32 %x y_dim: %y = call i32 @llvm.r600.read.local.size.y() ret i32 %y z_dim: %z = call i32 @llvm.r600.read.local.size.z() ret i32 %z default: ret i32 1 } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_num_groups.39.ll�������������������������������������0000664�0000000�0000000�00000001346�13251554454�0023273�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.ngroups.x() nounwind readnone declare i32 @llvm.r600.read.ngroups.y() nounwind readnone declare i32 @llvm.r600.read.ngroups.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" define i32 @get_num_groups(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.ngroups.x() nounwind readnone ret i32 %x y_dim: %y = call i32 @llvm.r600.read.ngroups.y() nounwind readnone ret i32 %y z_dim: %z = call i32 @llvm.r600.read.ngroups.z() nounwind readnone ret i32 %z default: ret i32 1 } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_num_groups.ll����������������������������������������0000664�0000000�0000000�00000001351�13251554454�0023035�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������declare i32 @llvm.r600.read.ngroups.x() nounwind readnone declare i32 @llvm.r600.read.ngroups.y() nounwind readnone declare i32 @llvm.r600.read.ngroups.z() nounwind readnone target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" define i32 @get_num_groups(i32 %dim) nounwind readnone alwaysinline { switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 2, label %z_dim] x_dim: %x = call i32 @llvm.r600.read.ngroups.x() nounwind readnone ret i32 %x y_dim: %y = call i32 @llvm.r600.read.ngroups.y() nounwind readnone ret i32 %y z_dim: %z = call i32 @llvm.r600.read.ngroups.z() nounwind readnone ret i32 %z default: ret i32 1 } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/r600/lib/workitem/get_work_dim.cl������������������������������������������0000664�0000000�0000000�00000000314�13251554454�0022437�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include _CLC_DEF uint get_work_dim(void) { __attribute__((address_space(7))) uint * ptr = (__attribute__((address_space(7))) uint *) __builtin_r600_implicitarg_ptr(); return ptr[0]; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/����������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015330�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/add_sat.cl������������������������������������������������������������0000664�0000000�0000000�00000000144�13251554454�0017246�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(__global char *a, __global char *b, __global char *c) { *a = add_sat(*b, *c); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/as_type.cl������������������������������������������������������������0000664�0000000�0000000�00000000076�13251554454�0017317�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(int4 *x, float4 *y) { *x = as_int4(*y); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/convert.cl������������������������������������������������������������0000664�0000000�0000000�00000000103�13251554454�0017322�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(int4 *x, float4 *y) { *x = convert_int4(*y); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/cos.cl����������������������������������������������������������������0000664�0000000�0000000�00000000061�13251554454�0016431�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(float4 *f) { *f = cos(*f); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/cross.cl��������������������������������������������������������������0000664�0000000�0000000�00000000073�13251554454�0017001�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(float4 *f) { *f = cross(f[0], f[1]); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/fabs.cl���������������������������������������������������������������0000664�0000000�0000000�00000000061�13251554454�0016560�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(float *f) { *f = fabs(*f); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/get_group_id.cl�������������������������������������������������������0000664�0000000�0000000�00000000070�13251554454�0020314�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void foo(int *i) { i[get_group_id(0)] = 1; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/rsqrt.cl��������������������������������������������������������������0000664�0000000�0000000�00000000210�13251554454�0017014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#pragma OPENCL EXTENSION cl_khr_fp64 : enable __kernel void foo(float4 *x, double4 *y) { x[1] = rsqrt(x[0]); y[1] = rsqrt(y[0]); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/test/subsat.cl�������������������������������������������������������������0000664�0000000�0000000�00000000572�13251554454�0017155�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������__kernel void test_subsat_char(char *a, char x, char y) { *a = sub_sat(x, y); return; } __kernel void test_subsat_uchar(uchar *a, uchar x, uchar y) { *a = sub_sat(x, y); return; } __kernel void test_subsat_long(long *a, long x, long y) { *a = sub_sat(x, y); return; } __kernel void test_subsat_ulong(ulong *a, ulong x, ulong y) { *a = sub_sat(x, y); return; }��������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/utils/���������������������������������������������������������������������0000775�0000000�0000000�00000000000�13251554454�0015511�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������libclc-0.2.0+git20180312/utils/prepare-builtins.cpp�������������������������������������������������0000664�0000000�0000000�00000006623�13251554454�0021511�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#if HAVE_LLVM > 0x0390 #include "llvm/Bitcode/BitcodeReader.h" #include "llvm/Bitcode/BitcodeWriter.h" #else #include "llvm/Bitcode/ReaderWriter.h" #endif #include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Config/llvm-config.h" #include using namespace llvm; static cl::opt InputFilename(cl::Positional, cl::desc(" libclc

libclc

libclc is an open source, BSD/MIT dual licensed implementation of the library requirements of the OpenCL C programming language, as specified by the OpenCL 1.1 Specification. The following sections of the specification impose library requirements:

  • 6.1: Supported Data Types
  • 6.2.3: Explicit Conversions
  • 6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
  • 6.9: Preprocessor Directives and Macros
  • 6.11: Built-in Functions
  • 9.3: Double Precision Floating-Point
  • 9.4: 64-bit Atomics
  • 9.5: Writing to 3D image memory objects
  • 9.6: Half Precision Floating-Point

libclc is intended to be used with the Clang compiler's OpenCL frontend.

libclc is designed to be portable and extensible. To this end, it provides generic implementations of most library requirements, allowing the target to override the generic implementation at the granularity of individual functions.

libclc currently supports the AMDGCN, and R600 and NVPTX targets, but support for more targets is welcome.

Download

svn checkout http://llvm.org/svn/llvm-project/libclc/trunk libclc (ViewVC)
- or -
git clone http://llvm.org/git/libclc.git

Mailing List

libclc-dev@lists.llvm.org (subscribe/unsubscribe, archives)