recipes: add libclc as a local Red Bear OS project (Cat 1)
libclc was vendored at recipes/dev/llvm21/source/libclc/ as a
build artifact of the llvm21 fork. This promoted it from an
implicit Mesa dependency (the CLC bitcode Mesa consumes) to a
first-class local project, mirroring how tlc, redbear-*, cub, etc.
are organized per local/AGENTS.md.
Local layout follows the existing in-house pattern:
recipes/dev/libclc -> ../../local/recipes/dev/libclc
local/recipes/dev/libclc/recipe.toml
local/recipes/dev/libclc/source/ (vendored from llvm-project)
The recipe builds libclc as a host-side CMake project using the
cookbook-sysroot clang21 binary (not the cross-compiler) to compile
OpenCL kernels to .bc bitcode. Output targets are amdgcn, amdgcn-amdhsa,
r600, generic, and spirv — the union that Mesa's clc tool consumes
for the iris/radeonsi/llvmpipe drivers. ptx-nvidiacl and clspv are
excluded because they don't map onto any Mesa hardware driver.
The recipe also wires the cookbook's native-cmake generation with
an override that points CMAKE_C_COMPILER etc. at the cookbook
sysroot's clang-21 binary. This is needed because libclc must
run on the build host (output is bitcode, not a Redox binary),
and the cookbook's default cross-toolchain would link the build
against relibc instead of host glibc.
libclc.pc is installed at usr/lib/pkgconfig/, satisfying Mesa's
dependency('libclc') lookup. The .bc files are installed under
usr/share/clc/, which is what the libclc.pc libexecdir pointer
(libexecdir=<prefix>/share/clc) expects.
This is the prerequisite for re-enabling iris, radeonsi, and the
Intel Vulkan driver in the Mesa recipe (Phase 4-6 of
local/docs/3D-DRIVER-PLAN.md). With libclc available in the
cross-sysroot, mesa's meson '-Dwith_clc -> dependency(libclc)'
resolves and the gallium drivers compile.
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
[package]
|
||||
name = "libclc"
|
||||
# Red Bear OS internal libclc. Upstream is llvm-project's libclc
|
||||
# (https://github.com/llvm/llvm-project/tree/main/libclc). The source
|
||||
# is vendored from the same revision as llvm21 (redox-2025-10-03).
|
||||
# The version follows the Red Bear OS branch per local/AGENTS.md.
|
||||
version = "0.3.1"
|
||||
description = "libclc — Red Bear OS port of the OpenCL C library requirements (amdgcn, r600, spirv, generic targets). Provides the .bc bitcode files Mesa's clc tool consumes for hardware GPU drivers (iris, radeonsi, llvmpipe)."
|
||||
|
||||
[source]
|
||||
# Vendored from the same revision as llvm21 / clang21.
|
||||
git = "https://gitlab.redox-os.org/redox-os/llvm-project.git"
|
||||
upstream = "https://github.com/llvm/llvm-project.git"
|
||||
branch = "redox-2025-10-03"
|
||||
path_in_repo = "libclc"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
# Build depends on the HOST clang (built by clang21) and the
|
||||
# LLVMConfig.cmake (provided by llvm21's install).
|
||||
dependencies = [
|
||||
"clang21",
|
||||
"llvm21",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"clang21.dev",
|
||||
"llvm21.dev",
|
||||
]
|
||||
script = '''
|
||||
DYNAMIC_INIT
|
||||
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
|
||||
# libclc is built with the HOST clang (not the cross-compiler):
|
||||
# it produces .bc bitcode files that are architecture-independent
|
||||
# for the GPU targets Mesa cares about (amdgcn, r600, spirv,
|
||||
# generic). The output is then consumed at runtime by Mesa's clc
|
||||
# tool via the dependency('libclc') pkg-config lookup.
|
||||
|
||||
# Save the cross-compile environment so we can use the HOST
|
||||
# toolchain (Clang) to compile OpenCL kernels to bitcode.
|
||||
_SAVED_LDFLAGS="${LDFLAGS:-}"
|
||||
_SAVED_CFLAGS="${CFLAGS:-}"
|
||||
_SAVED_CXXFLAGS="${CXXFLAGS:-}"
|
||||
_SAVED_CPPFLAGS="${CPPFLAGS:-}"
|
||||
unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS
|
||||
|
||||
# Generate a NATIVE toolchain file. We can't use cookbook_cmake
|
||||
# because that targets the cross sysroot; libclc needs the host.
|
||||
generate_cookbook_cmake_file "${COOKBOOK_HOST_TARGET}" "" "/usr" native_libclc.cmake
|
||||
|
||||
# Override the CMAKE_CXX_COMPILER etc. to point at the HOST clang
|
||||
# that comes from the cookbook sysroot (clang21 build). The cookbook
|
||||
# sysroot contains both the host Clang binary and the LLVM tools
|
||||
# that libclc needs to find via LLVM_DIR.
|
||||
cat >> native_libclc.cmake <<'NATIVE_EOF'
|
||||
set(CMAKE_C_COMPILER "${COOKBOOK_SYSROOT}/bin/clang-21" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER "${COOKBOOK_SYSROOT}/bin/clang-21" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_ASM_COMPILER "${COOKBOOK_SYSROOT}/bin/clang-21" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_AR "${COOKBOOK_SYSROOT}/bin/llvm-ar" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_NM "${COOKBOOK_SYSROOT}/bin/llvm-nm" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_RANLIB "${COOKBOOK_SYSROOT}/bin/llvm-ranlib" CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_C_FLAGS_INIT "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_INIT "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM "BYPASS" CACHE STRING "" FORCE)
|
||||
set(LLVM_DIR "${COOKBOOK_SYSROOT}/lib/cmake/llvm" CACHE PATH "" FORCE)
|
||||
set(LIBCLC_STANDALONE_BUILD TRUE CACHE BOOL "" FORCE)
|
||||
NATIVE_EOF
|
||||
|
||||
# Run cmake with the host-native toolchain. LIBCLC_TARGETS_TO_BUILD
|
||||
# is the list of GPU targets Mesa consumes. Default "all" includes
|
||||
# targets Mesa does not need (ptx-nvidiacl for nvidia, clspv for
|
||||
# Vulkan-SPIR-V path). Restrict to what Mesa's clc tool actually
|
||||
# requires: amdgcn, amdgcn-amdhsa, r600, generic, spirv.
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DCMAKE_TOOLCHAIN_FILE="$(realpath native_libclc.cmake)"
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DLLVM_DIR="${COOKBOOK_SYSROOT}/lib/cmake/llvm"
|
||||
-DLIBCLC_STANDALONE_BUILD=TRUE
|
||||
-DLIBCLC_TARGETS_TO_BUILD="amdgcn;amdgcn-amdhsa;r600;generic;spirv"
|
||||
-DENABLE_RUNTIME_SUBNORMAL=OFF
|
||||
-DCMAKE_INSTALL_PREFIX="${COOKBOOK_STAGE}/usr"
|
||||
-DCMAKE_INSTALL_LIBDIR=lib
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include
|
||||
-DCMAKE_INSTALL_DATADIR=share
|
||||
-DLLVM_TARGETS_TO_BUILD="$ARCH"
|
||||
-G Ninja
|
||||
-Wno-dev
|
||||
)
|
||||
|
||||
# Restore the cross-compile environment (libclc install is the only
|
||||
# step that uses the host toolchain; if subsequent install steps
|
||||
# are added to the recipe, they'd want the cross env).
|
||||
export LDFLAGS="$_SAVED_LDFLAGS"
|
||||
export CFLAGS="$_SAVED_CFLAGS"
|
||||
export CXXFLAGS="$_SAVED_CXXFLAGS"
|
||||
export CPPFLAGS="$_SAVED_CPPFLAGS"
|
||||
|
||||
# Source dir is the path_in_repo subdir of the cloned llvm-project.
|
||||
"${COOKBOOK_CMAKE}" "${COOKBOOK_SOURCE}" "${COOKBOOK_CMAKE_FLAGS[@]}"
|
||||
"${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}"
|
||||
DESTDIR="${COOKBOOK_STAGE}/stage" "${COOKBOOK_NINJA}" install
|
||||
|
||||
# Move installed files from $COOKBOOK_STAGE/stage to $COOKBOOK_STAGE.
|
||||
# The DESTDIR install above places everything under
|
||||
# $COOKBOOK_STAGE/stage; flatten the extra stage dir.
|
||||
if [ -d "${COOKBOOK_STAGE}/stage" ]; then
|
||||
cp -a "${COOKBOOK_STAGE}/stage/." "${COOKBOOK_STAGE}/"
|
||||
rm -rf "${COOKBOOK_STAGE}/stage"
|
||||
fi
|
||||
|
||||
# Mesa's clc tool expects the .bc files at <libexecdir>/clc where
|
||||
# libexecdir is <prefix>/share/clc (per the libclc.pc.in template).
|
||||
# The cmake install above places them at $COOKBOOK_STAGE/usr/share/clc
|
||||
# which is the right path; no further action needed.
|
||||
'''
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
files = [
|
||||
"usr/include/**",
|
||||
]
|
||||
@@ -0,0 +1,486 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libclc VERSION 0.2.0 LANGUAGES CXX C)
|
||||
endif()
|
||||
set(LLVM_SUBPROJECT_TITLE "libclc")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Add path for custom modules
|
||||
list( INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
|
||||
|
||||
set( LIBCLC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
set( LIBCLC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
set( LIBCLC_OBJFILE_DIR ${LIBCLC_BINARY_DIR}/obj.libclc.dir )
|
||||
|
||||
include( AddLibclc )
|
||||
|
||||
include( GNUInstallDirs )
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
# OpenCL libraries
|
||||
opencl/lib/amdgcn-amdhsa/SOURCES;
|
||||
opencl/lib/amdgcn/SOURCES;
|
||||
opencl/lib/clspv/SOURCES;
|
||||
opencl/lib/generic/SOURCES;
|
||||
opencl/lib/ptx-nvidiacl/SOURCES;
|
||||
opencl/lib/r600/SOURCES;
|
||||
opencl/lib/spirv/SOURCES;
|
||||
# CLC internal libraries
|
||||
clc/lib/generic/SOURCES;
|
||||
clc/lib/amdgcn/SOURCES;
|
||||
clc/lib/amdgpu/SOURCES;
|
||||
clc/lib/clspv/SOURCES;
|
||||
clc/lib/r600/SOURCES;
|
||||
clc/lib/spirv/SOURCES;
|
||||
)
|
||||
|
||||
set( LIBCLC_MIN_LLVM 3.9.0 )
|
||||
|
||||
set( LIBCLC_TARGETS_TO_BUILD "all"
|
||||
CACHE STRING "Semicolon-separated list of libclc targets to build, or 'all'." )
|
||||
|
||||
option( ENABLE_RUNTIME_SUBNORMAL "Enable runtime linking of subnormal support." OFF )
|
||||
|
||||
if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||||
# Out-of-tree configuration
|
||||
set( LIBCLC_STANDALONE_BUILD TRUE )
|
||||
|
||||
find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
|
||||
include(AddLLVM)
|
||||
|
||||
message( STATUS "libclc LLVM version: ${LLVM_PACKAGE_VERSION}" )
|
||||
|
||||
if( LLVM_PACKAGE_VERSION VERSION_LESS LIBCLC_MIN_LLVM )
|
||||
message( FATAL_ERROR "libclc needs at least LLVM ${LIBCLC_MIN_LLVM}" )
|
||||
endif()
|
||||
|
||||
# Import required tools
|
||||
if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )
|
||||
foreach( tool IN ITEMS clang llvm-as llvm-link opt )
|
||||
find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )
|
||||
set( ${tool}_exe ${LLVM_TOOL_${tool}} )
|
||||
set( ${tool}_target )
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
# In-tree configuration
|
||||
set( LIBCLC_STANDALONE_BUILD FALSE )
|
||||
|
||||
set( LLVM_PACKAGE_VERSION ${LLVM_VERSION} )
|
||||
|
||||
# Note that we check this later (for both build types) but we can provide a
|
||||
# more useful error message when built in-tree. We assume that LLVM tools are
|
||||
# always available so don't warn here.
|
||||
if( NOT LLVM_RUNTIMES_BUILD AND NOT clang IN_LIST LLVM_ENABLE_PROJECTS )
|
||||
message(FATAL_ERROR "Clang is not enabled, but is required to build libclc in-tree")
|
||||
endif()
|
||||
|
||||
if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )
|
||||
get_host_tool_path( clang CLANG clang_exe clang_target )
|
||||
get_host_tool_path( llvm-as LLVM_AS llvm-as_exe llvm-as_target )
|
||||
get_host_tool_path( llvm-link LLVM_LINK llvm-link_exe llvm-link_target )
|
||||
get_host_tool_path( opt OPT opt_exe opt_target )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )
|
||||
message( WARNING "Using custom LLVM tools to build libclc: "
|
||||
"${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR}, "
|
||||
" ensure the tools are up to date." )
|
||||
# Note - use a differently named variable than LLVM_TOOL_${tool} as above, as
|
||||
# the variable name is used to cache the result of find_program. If we used
|
||||
# the same name, a user wouldn't be able to switch a build between default
|
||||
# and custom tools.
|
||||
foreach( tool IN ITEMS clang llvm-as llvm-link opt )
|
||||
find_program( LLVM_CUSTOM_TOOL_${tool} ${tool}
|
||||
PATHS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )
|
||||
set( ${tool}_exe ${LLVM_CUSTOM_TOOL_${tool}} )
|
||||
set( ${tool}_target )
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach( tool IN ITEMS clang opt llvm-as llvm-link )
|
||||
if( NOT EXISTS "${${tool}_exe}" AND "${tool}_target" STREQUAL "" )
|
||||
message( FATAL_ERROR "libclc toolchain incomplete - missing tool ${tool}!" )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# llvm-spirv is an optional dependency, used to build spirv-* targets.
|
||||
# It may be provided in-tree or externally.
|
||||
if( TARGET llvm-spirv )
|
||||
get_host_tool_path( llvm-spirv LLVM_SPIRV llvm-spirv_exe llvm-spirv_target )
|
||||
else()
|
||||
find_program( LLVM_SPIRV llvm-spirv HINTS ${LLVM_TOOLS_BINARY_DIR} )
|
||||
set( llvm-spirv_exe "${LLVM_SPIRV}" )
|
||||
set( llvm-spirv_target )
|
||||
endif()
|
||||
|
||||
# List of all targets. Note that some are added dynamically below.
|
||||
set( LIBCLC_TARGETS_ALL
|
||||
amdgcn--
|
||||
amdgcn--amdhsa
|
||||
clspv--
|
||||
clspv64--
|
||||
r600--
|
||||
nvptx--
|
||||
nvptx64--
|
||||
nvptx--nvidiacl
|
||||
nvptx64--nvidiacl
|
||||
)
|
||||
|
||||
# mesa3d environment is only available since LLVM 4.0
|
||||
if( LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 4.0.0 )
|
||||
list( APPEND LIBCLC_TARGETS_ALL amdgcn-mesa-mesa3d )
|
||||
endif()
|
||||
|
||||
# spirv-mesa3d and spirv64-mesa3d targets can only be built with the (optional)
|
||||
# llvm-spirv external tool.
|
||||
if( llvm-spirv_exe )
|
||||
list( APPEND LIBCLC_TARGETS_ALL spirv-mesa3d- spirv64-mesa3d- )
|
||||
endif()
|
||||
|
||||
# Verify that the user hasn't requested mesa3d targets without an available
|
||||
# llvm-spirv tool.
|
||||
if( "spirv-mesa3d-" IN_LIST LIBCLC_TARGETS_TO_BUILD OR "spirv64-mesa3d-" IN_LIST LIBCLC_TARGETS_TO_BUILD )
|
||||
if( NOT llvm-spirv_exe )
|
||||
message( FATAL_ERROR "SPIR-V targets requested, but spirv-tools is not installed" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( LIBCLC_TARGETS_TO_BUILD STREQUAL "all" )
|
||||
set( LIBCLC_TARGETS_TO_BUILD ${LIBCLC_TARGETS_ALL} )
|
||||
else()
|
||||
foreach(TARGET_TO_BUILD ${LIBCLC_TARGETS_TO_BUILD})
|
||||
if (NOT ${TARGET_TO_BUILD} IN_LIST LIBCLC_TARGETS_ALL)
|
||||
message ( FATAL_ERROR "Unknown target in LIBCLC_TARGETS_TO_BUILD: \"${TARGET_TO_BUILD}\"\n"
|
||||
"Valid targets are: ${LIBCLC_TARGETS_ALL}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
list( SORT LIBCLC_TARGETS_TO_BUILD )
|
||||
|
||||
# Construct LLVM version define
|
||||
set( LLVM_VERSION_DEFINE "-DHAVE_LLVM=0x${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}" )
|
||||
|
||||
# This needs to be set before any target that needs it
|
||||
# We need to use LLVM_INCLUDE_DIRS here, because if we are linking to an
|
||||
# llvm build directory, this includes $src/llvm/include which is where all the
|
||||
# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.
|
||||
include_directories( ${LLVM_INCLUDE_DIRS} )
|
||||
|
||||
# Setup prepare_builtins tools
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
BitReader
|
||||
BitWriter
|
||||
Core
|
||||
IRReader
|
||||
Support
|
||||
)
|
||||
if( LIBCLC_STANDALONE_BUILD )
|
||||
add_llvm_executable( prepare_builtins utils/prepare-builtins.cpp )
|
||||
set( prepare_builtins_exe prepare_builtins )
|
||||
set( prepare_builtins_target prepare_builtins )
|
||||
else()
|
||||
add_llvm_utility( prepare_builtins utils/prepare-builtins.cpp )
|
||||
setup_host_tool( prepare_builtins PREPARE_BUILTINS prepare_builtins_exe prepare_builtins_target )
|
||||
endif()
|
||||
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
|
||||
# These were not properly reported in early LLVM and we don't need them
|
||||
target_compile_options( prepare_builtins PRIVATE -fno-rtti -fno-exceptions )
|
||||
|
||||
# Setup arch devices
|
||||
set( r600--_devices cedar cypress barts cayman )
|
||||
set( amdgcn--_devices tahiti )
|
||||
set( amdgcn-mesa-mesa3d_devices ${amdgcn--_devices} )
|
||||
set( amdgcn--amdhsa_devices none )
|
||||
set( clspv--_devices none )
|
||||
set( clspv64--_devices none )
|
||||
set( nvptx--_devices none )
|
||||
set( nvptx64--_devices none )
|
||||
set( nvptx--nvidiacl_devices none )
|
||||
set( nvptx64--nvidiacl_devices none )
|
||||
set( spirv-mesa3d-_devices none )
|
||||
set( spirv64-mesa3d-_devices none )
|
||||
|
||||
# Setup aliases
|
||||
set( cedar_aliases palm sumo sumo2 redwood juniper )
|
||||
set( cypress_aliases hemlock )
|
||||
set( barts_aliases turks caicos )
|
||||
set( cayman_aliases aruba )
|
||||
set( tahiti_aliases pitcairn verde oland hainan bonaire kabini kaveri hawaii
|
||||
mullins tonga tongapro iceland carrizo fiji stoney polaris10 polaris11
|
||||
gfx602 gfx705 gfx805
|
||||
gfx900 gfx902 gfx904 gfx906 gfx908 gfx909 gfx90a gfx90c gfx942 gfx950
|
||||
gfx1010 gfx1011 gfx1012 gfx1013
|
||||
gfx1030 gfx1031 gfx1032 gfx1033 gfx1034 gfx1035 gfx1036
|
||||
gfx1100 gfx1101 gfx1102 gfx1103
|
||||
gfx1150 gfx1151 gfx1152 gfx1153
|
||||
gfx1200 gfx1201
|
||||
)
|
||||
|
||||
# pkg-config file
|
||||
configure_file( libclc.pc.in libclc.pc @ONLY )
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig" )
|
||||
|
||||
if( ENABLE_RUNTIME_SUBNORMAL )
|
||||
foreach( file IN ITEMS subnormal_use_default subnormal_disable )
|
||||
link_bc(
|
||||
TARGET ${file}
|
||||
INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/${file}.ll
|
||||
)
|
||||
install(
|
||||
FILES $<TARGET_PROPERTY:${file},TARGET_FILE>
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package( Python3 REQUIRED COMPONENTS Interpreter )
|
||||
file( TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/utils/gen_convert.py script_loc )
|
||||
add_custom_command(
|
||||
OUTPUT convert.cl
|
||||
COMMAND ${Python3_EXECUTABLE} ${script_loc} > convert.cl
|
||||
DEPENDS ${script_loc} )
|
||||
add_custom_target( generate-convert.cl DEPENDS convert.cl )
|
||||
set_target_properties( generate-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT clc-convert.cl
|
||||
COMMAND ${Python3_EXECUTABLE} ${script_loc} --clc > clc-convert.cl
|
||||
DEPENDS ${script_loc} )
|
||||
add_custom_target( generate-clc-convert.cl DEPENDS clc-convert.cl )
|
||||
set_target_properties( generate-clc-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )
|
||||
|
||||
if ( clspv-- IN_LIST LIBCLC_TARGETS_TO_BUILD OR clspv64-- IN_LIST LIBCLC_TARGETS_TO_BUILD )
|
||||
add_custom_command(
|
||||
OUTPUT clspv-convert.cl
|
||||
COMMAND ${Python3_EXECUTABLE} ${script_loc} --clspv > clspv-convert.cl
|
||||
DEPENDS ${script_loc} )
|
||||
add_custom_target( generate-clspv-convert.cl DEPENDS clspv-convert.cl )
|
||||
set_target_properties( generate-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )
|
||||
endif()
|
||||
|
||||
set_source_files_properties(
|
||||
# CLC builtins
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_cos.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_divide.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp10.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp2.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log10.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log2.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_powr.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_recip.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_rsqrt.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_sin.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_sqrt.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_tan.cl
|
||||
# Target-specific CLC builtins
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_exp2.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_exp.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_log10.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/r600/math/clc_native_rsqrt.cl
|
||||
# OpenCL builtins
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_cos.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_divide.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp10.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp2.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log10.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log2.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_powr.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_recip.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_rsqrt.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sin.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sqrt.cl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_tan.cl
|
||||
PROPERTIES COMPILE_OPTIONS -fapprox-func
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
|
||||
foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
|
||||
message( STATUS "libclc target '${t}' is enabled" )
|
||||
string( REPLACE "-" ";" TRIPLE ${t} )
|
||||
list( GET TRIPLE 0 ARCH )
|
||||
list( GET TRIPLE 1 VENDOR )
|
||||
list( GET TRIPLE 2 OS )
|
||||
|
||||
set( opencl_dirs )
|
||||
|
||||
if( ${ARCH} STREQUAL r600 OR ${ARCH} STREQUAL amdgcn )
|
||||
list( APPEND opencl_dirs amdgpu )
|
||||
endif()
|
||||
|
||||
# Some targets' directories alias others
|
||||
if( ${ARCH} STREQUAL nvptx OR ${ARCH} STREQUAL nvptx64 )
|
||||
set( DARCH ptx )
|
||||
elseif( ${ARCH} STREQUAL clspv OR ${ARCH} STREQUAL clspv64 )
|
||||
set( DARCH clspv )
|
||||
elseif( ${ARCH} STREQUAL spirv OR ${ARCH} STREQUAL spirv64 )
|
||||
set( DARCH spirv )
|
||||
elseif( ${ARCH} STREQUAL amdgcn-mesa3d )
|
||||
set( DARCH amdgcn-amdhsa )
|
||||
else()
|
||||
set( DARCH ${ARCH} )
|
||||
endif()
|
||||
|
||||
# Append a variety of target- and triple-based directories to search,
|
||||
# increasing in specificity.
|
||||
list( APPEND opencl_dirs ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS} )
|
||||
|
||||
# The 'generic' directory contains all of the generic implementations of the
|
||||
# builtins. It is included first so it has the lowest search priority,
|
||||
# allowing targets to override builtins based on file names found later in
|
||||
# the list of search directories.
|
||||
# CLC builds all builtins for all targets, so unconditionally prepend the
|
||||
# 'generic' directory.
|
||||
set( clc_dirs generic ${opencl_dirs} )
|
||||
# Some OpenCL targets don't build all builtins, in which case they don't want
|
||||
# the 'generic' directory. Otherwise, prepend the 'generic' directory.
|
||||
if ( NOT ARCH STREQUAL spirv AND NOT ARCH STREQUAL spirv64 AND
|
||||
NOT ARCH STREQUAL clspv AND NOT ARCH STREQUAL clspv64)
|
||||
list( PREPEND opencl_dirs generic )
|
||||
endif()
|
||||
|
||||
set( clc_lib_files )
|
||||
set( clc_gen_files clc-convert.cl )
|
||||
|
||||
libclc_configure_lib_source(
|
||||
clc_lib_files
|
||||
LIB_ROOT_DIR clc
|
||||
DIRS ${clc_dirs}
|
||||
)
|
||||
|
||||
set( opencl_lib_files )
|
||||
set( opencl_gen_files )
|
||||
|
||||
if( NOT ARCH STREQUAL spirv AND NOT ARCH STREQUAL spirv64 )
|
||||
if( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )
|
||||
list( APPEND opencl_gen_files clspv-convert.cl )
|
||||
else()
|
||||
list( APPEND opencl_gen_files convert.cl )
|
||||
if ( NOT ENABLE_RUNTIME_SUBNORMAL )
|
||||
list( APPEND opencl_lib_files opencl/lib/generic/subnormal_use_default.ll )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
libclc_configure_lib_source(
|
||||
opencl_lib_files
|
||||
LIB_ROOT_DIR opencl
|
||||
DIRS ${opencl_dirs}
|
||||
)
|
||||
|
||||
foreach( d ${${t}_devices} )
|
||||
get_libclc_device_info(
|
||||
TRIPLE ${t}
|
||||
DEVICE ${d}
|
||||
CPU cpu
|
||||
ARCH_SUFFIX arch_suffix
|
||||
CLANG_TRIPLE clang_triple
|
||||
)
|
||||
|
||||
message( STATUS " device: ${d} ( ${${d}_aliases} )" )
|
||||
|
||||
if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )
|
||||
set( build_flags -O0 -finline-hint-functions -DCLC_SPIRV )
|
||||
set( opt_flags )
|
||||
set( spvflags --spirv-max-version=1.1 )
|
||||
set( MACRO_ARCH SPIRV32 )
|
||||
if( ARCH STREQUAL spirv64 )
|
||||
set( MACRO_ARCH SPIRV64 )
|
||||
endif()
|
||||
elseif( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )
|
||||
set( build_flags "-Wno-unknown-assumption" -DCLC_CLSPV )
|
||||
set( opt_flags -O3 )
|
||||
set( MACRO_ARCH CLSPV32 )
|
||||
if( ARCH STREQUAL clspv64 )
|
||||
set( MACRO_ARCH CLSPV64 )
|
||||
endif()
|
||||
else()
|
||||
set( build_flags )
|
||||
set( opt_flags -O3 )
|
||||
set( MACRO_ARCH ${ARCH} )
|
||||
endif()
|
||||
|
||||
set( LIBCLC_ARCH_OBJFILE_DIR "${LIBCLC_OBJFILE_DIR}/${arch_suffix}" )
|
||||
file( MAKE_DIRECTORY ${LIBCLC_ARCH_OBJFILE_DIR} )
|
||||
|
||||
# Build for OpenCL 3.0 independently of the target or device.
|
||||
list( APPEND build_flags -cl-std=CL3.0 )
|
||||
|
||||
string( TOUPPER "CLC_${MACRO_ARCH}" CLC_TARGET_DEFINE )
|
||||
|
||||
list( APPEND build_flags
|
||||
-D${CLC_TARGET_DEFINE}
|
||||
# All libclc builtin libraries see CLC headers
|
||||
-I${CMAKE_CURRENT_SOURCE_DIR}/clc/include
|
||||
# Error on undefined macros
|
||||
-Werror=undef
|
||||
)
|
||||
|
||||
if( NOT "${cpu}" STREQUAL "" )
|
||||
list( APPEND build_flags -mcpu=${cpu} )
|
||||
endif()
|
||||
|
||||
# Generic address space support.
|
||||
# Note: when declaring builtins, we must consider that even if a target
|
||||
# formally/nominally supports the generic address space, in practice that
|
||||
# target may map it to the same target address space as another address
|
||||
# space (often the private one). In such cases we must be careful not to
|
||||
# multiply-define a builtin in a single target address space, as it would
|
||||
# result in a mangling clash.
|
||||
# For this reason we must consider the target support of the generic
|
||||
# address space separately from the *implementation* decision about whether
|
||||
# to declare certain builtins in that address space.
|
||||
# Note: we assume that if there is no distinct generic address space, it
|
||||
# maps to the private address space.
|
||||
set ( private_addrspace_val 0 )
|
||||
set ( generic_addrspace_val 0 )
|
||||
if( ARCH STREQUAL amdgcn OR ARCH STREQUAL r600 OR ARCH STREQUAL amdgcn-amdhsa )
|
||||
set ( private_addrspace_val 5 )
|
||||
endif()
|
||||
if( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
|
||||
set ( generic_addrspace_val 4 )
|
||||
endif()
|
||||
list( APPEND build_flags
|
||||
-D__CLC_PRIVATE_ADDRSPACE_VAL=${private_addrspace_val}
|
||||
-D__CLC_GENERIC_ADDRSPACE_VAL=${generic_addrspace_val}
|
||||
)
|
||||
|
||||
set( clc_build_flags ${build_flags} -DCLC_INTERNAL )
|
||||
|
||||
add_libclc_builtin_set(
|
||||
CLC_INTERNAL
|
||||
ARCH ${ARCH}
|
||||
ARCH_SUFFIX clc-${arch_suffix}
|
||||
TRIPLE ${clang_triple}
|
||||
COMPILE_FLAGS ${clc_build_flags}
|
||||
OPT_FLAGS ${opt_flags}
|
||||
LIB_FILES ${clc_lib_files}
|
||||
GEN_FILES ${clc_gen_files}
|
||||
)
|
||||
|
||||
list( APPEND build_flags
|
||||
-I${CMAKE_CURRENT_SOURCE_DIR}/opencl/include
|
||||
)
|
||||
|
||||
add_libclc_builtin_set(
|
||||
ARCH ${ARCH}
|
||||
ARCH_SUFFIX ${arch_suffix}
|
||||
TRIPLE ${clang_triple}
|
||||
COMPILE_FLAGS ${build_flags}
|
||||
OPT_FLAGS ${opt_flags}
|
||||
LIB_FILES ${opencl_lib_files}
|
||||
GEN_FILES ${opencl_gen_files}
|
||||
ALIASES ${${d}_aliases}
|
||||
# Link in the CLC builtins and internalize their symbols
|
||||
INTERNAL_LINK_DEPENDENCIES builtins.link.clc-${arch_suffix}
|
||||
)
|
||||
endforeach( d )
|
||||
endforeach( t )
|
||||
@@ -0,0 +1,2 @@
|
||||
N: Peter Collingbourne
|
||||
E: peter@pcc.me.uk
|
||||
@@ -0,0 +1,299 @@
|
||||
==============================================================================
|
||||
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
||||
==============================================================================
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into an Object form of such source code, you
|
||||
may redistribute such embedded portions in such Object form without complying
|
||||
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||
|
||||
In addition, if you combine or link compiled forms of this Software with
|
||||
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||
court of competent jurisdiction determines that the patent provision (Section
|
||||
3), the indemnity provision (Section 9) or other Section of the License
|
||||
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||
the License, but only in their entirety and only with respect to the Combined
|
||||
Software.
|
||||
|
||||
==============================================================================
|
||||
Software from third parties included in the LLVM Project:
|
||||
==============================================================================
|
||||
The LLVM Project contains third party software which is under different license
|
||||
terms. All such code will be identified clearly using at least one of two
|
||||
mechanisms:
|
||||
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
||||
`LICENSE` file at the top containing the specific license and restrictions
|
||||
which apply to that software, or
|
||||
2) It will contain specific license and restriction terms at the top of every
|
||||
file.
|
||||
|
||||
==============================================================================
|
||||
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
||||
==============================================================================
|
||||
|
||||
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-2019 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.
|
||||
@@ -0,0 +1,17 @@
|
||||
# libclc Maintainers
|
||||
|
||||
This file is a list of the
|
||||
[maintainers](https://llvm.org/docs/DeveloperPolicy.html#maintainers) for
|
||||
libclc.
|
||||
|
||||
## Current Maintainers
|
||||
|
||||
The following people are the active maintainers for the project. Please reach
|
||||
out to them for code reviews, questions about their area of expertise, or other
|
||||
assistance.
|
||||
|
||||
Fraser Cormack \
|
||||
fraser@codeplay.com (email), [frasercrmck](https://github.com/frasercrmck) (GitHub)
|
||||
|
||||
Tom Stellard \
|
||||
tstellar@redhat.com (email), [tstellar](https://github.com/tstellar) (GitHub)
|
||||
@@ -0,0 +1,67 @@
|
||||
# libclc
|
||||
|
||||
libclc is an open source 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 PTX, AMDGPU, SPIRV and CLSPV targets, but support for
|
||||
more targets is welcome.
|
||||
|
||||
## Compiling and installing
|
||||
|
||||
(in the following instructions you can use `make` or `ninja`)
|
||||
|
||||
For an in-tree build, Clang must also be built at the same time:
|
||||
```
|
||||
$ cmake <path-to>/llvm-project/llvm/CMakeLists.txt -DLLVM_ENABLE_PROJECTS="libclc;clang" \
|
||||
-DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
$ ninja
|
||||
```
|
||||
Then install:
|
||||
```
|
||||
$ ninja install
|
||||
```
|
||||
Note you can use the `DESTDIR` Makefile variable to do staged installs.
|
||||
```
|
||||
$ DESTDIR=/path/for/staged/install ninja install
|
||||
```
|
||||
To build out of tree, or in other words, against an existing LLVM build or install:
|
||||
```
|
||||
$ cmake <path-to>/llvm-project/libclc/CMakeLists.txt -DCMAKE_BUILD_TYPE=Release \
|
||||
-G Ninja -DLLVM_DIR=$(<path-to>/llvm-config --cmakedir)
|
||||
$ ninja
|
||||
```
|
||||
Then install as before.
|
||||
|
||||
In both cases this will include all supported targets. You can choose which
|
||||
targets are enabled by passing `-DLIBCLC_TARGETS_TO_BUILD` to CMake. The default
|
||||
is `all`.
|
||||
|
||||
In both cases, the LLVM used must include the targets you want libclc support for
|
||||
(`AMDGPU` and `NVPTX` are enabled in LLVM by default). Apart from `SPIRV` where you do
|
||||
not need an LLVM target but you do need the
|
||||
[llvm-spirv tool](https://github.com/KhronosGroup/SPIRV-LLVM-Translator) available.
|
||||
Either build this in-tree, or place it in the directory pointed to by
|
||||
`LLVM_TOOLS_BINARY_DIR`.
|
||||
|
||||
## Website
|
||||
|
||||
https://libclc.llvm.org/
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILE=$1
|
||||
BIN_DIR=$2
|
||||
if [ ! -f $FILE ]; then
|
||||
echo "ERROR: Not a file: $FILE"
|
||||
exit 3
|
||||
fi
|
||||
ret=0
|
||||
|
||||
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
|
||||
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_ASYNC_CLC_PREFETCH_H__
|
||||
#define __CLC_ASYNC_CLC_PREFETCH_H__
|
||||
|
||||
#define __CLC_BODY <clc/async/clc_prefetch.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#define __CLC_BODY <clc/async/clc_prefetch.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#endif // __CLC_ASYNC_CLC_PREFETCH_H__
|
||||
@@ -0,0 +1,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL void __clc_prefetch(const global __CLC_GENTYPE *p,
|
||||
size_t num_gentypes);
|
||||
@@ -0,0 +1,90 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_CLC_AS_TYPE_H__
|
||||
#define __CLC_CLC_AS_TYPE_H__
|
||||
|
||||
#define __clc_as_char(x) __builtin_astype(x, char)
|
||||
#define __clc_as_uchar(x) __builtin_astype(x, uchar)
|
||||
#define __clc_as_short(x) __builtin_astype(x, short)
|
||||
#define __clc_as_ushort(x) __builtin_astype(x, ushort)
|
||||
#define __clc_as_int(x) __builtin_astype(x, int)
|
||||
#define __clc_as_uint(x) __builtin_astype(x, uint)
|
||||
#define __clc_as_long(x) __builtin_astype(x, long)
|
||||
#define __clc_as_ulong(x) __builtin_astype(x, ulong)
|
||||
#define __clc_as_float(x) __builtin_astype(x, float)
|
||||
|
||||
#define __clc_as_char2(x) __builtin_astype(x, char2)
|
||||
#define __clc_as_uchar2(x) __builtin_astype(x, uchar2)
|
||||
#define __clc_as_short2(x) __builtin_astype(x, short2)
|
||||
#define __clc_as_ushort2(x) __builtin_astype(x, ushort2)
|
||||
#define __clc_as_int2(x) __builtin_astype(x, int2)
|
||||
#define __clc_as_uint2(x) __builtin_astype(x, uint2)
|
||||
#define __clc_as_long2(x) __builtin_astype(x, long2)
|
||||
#define __clc_as_ulong2(x) __builtin_astype(x, ulong2)
|
||||
#define __clc_as_float2(x) __builtin_astype(x, float2)
|
||||
|
||||
#define __clc_as_char3(x) __builtin_astype(x, char3)
|
||||
#define __clc_as_uchar3(x) __builtin_astype(x, uchar3)
|
||||
#define __clc_as_short3(x) __builtin_astype(x, short3)
|
||||
#define __clc_as_ushort3(x) __builtin_astype(x, ushort3)
|
||||
#define __clc_as_int3(x) __builtin_astype(x, int3)
|
||||
#define __clc_as_uint3(x) __builtin_astype(x, uint3)
|
||||
#define __clc_as_long3(x) __builtin_astype(x, long3)
|
||||
#define __clc_as_ulong3(x) __builtin_astype(x, ulong3)
|
||||
#define __clc_as_float3(x) __builtin_astype(x, float3)
|
||||
|
||||
#define __clc_as_char4(x) __builtin_astype(x, char4)
|
||||
#define __clc_as_uchar4(x) __builtin_astype(x, uchar4)
|
||||
#define __clc_as_short4(x) __builtin_astype(x, short4)
|
||||
#define __clc_as_ushort4(x) __builtin_astype(x, ushort4)
|
||||
#define __clc_as_int4(x) __builtin_astype(x, int4)
|
||||
#define __clc_as_uint4(x) __builtin_astype(x, uint4)
|
||||
#define __clc_as_long4(x) __builtin_astype(x, long4)
|
||||
#define __clc_as_ulong4(x) __builtin_astype(x, ulong4)
|
||||
#define __clc_as_float4(x) __builtin_astype(x, float4)
|
||||
|
||||
#define __clc_as_char8(x) __builtin_astype(x, char8)
|
||||
#define __clc_as_uchar8(x) __builtin_astype(x, uchar8)
|
||||
#define __clc_as_short8(x) __builtin_astype(x, short8)
|
||||
#define __clc_as_ushort8(x) __builtin_astype(x, ushort8)
|
||||
#define __clc_as_int8(x) __builtin_astype(x, int8)
|
||||
#define __clc_as_uint8(x) __builtin_astype(x, uint8)
|
||||
#define __clc_as_long8(x) __builtin_astype(x, long8)
|
||||
#define __clc_as_ulong8(x) __builtin_astype(x, ulong8)
|
||||
#define __clc_as_float8(x) __builtin_astype(x, float8)
|
||||
|
||||
#define __clc_as_char16(x) __builtin_astype(x, char16)
|
||||
#define __clc_as_uchar16(x) __builtin_astype(x, uchar16)
|
||||
#define __clc_as_short16(x) __builtin_astype(x, short16)
|
||||
#define __clc_as_ushort16(x) __builtin_astype(x, ushort16)
|
||||
#define __clc_as_int16(x) __builtin_astype(x, int16)
|
||||
#define __clc_as_uint16(x) __builtin_astype(x, uint16)
|
||||
#define __clc_as_long16(x) __builtin_astype(x, long16)
|
||||
#define __clc_as_ulong16(x) __builtin_astype(x, ulong16)
|
||||
#define __clc_as_float16(x) __builtin_astype(x, float16)
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#define __clc_as_double(x) __builtin_astype(x, double)
|
||||
#define __clc_as_double2(x) __builtin_astype(x, double2)
|
||||
#define __clc_as_double3(x) __builtin_astype(x, double3)
|
||||
#define __clc_as_double4(x) __builtin_astype(x, double4)
|
||||
#define __clc_as_double8(x) __builtin_astype(x, double8)
|
||||
#define __clc_as_double16(x) __builtin_astype(x, double16)
|
||||
#endif
|
||||
|
||||
#ifdef cl_khr_fp16
|
||||
#define __clc_as_half(x) __builtin_astype(x, half)
|
||||
#define __clc_as_half2(x) __builtin_astype(x, half2)
|
||||
#define __clc_as_half3(x) __builtin_astype(x, half3)
|
||||
#define __clc_as_half4(x) __builtin_astype(x, half4)
|
||||
#define __clc_as_half8(x) __builtin_astype(x, half8)
|
||||
#define __clc_as_half16(x) __builtin_astype(x, half16)
|
||||
#endif
|
||||
|
||||
#endif // __CLC_CLC_AS_TYPE_H__
|
||||
@@ -0,0 +1,108 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_CLC_CONVERT_H__
|
||||
#define __CLC_CLC_CONVERT_H__
|
||||
|
||||
#include <clc/clcmacro.h>
|
||||
|
||||
#define _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
|
||||
_CLC_OVERLOAD _CLC_DECL TO_TYPE __clc_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)
|
||||
|
||||
#if defined(cl_khr_fp64) && defined(cl_khr_fp16)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, half, SUFFIX)
|
||||
#elif defined(cl_khr_fp64)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
|
||||
#elif defined(cl_khr_fp16)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, half, 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)
|
||||
|
||||
#if defined(cl_khr_fp64) && defined(cl_khr_fp16)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_TO1(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(double, SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(half, SUFFIX)
|
||||
#elif defined(cl_khr_fp64)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_TO1(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
|
||||
#elif defined(cl_khr_fp16)
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_TO1(SUFFIX) \
|
||||
_CLC_VECTOR_CONVERT_FROM(half, 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()
|
||||
|
||||
#undef _CLC_VECTOR_CONVERT_TO_SUFFIX
|
||||
#undef _CLC_VECTOR_CONVERT_TO
|
||||
#undef _CLC_VECTOR_CONVERT_TO1
|
||||
#undef _CLC_VECTOR_CONVERT_FROM
|
||||
#undef _CLC_VECTOR_CONVERT_FROM1
|
||||
#undef _CLC_VECTOR_CONVERT_DECL
|
||||
#undef _CLC_CONVERT_DECL
|
||||
|
||||
#endif // __CLC_CLC_CONVERT_H__
|
||||
@@ -0,0 +1,40 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_CLCFUNC_H_
|
||||
#define __CLC_CLCFUNC_H_
|
||||
|
||||
#define _CLC_OVERLOAD __attribute__((overloadable))
|
||||
#define _CLC_DECL
|
||||
#define _CLC_INLINE __attribute__((always_inline)) inline
|
||||
|
||||
// avoid inlines for SPIR-V related targets since we'll optimise later in the
|
||||
// chain
|
||||
#if defined(CLC_SPIRV)
|
||||
#define _CLC_DEF
|
||||
#elif defined(CLC_CLSPV)
|
||||
#define _CLC_DEF __attribute__((noinline)) __attribute__((clspv_libclc_builtin))
|
||||
#else
|
||||
#define _CLC_DEF __attribute__((always_inline))
|
||||
#endif
|
||||
|
||||
#if __OPENCL_C_VERSION__ == CL_VERSION_2_0 || \
|
||||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && \
|
||||
defined(__opencl_c_generic_address_space))
|
||||
#define _CLC_GENERIC_AS_SUPPORTED 1
|
||||
#if __CLC_PRIVATE_ADDRSPACE_VAL != __CLC_GENERIC_ADDRSPACE_VAL
|
||||
#define _CLC_DISTINCT_GENERIC_AS_SUPPORTED 1
|
||||
#else
|
||||
#define _CLC_DISTINCT_GENERIC_AS_SUPPORTED 0
|
||||
#endif
|
||||
#else
|
||||
#define _CLC_GENERIC_AS_SUPPORTED 0
|
||||
#define _CLC_DISTINCT_GENERIC_AS_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#endif // __CLC_CLCFUNC_H_
|
||||
@@ -0,0 +1,69 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_CLCMACRO_H__
|
||||
#define __CLC_CLCMACRO_H__
|
||||
|
||||
#include <clc/internal/clc.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define _CLC_V_V_VP_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, \
|
||||
ADDR_SPACE, ARG2_TYPE) \
|
||||
DECLSPEC __CLC_XCONCAT(RET_TYPE, 2) \
|
||||
FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 2) x, \
|
||||
ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 2) * y) { \
|
||||
ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \
|
||||
return (__CLC_XCONCAT(RET_TYPE, 2))(FUNCTION(x.s0, ptr), \
|
||||
FUNCTION(x.s1, ptr + 1)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC __CLC_XCONCAT(RET_TYPE, 3) \
|
||||
FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 3) x, \
|
||||
ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 3) * y) { \
|
||||
ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \
|
||||
return (__CLC_XCONCAT(RET_TYPE, 3))(FUNCTION(x.s0, ptr), \
|
||||
FUNCTION(x.s1, ptr + 1), \
|
||||
FUNCTION(x.s2, ptr + 2)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC __CLC_XCONCAT(RET_TYPE, 4) \
|
||||
FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 4) x, \
|
||||
ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 4) * y) { \
|
||||
ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \
|
||||
return (__CLC_XCONCAT(RET_TYPE, 4))( \
|
||||
FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
|
||||
FUNCTION(x.s3, ptr + 3)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC __CLC_XCONCAT(RET_TYPE, 8) \
|
||||
FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 8) x, \
|
||||
ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 8) * y) { \
|
||||
ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \
|
||||
return (__CLC_XCONCAT(RET_TYPE, 8))( \
|
||||
FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
|
||||
FUNCTION(x.s3, ptr + 3), FUNCTION(x.s4, ptr + 4), \
|
||||
FUNCTION(x.s5, ptr + 5), FUNCTION(x.s6, ptr + 6), \
|
||||
FUNCTION(x.s7, ptr + 7)); \
|
||||
} \
|
||||
\
|
||||
DECLSPEC __CLC_XCONCAT(RET_TYPE, 16) \
|
||||
FUNCTION(__CLC_XCONCAT(ARG1_TYPE, 16) x, \
|
||||
ADDR_SPACE __CLC_XCONCAT(ARG2_TYPE, 16) * y) { \
|
||||
ADDR_SPACE ARG2_TYPE *ptr = (ADDR_SPACE ARG2_TYPE *)y; \
|
||||
return (__CLC_XCONCAT(RET_TYPE, 16))( \
|
||||
FUNCTION(x.s0, ptr), FUNCTION(x.s1, ptr + 1), FUNCTION(x.s2, ptr + 2), \
|
||||
FUNCTION(x.s3, ptr + 3), FUNCTION(x.s4, ptr + 4), \
|
||||
FUNCTION(x.s5, ptr + 5), FUNCTION(x.s6, ptr + 6), \
|
||||
FUNCTION(x.s7, ptr + 7), FUNCTION(x.s8, ptr + 8), \
|
||||
FUNCTION(x.s9, ptr + 9), FUNCTION(x.sa, ptr + 10), \
|
||||
FUNCTION(x.sb, ptr + 11), FUNCTION(x.sc, ptr + 12), \
|
||||
FUNCTION(x.sd, ptr + 13), FUNCTION(x.se, ptr + 14), \
|
||||
FUNCTION(x.sf, ptr + 15)); \
|
||||
}
|
||||
|
||||
#endif // __CLC_CLCMACRO_H__
|
||||
@@ -0,0 +1,108 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_CLCTYPES_H_
|
||||
#define __CLC_CLCTYPES_H_
|
||||
|
||||
/* 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
|
||||
|
||||
#endif // __CLC_CLCTYPES_H_
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_COMMON_CLC_DEGREES_H__
|
||||
#define __CLC_COMMON_CLC_DEGREES_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_degrees
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_COMMON_CLC_DEGREES_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_COMMON_CLC_RADIANS_H__
|
||||
#define __CLC_COMMON_CLC_RADIANS_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_radians
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_COMMON_CLC_RADIANS_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_COMMON_CLC_SIGN_H__
|
||||
#define __CLC_COMMON_CLC_SIGN_H__
|
||||
|
||||
#define FUNCTION __clc_sign
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_COMMON_CLC_SIGN_H__
|
||||
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_COMMON_CLC_SMOOTHSTEP_H__
|
||||
#define __CLC_COMMON_CLC_SMOOTHSTEP_H__
|
||||
|
||||
// note: Unlike OpenCL __clc_smoothstep is only defined for three matching
|
||||
// argument types.
|
||||
|
||||
#define __CLC_BODY <clc/common/clc_smoothstep.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#endif // __CLC_COMMON_CLC_SMOOTHSTEP_H__
|
||||
@@ -0,0 +1,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __clc_smoothstep(__CLC_GENTYPE edge0,
|
||||
__CLC_GENTYPE edge1,
|
||||
__CLC_GENTYPE x);
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_COMMON_CLC_STEP_H__
|
||||
#define __CLC_COMMON_CLC_STEP_H__
|
||||
|
||||
#define FUNCTION __clc_step
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_COMMON_CLC_STEP_H__
|
||||
@@ -0,0 +1,96 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define MAXFLOAT 0x1.fffffep127f
|
||||
#define HUGE_VALF __builtin_huge_valf()
|
||||
#define INFINITY __builtin_inff()
|
||||
|
||||
#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 FLT_NAN __builtin_nanf("")
|
||||
|
||||
#define FP_ILOGB0 (-2147483647 - 1)
|
||||
#define FP_ILOGBNAN 2147483647
|
||||
|
||||
#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
|
||||
|
||||
#define M_LOG210_F 0x1.a934f0p+1f
|
||||
|
||||
#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 DBL_NAN __builtin_nan("")
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
|
||||
#define HALF_RADIX 2
|
||||
#define HALF_MAX 0x1.ffcp15h
|
||||
#define HALF_MIN 0x1.0p-14h
|
||||
#define HALF_EPSILON 0x1.0p-10h
|
||||
#define HALF_NAN __builtin_nanf16("")
|
||||
|
||||
#define M_LOG2E_H 0x1.714p+0h
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
|
||||
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
|
||||
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_SCALAR_GENTYPE FUNCTION(__CLC_GENTYPE a,
|
||||
__CLC_GENTYPE b);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <clc/utils.h>
|
||||
|
||||
#ifndef __IMPL_FUNCTION
|
||||
#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
|
||||
#endif
|
||||
|
||||
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
|
||||
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
|
||||
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF __CLC_SCALAR_GENTYPE FUNCTION(__CLC_GENTYPE a,
|
||||
__CLC_GENTYPE b) {
|
||||
return __IMPL_FUNCTION(FUNCTION)(a, b);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_CROSS_H__
|
||||
#define __CLC_GEOMETRIC_CLC_CROSS_H__
|
||||
|
||||
#include <clc/internal/clc.h>
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL float3 __clc_cross(float3 p0, float3 p1);
|
||||
_CLC_OVERLOAD _CLC_DECL float4 __clc_cross(float4 p0, float4 p1);
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL double3 __clc_cross(double3 p0, double3 p1);
|
||||
_CLC_OVERLOAD _CLC_DECL double4 __clc_cross(double4 p0, double4 p1);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef cl_khr_fp16
|
||||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL half3 __clc_cross(half3 p0, half3 p1);
|
||||
_CLC_OVERLOAD _CLC_DECL half4 __clc_cross(half4 p0, half4 p1);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_CROSS_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_DISTANCE_H__
|
||||
#define __CLC_GEOMETRIC_CLC_DISTANCE_H__
|
||||
|
||||
#define FUNCTION __clc_distance
|
||||
#define __CLC_BODY <clc/geometric/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_DISTANCE_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_DOT_H__
|
||||
#define __CLC_GEOMETRIC_CLC_DOT_H__
|
||||
|
||||
#define FUNCTION __clc_dot
|
||||
#define __CLC_BODY <clc/geometric/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_DOT_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
|
||||
#define __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_fast_distance
|
||||
#define __CLC_BODY <clc/geometric/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_FAST_DISTANCE_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
|
||||
#define __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_fast_length
|
||||
#define __CLC_BODY <clc/geometric/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_FAST_LENGTH_H__
|
||||
@@ -0,0 +1,21 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
|
||||
#define __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define __CLC_GEOMETRIC_RET_GENTYPE
|
||||
#define FUNCTION __clc_fast_normalize
|
||||
#define __CLC_BODY <clc/geometric/unary_decl.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
#undef __CLC_GEOMETRIC_RET_GENTYPE
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_FAST_NORMALIZE_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_LENGTH_H__
|
||||
#define __CLC_GEOMETRIC_CLC_LENGTH_H__
|
||||
|
||||
#define FUNCTION __clc_length
|
||||
#define __CLC_BODY <clc/geometric/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_LENGTH_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_GEOMETRIC_CLC_NORMALIZE_H__
|
||||
#define __CLC_GEOMETRIC_CLC_NORMALIZE_H__
|
||||
|
||||
#define __CLC_GEOMETRIC_RET_GENTYPE
|
||||
#define FUNCTION __clc_normalize
|
||||
#define __CLC_BODY <clc/geometric/unary_decl.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
#undef __CLC_GEOMETRIC_RET_GENTYPE
|
||||
|
||||
#endif // __CLC_GEOMETRIC_CLC_NORMALIZE_H__
|
||||
@@ -0,0 +1,21 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
|
||||
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
|
||||
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL
|
||||
#ifdef __CLC_GEOMETRIC_RET_GENTYPE
|
||||
__CLC_GENTYPE
|
||||
#else
|
||||
__CLC_SCALAR_GENTYPE
|
||||
#endif
|
||||
FUNCTION(__CLC_GENTYPE a);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <clc/utils.h>
|
||||
|
||||
#ifndef __IMPL_FUNCTION
|
||||
#define __IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
|
||||
#endif
|
||||
|
||||
// Geometric functions are only defined for scalar, vec2, vec3 and vec4
|
||||
#if (__CLC_VECSIZE_OR_1 == 1 || __CLC_VECSIZE_OR_1 == 2 || \
|
||||
__CLC_VECSIZE_OR_1 == 3 || __CLC_VECSIZE_OR_1 == 4)
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF
|
||||
#ifdef __CLC_GEOMETRIC_RET_GENTYPE
|
||||
__CLC_GENTYPE
|
||||
#else
|
||||
__CLC_SCALAR_GENTYPE
|
||||
#endif
|
||||
FUNCTION(__CLC_GENTYPE a) {
|
||||
return __IMPL_FUNCTION(FUNCTION)(a);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_ABS_H__
|
||||
#define __CLC_INTEGER_CLC_ABS_H__
|
||||
|
||||
#define __CLC_BODY <clc/integer/clc_abs.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_ABS_H__
|
||||
@@ -0,0 +1,9 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE __clc_abs(__CLC_GENTYPE x);
|
||||
@@ -0,0 +1,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_ABS_DIFF_H__
|
||||
#define __CLC_INTEGER_CLC_ABS_DIFF_H__
|
||||
|
||||
#define __CLC_BODY <clc/integer/clc_abs_diff.inc>
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_ABS_DIFF_H__
|
||||
@@ -0,0 +1,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE __clc_abs_diff(__CLC_GENTYPE x,
|
||||
__CLC_GENTYPE y);
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_ADD_SAT_H__
|
||||
#define __CLC_INTEGER_CLC_ADD_SAT_H__
|
||||
|
||||
#define FUNCTION __clc_add_sat
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_ADD_SAT_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_CLZ_H__
|
||||
#define __CLC_INTEGER_CLC_CLZ_H__
|
||||
|
||||
#define FUNCTION __clc_clz
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_CLZ_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_CTZ_H__
|
||||
#define __CLC_INTEGER_CLC_CTZ_H__
|
||||
|
||||
#define FUNCTION __clc_ctz
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_CTZ_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_HADD_H__
|
||||
#define __CLC_INTEGER_CLC_HADD_H__
|
||||
|
||||
#define FUNCTION __clc_hadd
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_HADD_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_MAD24_H__
|
||||
#define __CLC_INTEGER_CLC_MAD24_H__
|
||||
|
||||
#define FUNCTION __clc_mad24
|
||||
#define __CLC_BODY <clc/shared/ternary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype24.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_MAD24_H__
|
||||
@@ -0,0 +1,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_MAD_HI_H__
|
||||
#define __CLC_INTEGER_CLC_MAD_HI_H__
|
||||
|
||||
#include <clc/integer/clc_mul_hi.h>
|
||||
|
||||
#define __clc_mad_hi(a, b, c) (__clc_mul_hi((a), (b)) + (c))
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_MAD_HI_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_MAD_SAT_H__
|
||||
#define __CLC_INTEGER_CLC_MAD_SAT_H__
|
||||
|
||||
#define FUNCTION __clc_mad_sat
|
||||
#define __CLC_BODY <clc/shared/ternary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_MAD_SAT_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_MUL24_H__
|
||||
#define __CLC_INTEGER_CLC_MUL24_H__
|
||||
|
||||
#define FUNCTION __clc_mul24
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype24.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_MUL24_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_MUL_HI_H__
|
||||
#define __CLC_INTEGER_CLC_MUL_HI_H__
|
||||
|
||||
#define FUNCTION __clc_mul_hi
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_MUL_HI_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_POPCOUNT_H__
|
||||
#define __CLC_INTEGER_CLC_POPCOUNT_H__
|
||||
|
||||
#define FUNCTION __clc_popcount
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef __CLC_INTRINSIC
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_POPCOUNT_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_RHADD_H__
|
||||
#define __CLC_INTEGER_CLC_RHADD_H__
|
||||
|
||||
#define FUNCTION __clc_rhadd
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_RHADD_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_ROTATE_H__
|
||||
#define __CLC_INTEGER_CLC_ROTATE_H__
|
||||
|
||||
#define FUNCTION __clc_rotate
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_ROTATE_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_SUB_SAT_H__
|
||||
#define __CLC_INTEGER_CLC_SUB_SAT_H__
|
||||
|
||||
#define FUNCTION __clc_sub_sat
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/integer/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_SUB_SAT_H__
|
||||
@@ -0,0 +1,40 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_CLC_UPSAMPLE_H__
|
||||
#define __CLC_INTEGER_CLC_UPSAMPLE_H__
|
||||
|
||||
#include <clc/clcfunc.h>
|
||||
#include <clc/clctypes.h>
|
||||
|
||||
#define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
|
||||
_CLC_OVERLOAD _CLC_DECL BGENTYPE __clc_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
|
||||
|
||||
#endif // __CLC_INTEGER_CLC_UPSAMPLE_H__
|
||||
@@ -0,0 +1,32 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTEGER_DEFINITIONS_H__
|
||||
#define __CLC_INTEGER_DEFINITIONS_H__
|
||||
|
||||
#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 UCHAR_MIN 0
|
||||
#define USHRT_MAX 65535
|
||||
#define USHRT_MIN 0
|
||||
#define UINT_MAX 0xffffffff
|
||||
#define UINT_MIN 0
|
||||
#define ULONG_MAX 0xffffffffffffffffUL
|
||||
#define ULONG_MIN 0UL
|
||||
|
||||
#endif // __CLC_INTEGER_DEFINITIONS_H__
|
||||
@@ -0,0 +1,602 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <clc/clcfunc.h>
|
||||
#include <clc/clctypes.h>
|
||||
#include <clc/utils.h>
|
||||
|
||||
#define __CLC_AS_GENTYPE __CLC_XCONCAT(__clc_as_, __CLC_GENTYPE)
|
||||
#define __CLC_CONVERT_GENTYPE __CLC_XCONCAT(__clc_convert_, __CLC_GENTYPE)
|
||||
|
||||
#define __CLC_AS_U_GENTYPE __CLC_XCONCAT(__clc_as_, __CLC_U_GENTYPE)
|
||||
#define __CLC_CONVERT_U_GENTYPE __CLC_XCONCAT(__clc_convert_, __CLC_U_GENTYPE)
|
||||
|
||||
#define __CLC_AS_S_GENTYPE __CLC_XCONCAT(__clc_as_, __CLC_S_GENTYPE)
|
||||
#define __CLC_CONVERT_S_GENTYPE __CLC_XCONCAT(__clc_convert_, __CLC_S_GENTYPE)
|
||||
|
||||
// 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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#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
|
||||
#define __CLC_VECSIZE
|
||||
#define __CLC_VECSIZE_OR_1 1
|
||||
#include __CLC_BODY
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE_OR_1
|
||||
#undef __CLC_VECSIZE
|
||||
#undef __CLC_SCALAR
|
||||
#undef __CLC_GENTYPE
|
||||
#undef __CLC_U_GENTYPE
|
||||
#undef __CLC_S_GENTYPE
|
||||
|
||||
#define __CLC_VECSIZE_OR_1 __CLC_VECSIZE
|
||||
|
||||
#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_VECSIZE_OR_1
|
||||
|
||||
#undef __CLC_GENSIZE
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#undef __CLC_BODY
|
||||
|
||||
#undef __CLC_CONVERT_S_GENTYPE
|
||||
#undef __CLC_AS_S_GENTYPE
|
||||
|
||||
#undef __CLC_CONVERT_U_GENTYPE
|
||||
#undef __CLC_AS_U_GENTYPE
|
||||
|
||||
#undef __CLC_CONVERT_GENTYPE
|
||||
#undef __CLC_AS_GENTYPE
|
||||
@@ -0,0 +1,145 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <clc/clcfunc.h>
|
||||
#include <clc/clctypes.h>
|
||||
|
||||
#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
|
||||
#undef __CLC_SCALAR_GENTYPE
|
||||
#undef __CLC_BODY
|
||||
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTERNAL_CLC_H_
|
||||
#define __CLC_INTERNAL_CLC_H_
|
||||
|
||||
#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 <clc/clcfunc.h>
|
||||
|
||||
/* 6.1 Supported Data Types */
|
||||
#include <clc/clctypes.h>
|
||||
|
||||
/* 6.2.4.2 Reinterpreting Types Using __clc_as_type() and __clc_as_typen() */
|
||||
#include <clc/clc_as_type.h>
|
||||
|
||||
#pragma OPENCL EXTENSION all : disable
|
||||
|
||||
#endif // __CLC_INTERNAL_CLC_H_
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
|
||||
#define __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
|
||||
|
||||
#define FUNCTION __clc_sw_fma
|
||||
#define __CLC_BODY <clc/shared/ternary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_INTERNAL_MATH_CLC_SW_FMA_H__
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
|
||||
__CLC_GENTYPE b);
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a,
|
||||
__CLC_SCALAR_GENTYPE b);
|
||||
@@ -0,0 +1,13 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x,
|
||||
__CLC_GENTYPE y) {
|
||||
return __CLC_CONVERT_GENTYPE(
|
||||
FUNCTION(__CLC_CONVERT_FLOATN(x), __CLC_CONVERT_FLOATN(y)));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ACOS_H__
|
||||
#define __CLC_MATH_CLC_ACOS_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_acos
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ACOS_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ACOSH_H__
|
||||
#define __CLC_MATH_CLC_ACOSH_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_acosh
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ACOSH_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ACOSPI_H__
|
||||
#define __CLC_MATH_CLC_ACOSPI_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_acospi
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ACOSPI_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ASIN_H__
|
||||
#define __CLC_MATH_CLC_ASIN_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_asin
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ASIN_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ASINH_H__
|
||||
#define __CLC_MATH_CLC_ASINH_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_asinh
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ASINH_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ASINPI_H__
|
||||
#define __CLC_MATH_CLC_ASINPI_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_asinpi
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ASINPI_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ATAN_H__
|
||||
#define __CLC_MATH_CLC_ATAN_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_atan
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ATAN_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ATAN2_H__
|
||||
#define __CLC_MATH_CLC_ATAN2_H__
|
||||
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
#define FUNCTION __clc_atan2
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ATAN2_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ATAN2PI_H__
|
||||
#define __CLC_MATH_CLC_ATAN2PI_H__
|
||||
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
#define FUNCTION __clc_atan2pi
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ATAN2PI_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ATANH_H__
|
||||
#define __CLC_MATH_CLC_ATANH_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_atanh
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ATANH_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ATANPI_H__
|
||||
#define __CLC_MATH_CLC_ATANPI_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_atanpi
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ATANPI_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_CBRT_H__
|
||||
#define __CLC_MATH_CLC_CBRT_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_cbrt
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_CBRT_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_CEIL_H__
|
||||
#define __CLC_MATH_CLC_CEIL_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_ceil
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_CEIL_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_COPYSIGN_H__
|
||||
#define __CLC_MATH_CLC_COPYSIGN_H__
|
||||
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
#define FUNCTION __clc_copysign
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_COPYSIGN_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_COS_H__
|
||||
#define __CLC_MATH_CLC_COS_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_cos
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_COS_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_COSH_H__
|
||||
#define __CLC_MATH_CLC_COSH_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_cosh
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_COSH_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_COSPI_H__
|
||||
#define __CLC_MATH_CLC_COSPI_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_cospi
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_COSPI_H__
|
||||
@@ -0,0 +1,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EP_LOG_H__
|
||||
#define __CLC_MATH_CLC_EP_LOG_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/clc_ep_log.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#endif // __CLC_MATH_CLC_EP_LOG_H__
|
||||
@@ -0,0 +1,16 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if __CLC_FPSIZE == 64
|
||||
|
||||
_CLC_DECL _CLC_OVERLOAD void __clc_ep_log(__CLC_GENTYPE x,
|
||||
private __CLC_INTN *xexp,
|
||||
private __CLC_GENTYPE *r1,
|
||||
private __CLC_GENTYPE *r2);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ERF_H__
|
||||
#define __CLC_MATH_CLC_ERF_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_erf
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ERF_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_ERFC_H__
|
||||
#define __CLC_MATH_CLC_ERFC_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_erfc
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_ERFC_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EXP_H__
|
||||
#define __CLC_MATH_CLC_EXP_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_exp
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_EXP_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EXP10_H__
|
||||
#define __CLC_MATH_CLC_EXP10_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_exp10
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_EXP10_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EXP2_H__
|
||||
#define __CLC_MATH_CLC_EXP2_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_exp2
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_EXP2_H__
|
||||
@@ -0,0 +1,17 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EXP_HELPER
|
||||
#define __CLC_MATH_CLC_EXP_HELPER
|
||||
|
||||
#define __DOUBLE_ONLY
|
||||
#define __CLC_BODY <clc/math/clc_exp_helper.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#endif // __CLC_MATH_CLC_EXP_HELPER
|
||||
@@ -0,0 +1,13 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
_CLC_DECL _CLC_OVERLOAD __CLC_GENTYPE __clc_exp_helper(__CLC_GENTYPE x,
|
||||
__CLC_GENTYPE x_min,
|
||||
__CLC_GENTYPE x_max,
|
||||
__CLC_GENTYPE r,
|
||||
__CLC_INTN n);
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_EXPM1_H__
|
||||
#define __CLC_MATH_CLC_EXPM1_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_expm1
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_EXPM1_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FABS_H__
|
||||
#define __CLC_MATH_CLC_FABS_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_fabs
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FABS_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FDIM_H__
|
||||
#define __CLC_MATH_CLC_FDIM_H__
|
||||
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
#define FUNCTION __clc_fdim
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FDIM_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FLOOR_H__
|
||||
#define __CLC_MATH_CLC_FLOOR_H__
|
||||
|
||||
#define __CLC_BODY <clc/math/unary_decl.inc>
|
||||
#define FUNCTION __clc_floor
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FLOOR_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FMA_H__
|
||||
#define __CLC_MATH_CLC_FMA_H__
|
||||
|
||||
#define FUNCTION __clc_fma
|
||||
#define __CLC_BODY <clc/shared/ternary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FMA_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FMAX_H__
|
||||
#define __CLC_MATH_CLC_FMAX_H__
|
||||
|
||||
#define FUNCTION __clc_fmax
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FMAX_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FMIN_H__
|
||||
#define __CLC_MATH_CLC_FMIN_H__
|
||||
|
||||
#define FUNCTION __clc_fmin
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FMIN_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FMOD_H__
|
||||
#define __CLC_MATH_CLC_FMOD_H__
|
||||
|
||||
#define FUNCTION __clc_fmod
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FMOD_H__
|
||||
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FRACT_H__
|
||||
#define __CLC_MATH_CLC_FRACT_H__
|
||||
|
||||
#define FUNCTION __clc_fract
|
||||
#define __CLC_BODY <clc/math/unary_decl_with_ptr.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FRACT_H__
|
||||
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_FREXP_H__
|
||||
#define __CLC_MATH_CLC_FREXP_H__
|
||||
|
||||
#define FUNCTION __clc_frexp
|
||||
#define __CLC_BODY <clc/math/unary_decl_with_int_ptr.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_FREXP_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_COS_H__
|
||||
#define __CLC_MATH_CLC_HALF_COS_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_cos
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_COS_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_DIVIDE_H__
|
||||
#define __CLC_MATH_CLC_HALF_DIVIDE_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_divide
|
||||
#define __CLC_BODY <clc/shared/binary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_DIVIDE_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_EXP_H__
|
||||
#define __CLC_MATH_CLC_HALF_EXP_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_exp
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_EXP_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_EXP10_H__
|
||||
#define __CLC_MATH_CLC_HALF_EXP10_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_exp10
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_EXP10_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_EXP2_H__
|
||||
#define __CLC_MATH_CLC_HALF_EXP2_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_exp2
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_EXP2_H__
|
||||
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __CLC_MATH_CLC_HALF_LOG_H__
|
||||
#define __CLC_MATH_CLC_HALF_LOG_H__
|
||||
|
||||
#define __FLOAT_ONLY
|
||||
#define FUNCTION __clc_half_log
|
||||
#define __CLC_BODY <clc/shared/unary_decl.inc>
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
#undef FUNCTION
|
||||
|
||||
#endif // __CLC_MATH_CLC_HALF_LOG_H__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user