libclc: Add Mesa/SPIR-V target

Add targets to emit SPIR-V targeted to Mesa's OpenCL support, using
SPIR-V 1.1.

Substantially based on Dave Airlie's earlier work.

libclc: spirv: remove step/smoothstep apis not defined for SPIR-V

libclc: disable inlines for SPIR-V builds

Reviewed By: jvesely, tstellar, jenatali

Differential Revision: https://reviews.llvm.org/D77589

GitOrigin-RevId: c37145cab12168798a603e22af6b6bf6f606b705
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c12dc10..1a77a37 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,9 @@
   generic/lib/SOURCES;
   ptx/lib/SOURCES;
   ptx-nvidiacl/lib/SOURCES;
-  r600/lib/SOURCES
+  r600/lib/SOURCES;
+  spirv/lib/SOURCES;
+  spirv64/lib/SOURCES
 )
 
 # List of all targets
@@ -22,6 +24,8 @@
   nvptx64--
   nvptx--nvidiacl
   nvptx64--nvidiacl
+  spirv-mesa3d-
+  spirv64-mesa3d-
 )
 
 set( LIBCLC_MIN_LLVM "3.9.0" )
@@ -53,8 +57,6 @@
 	set( LIBCLC_TARGETS_TO_BUILD ${LIBCLC_TARGETS_ALL} )
 endif()
 
-list( SORT LIBCLC_TARGETS_TO_BUILD )
-
 execute_process( COMMAND ${LLVM_CONFIG} "--system-libs"
 	OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
 	OUTPUT_STRIP_TRAILING_WHITESPACE )
@@ -93,17 +95,27 @@
 find_program( LLVM_AS llvm-as PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
 find_program( LLVM_LINK llvm-link PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
 find_program( LLVM_OPT opt PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
+find_program( LLVM_SPIRV llvm-spirv PATHS ${LLVM_BINDIR} NO_DEFAULT_PATH )
 
 # Print toolchain
 message( "clang: ${LLVM_CLANG}" )
 message( "llvm-as: ${LLVM_AS}" )
 message( "llvm-link: ${LLVM_LINK}" )
 message( "opt: ${LLVM_OPT}" )
+message( "llvm-spirv: ${LLVM_SPIRV}" )
 message( "" )
 if( NOT LLVM_CLANG OR NOT LLVM_OPT OR NOT LLVM_AS OR NOT LLVM_LINK )
 	message( FATAL_ERROR "toolchain incomplete!" )
 endif()
 
+list( SORT LIBCLC_TARGETS_TO_BUILD )
+
+if( "spirv-mesa3d-" IN_LIST LIBCLC_TARGETS_TO_BUILD OR "spirv64-mesa3d-" IN_LIST LIBCLC_TARGETS_TO_BUILD )
+	if( NOT LLVM_SPIRV )
+		message( FATAL_ERROR "SPIR-V targets requested, but spirv-tools is not installed" )
+	endif()
+endif()
+
 set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
 set( CMAKE_CLC_COMPILER ${LLVM_CLANG} )
 set( CMAKE_CLC_ARCHIVE ${LLVM_LINK} )
@@ -137,6 +149,8 @@
 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 )
@@ -187,9 +201,14 @@
 	list( GET TRIPLE 1 VENDOR )
 	list( GET TRIPLE 2 OS )
 
-	set( dirs generic )
+	set( dirs )
+
+	if ( NOT ${ARCH} STREQUAL spirv AND NOT ${ARCH} STREQUAL spirv64 )
+		LIST( APPEND dirs generic )
+	endif()
+
 	if( ${ARCH} STREQUAL r600 OR ${ARCH} STREQUAL amdgcn )
-		set( dirs ${dirs} amdgpu )
+		list( APPEND dirs amdgpu )
 	endif()
 
 	#nvptx is special
@@ -215,10 +234,15 @@
 
 	# Add the generated convert.cl here to prevent adding
 	# the one listed in SOURCES
-	set( rel_files convert.cl )
-	set( objects convert.cl )
-	if( NOT ENABLE_RUNTIME_SUBNORMAL )
-		list( APPEND rel_files generic/lib/subnormal_use_default.ll )
+	if( NOT ${ARCH} STREQUAL "spirv" AND NOT ${ARCH} STREQUAL "spirv64" )
+		set( rel_files convert.cl )
+		set( objects convert.cl )
+		if( NOT ENABLE_RUNTIME_SUBNORMAL )
+			list( APPEND rel_files generic/lib/subnormal_use_default.ll )
+		endif()
+	else()
+		set( rel_files )
+		set( objects )
 	endif()
 
 	foreach( l ${source_list} )
@@ -242,7 +266,7 @@
 
 	foreach( d ${${t}_devices} )
 		# Some targets don't have a specific GPU to target
-		if( ${d} STREQUAL "none" )
+		if( ${d} STREQUAL "none" OR ${ARCH} STREQUAL "spirv" OR ${ARCH} STREQUAL "spirv64" )
 			set( mcpu )
 			set( arch_suffix "${t}" )
 		else()
@@ -251,6 +275,20 @@
 		endif()
 		message( "	DEVICE: ${d} ( ${${d}_aliases} )" )
 
+		if ( ${ARCH} STREQUAL "spirv" OR ${ARCH} STREQUAL "spirv64" )
+			if( ${ARCH} STREQUAL "spirv" )
+				set( t "spir--" )
+			else()
+				set( t "spir64--" )
+			endif()
+			set( build_flags -O0 -finline-hint-functions )
+			set( opt_flags )
+			set( spvflags --spirv-max-version=1.1 )
+		else()
+			set( build_flags )
+			set( opt_flags -O3 )
+		endif()
+
 		add_library( builtins.link.${arch_suffix} STATIC ${rel_files} )
 		# Make sure we depend on the pseudo target to prevent
 		# multiple invocations
@@ -261,8 +299,11 @@
 			"generic/include" )
 		target_compile_definitions( builtins.link.${arch_suffix} PRIVATE
 			"__CLC_INTERNAL" )
+		string( TOUPPER "-DCLC_${ARCH}" CLC_TARGET_DEFINE )
+		target_compile_definitions( builtins.link.${arch_suffix} PRIVATE
+			${CLC_TARGET_DEFINE} )
 		target_compile_options( builtins.link.${arch_suffix} PRIVATE  -target
-			${t} ${mcpu} -fno-builtin -nostdlib )
+			${t} ${mcpu} -fno-builtin -nostdlib ${build_flags} )
 		set_target_properties( builtins.link.${arch_suffix} PROPERTIES
 			LINKER_LANGUAGE CLC )
 
@@ -270,42 +311,56 @@
 
 		# Add opt target
 		add_custom_command( OUTPUT "builtins.opt.${obj_suffix}"
-			            COMMAND ${LLVM_OPT} -O3 -o
+				    COMMAND ${LLVM_OPT} ${opt_flags} -o
 				    "builtins.opt.${obj_suffix}"
 				    "builtins.link.${obj_suffix}"
 				    DEPENDS "builtins.link.${arch_suffix}" )
 		add_custom_target( "opt.${obj_suffix}" ALL
 		                   DEPENDS "builtins.opt.${obj_suffix}" )
 
-		# Add prepare target
-		add_custom_command( OUTPUT "${obj_suffix}"
-			            COMMAND prepare_builtins -o
-				    "${obj_suffix}"
-				    "builtins.opt.${obj_suffix}"
-				    DEPENDS "opt.${obj_suffix}"
-				            "builtins.opt.${obj_suffix}"
-				            prepare_builtins )
-		add_custom_target( "prepare-${obj_suffix}" ALL
-		                   DEPENDS "${obj_suffix}" )
-		install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
-		# nvptx-- targets don't include workitem builtins
-		if( NOT ${t} MATCHES ".*ptx.*--$" )
-			add_test( NAME external-calls-${obj_suffix}
-				  COMMAND ./check_external_calls.sh ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix}
-				  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} )
-			set_tests_properties( external-calls-${obj_suffix}
-				PROPERTIES ENVIRONMENT "LLVM_CONFIG=${LLVM_CONFIG}" )
+		if( ${ARCH} STREQUAL "spirv" OR ${ARCH} STREQUAL "spirv64" )
+			set( spv_suffix ${arch_suffix}.spv )
+			add_custom_command( OUTPUT "${spv_suffix}"
+					    COMMAND ${LLVM_SPIRV} ${spvflags}
+					    -o "${spv_suffix}"
+					    "builtins.link.${obj_suffix}"
+					    DEPENDS "builtins.link.${arch_suffix}" )
+			add_custom_target( "prepare-${spv_suffix}" ALL
+			                   DEPENDS "${spv_suffix}" )
+			install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix}
+				 DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
+		else()
+
+			# Add prepare target
+			add_custom_command( OUTPUT "${obj_suffix}"
+				            COMMAND prepare_builtins -o
+					    "${obj_suffix}"
+					    "builtins.opt.${obj_suffix}"
+					    DEPENDS "opt.${obj_suffix}"
+					            "builtins.opt.${obj_suffix}"
+					            prepare_builtins )
+			add_custom_target( "prepare-${obj_suffix}" ALL
+					   DEPENDS "${obj_suffix}" )
+
+			# nvptx-- targets don't include workitem builtins
+			if( NOT ${t} MATCHES ".*ptx.*--$" )
+				add_test( NAME external-calls-${obj_suffix}
+					  COMMAND ./check_external_calls.sh ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix}
+					  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} )
+				set_tests_properties( external-calls-${obj_suffix}
+					PROPERTIES ENVIRONMENT "LLVM_CONFIG=${LLVM_CONFIG}" )
+			endif()
+
+			install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
+			foreach( a ${${d}_aliases} )
+				set( alias_suffix "${a}-${t}.bc" )
+				add_custom_target( ${alias_suffix} ALL
+						   COMMAND ${CMAKE_COMMAND} -E
+						   create_symlink ${obj_suffix}
+						   ${alias_suffix}
+				                   DEPENDS "prepare-${obj_suffix}" )
+				install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
+			endforeach( a )
 		endif()
-
-
-		foreach( a ${${d}_aliases} )
-			set( alias_suffix "${a}-${t}.bc" )
-			add_custom_target( ${alias_suffix} ALL
-					   COMMAND ${CMAKE_COMMAND} -E
-					   create_symlink ${obj_suffix}
-					   ${alias_suffix}
-			                   DEPENDS "prepare-${obj_suffix}" )
-			install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${alias_suffix} DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
-		endforeach( a )
 	endforeach( d )
 endforeach( t )
diff --git a/generic/include/clc/clcfunc.h b/generic/include/clc/clcfunc.h
index 5f166c5..55b775e 100644
--- a/generic/include/clc/clcfunc.h
+++ b/generic/include/clc/clcfunc.h
@@ -1,4 +1,10 @@
 #define _CLC_OVERLOAD __attribute__((overloadable))
 #define _CLC_DECL
-#define _CLC_DEF __attribute__((always_inline))
 #define _CLC_INLINE __attribute__((always_inline)) inline
+
+/* avoid inlines for SPIR-V since we'll optimise later in the chain */
+#if defined(CLC_SPIRV) || defined(CLC_SPIRV64)
+#define _CLC_DEF
+#else
+#define _CLC_DEF __attribute__((always_inline))
+#endif
diff --git a/generic/lib/common/smoothstep.cl b/generic/lib/common/smoothstep.cl
index 68d1a13..9f513eb 100644
--- a/generic/lib/common/smoothstep.cl
+++ b/generic/lib/common/smoothstep.cl
@@ -46,10 +46,12 @@
 
 _CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, double, double);
 
+#if !defined(CLC_SPIRV) && !defined(CLC_SPIRV64)
 SMOOTH_STEP_DEF(float, double, SMOOTH_STEP_IMPL_D);
 SMOOTH_STEP_DEF(double, float, SMOOTH_STEP_IMPL_D);
 
 _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, float, float, double);
 _CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, double, double, float);
+#endif
 
 #endif
diff --git a/generic/lib/common/step.cl b/generic/lib/common/step.cl
index 4b022f1..5d7c487 100644
--- a/generic/lib/common/step.cl
+++ b/generic/lib/common/step.cl
@@ -45,10 +45,12 @@
 _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double);
 _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double);
 
+#if !defined(CLC_SPIRV) && !defined(CLC_SPIRV64)
 STEP_DEF(float, double);
 STEP_DEF(double, float);
 
 _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, float, double);
 _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, double, float);
+#endif
 
 #endif
diff --git a/spirv/lib/SOURCES b/spirv/lib/SOURCES
new file mode 100644
index 0000000..f594fa7
--- /dev/null
+++ b/spirv/lib/SOURCES
@@ -0,0 +1,84 @@
+subnormal_config.cl
+../../generic/lib/async/async_work_group_strided_copy.cl
+../../generic/lib/async/wait_group_events.cl
+../../generic/lib/common/degrees.cl
+../../generic/lib/common/mix.cl
+../../generic/lib/common/radians.cl
+../../generic/lib/common/sign.cl
+../../generic/lib/common/smoothstep.cl
+../../generic/lib/common/step.cl
+../../generic/lib/geometric/cross.cl
+../../generic/lib/geometric/distance.cl
+../../generic/lib/geometric/dot.cl
+../../generic/lib/geometric/fast_distance.cl
+../../generic/lib/geometric/fast_length.cl
+../../generic/lib/geometric/fast_normalize.cl
+../../generic/lib/geometric/length.cl
+../../generic/lib/geometric/normalize.cl
+../../generic/lib/integer/rotate.cl
+../../generic/lib/integer/mad_sat.cl
+../../generic/lib/math/acos.cl
+../../generic/lib/math/acosh.cl
+../../generic/lib/math/acospi.cl
+../../generic/lib/math/asin.cl
+../../generic/lib/math/asinh.cl
+../../generic/lib/math/asinpi.cl
+../../generic/lib/math/atan.cl
+../../generic/lib/math/atan2.cl
+../../generic/lib/math/atan2pi.cl
+../../generic/lib/math/atanh.cl
+../../generic/lib/math/atanpi.cl
+../../generic/lib/math/cbrt.cl
+../../generic/lib/math/cos.cl
+../../generic/lib/math/cosh.cl
+../../generic/lib/math/cospi.cl
+../../generic/lib/math/ep_log.cl
+../../generic/lib/math/erf.cl
+../../generic/lib/math/erfc.cl
+../../generic/lib/math/exp.cl
+../../generic/lib/math/exp_helper.cl
+../../generic/lib/math/expm1.cl
+../../generic/lib/math/exp2.cl
+../../generic/lib/math/clc_exp10.cl
+../../generic/lib/math/exp10.cl
+../../generic/lib/math/fract.cl
+../../generic/lib/math/frexp.cl
+../../generic/lib/math/half_rsqrt.cl
+../../generic/lib/math/half_sqrt.cl
+../../generic/lib/math/clc_hypot.cl
+../../generic/lib/math/hypot.cl
+../../generic/lib/math/ilogb.cl
+../../generic/lib/math/lgamma.cl
+../../generic/lib/math/lgamma_r.cl
+../../generic/lib/math/log.cl
+../../generic/lib/math/log10.cl
+../../generic/lib/math/log1p.cl
+../../generic/lib/math/log2.cl
+../../generic/lib/math/logb.cl
+../../generic/lib/math/modf.cl
+../../generic/lib/math/tables.cl
+../../generic/lib/math/clc_pow.cl
+../../generic/lib/math/pow.cl
+../../generic/lib/math/clc_pown.cl
+../../generic/lib/math/pown.cl
+../../generic/lib/math/clc_powr.cl
+../../generic/lib/math/powr.cl
+../../generic/lib/math/clc_remainder.cl
+../../generic/lib/math/remainder.cl
+../../generic/lib/math/clc_remquo.cl
+../../generic/lib/math/remquo.cl
+../../generic/lib/math/clc_rootn.cl
+../../generic/lib/math/rootn.cl
+../../generic/lib/math/sin.cl
+../../generic/lib/math/sincos.cl
+../../generic/lib/math/sincos_helpers.cl
+../../generic/lib/math/sinh.cl
+../../generic/lib/math/sinpi.cl
+../../generic/lib/math/clc_tan.cl
+../../generic/lib/math/tan.cl
+../../generic/lib/math/tanh.cl
+../../generic/lib/math/clc_tanpi.cl
+../../generic/lib/math/tanpi.cl
+../../generic/lib/math/tgamma.cl
+../../generic/lib/shared/vload.cl
+../../generic/lib/shared/vstore.cl
diff --git a/spirv/lib/subnormal_config.cl b/spirv/lib/subnormal_config.cl
new file mode 100644
index 0000000..167fe1b
--- /dev/null
+++ b/spirv/lib/subnormal_config.cl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <clc/clc.h>
+
+#include "config.h"
+
+_CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
+
+_CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
+
+_CLC_DEF bool __clc_fp64_subnormals_supported() { return false; }
diff --git a/spirv64/lib/SOURCES b/spirv64/lib/SOURCES
new file mode 100644
index 0000000..f594fa7
--- /dev/null
+++ b/spirv64/lib/SOURCES
@@ -0,0 +1,84 @@
+subnormal_config.cl
+../../generic/lib/async/async_work_group_strided_copy.cl
+../../generic/lib/async/wait_group_events.cl
+../../generic/lib/common/degrees.cl
+../../generic/lib/common/mix.cl
+../../generic/lib/common/radians.cl
+../../generic/lib/common/sign.cl
+../../generic/lib/common/smoothstep.cl
+../../generic/lib/common/step.cl
+../../generic/lib/geometric/cross.cl
+../../generic/lib/geometric/distance.cl
+../../generic/lib/geometric/dot.cl
+../../generic/lib/geometric/fast_distance.cl
+../../generic/lib/geometric/fast_length.cl
+../../generic/lib/geometric/fast_normalize.cl
+../../generic/lib/geometric/length.cl
+../../generic/lib/geometric/normalize.cl
+../../generic/lib/integer/rotate.cl
+../../generic/lib/integer/mad_sat.cl
+../../generic/lib/math/acos.cl
+../../generic/lib/math/acosh.cl
+../../generic/lib/math/acospi.cl
+../../generic/lib/math/asin.cl
+../../generic/lib/math/asinh.cl
+../../generic/lib/math/asinpi.cl
+../../generic/lib/math/atan.cl
+../../generic/lib/math/atan2.cl
+../../generic/lib/math/atan2pi.cl
+../../generic/lib/math/atanh.cl
+../../generic/lib/math/atanpi.cl
+../../generic/lib/math/cbrt.cl
+../../generic/lib/math/cos.cl
+../../generic/lib/math/cosh.cl
+../../generic/lib/math/cospi.cl
+../../generic/lib/math/ep_log.cl
+../../generic/lib/math/erf.cl
+../../generic/lib/math/erfc.cl
+../../generic/lib/math/exp.cl
+../../generic/lib/math/exp_helper.cl
+../../generic/lib/math/expm1.cl
+../../generic/lib/math/exp2.cl
+../../generic/lib/math/clc_exp10.cl
+../../generic/lib/math/exp10.cl
+../../generic/lib/math/fract.cl
+../../generic/lib/math/frexp.cl
+../../generic/lib/math/half_rsqrt.cl
+../../generic/lib/math/half_sqrt.cl
+../../generic/lib/math/clc_hypot.cl
+../../generic/lib/math/hypot.cl
+../../generic/lib/math/ilogb.cl
+../../generic/lib/math/lgamma.cl
+../../generic/lib/math/lgamma_r.cl
+../../generic/lib/math/log.cl
+../../generic/lib/math/log10.cl
+../../generic/lib/math/log1p.cl
+../../generic/lib/math/log2.cl
+../../generic/lib/math/logb.cl
+../../generic/lib/math/modf.cl
+../../generic/lib/math/tables.cl
+../../generic/lib/math/clc_pow.cl
+../../generic/lib/math/pow.cl
+../../generic/lib/math/clc_pown.cl
+../../generic/lib/math/pown.cl
+../../generic/lib/math/clc_powr.cl
+../../generic/lib/math/powr.cl
+../../generic/lib/math/clc_remainder.cl
+../../generic/lib/math/remainder.cl
+../../generic/lib/math/clc_remquo.cl
+../../generic/lib/math/remquo.cl
+../../generic/lib/math/clc_rootn.cl
+../../generic/lib/math/rootn.cl
+../../generic/lib/math/sin.cl
+../../generic/lib/math/sincos.cl
+../../generic/lib/math/sincos_helpers.cl
+../../generic/lib/math/sinh.cl
+../../generic/lib/math/sinpi.cl
+../../generic/lib/math/clc_tan.cl
+../../generic/lib/math/tan.cl
+../../generic/lib/math/tanh.cl
+../../generic/lib/math/clc_tanpi.cl
+../../generic/lib/math/tanpi.cl
+../../generic/lib/math/tgamma.cl
+../../generic/lib/shared/vload.cl
+../../generic/lib/shared/vstore.cl
diff --git a/spirv64/lib/subnormal_config.cl b/spirv64/lib/subnormal_config.cl
new file mode 100644
index 0000000..167fe1b
--- /dev/null
+++ b/spirv64/lib/subnormal_config.cl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <clc/clc.h>
+
+#include "config.h"
+
+_CLC_DEF bool __clc_fp16_subnormals_supported() { return false; }
+
+_CLC_DEF bool __clc_fp32_subnormals_supported() { return false; }
+
+_CLC_DEF bool __clc_fp64_subnormals_supported() { return false; }