cl_offline_compiler.sh.in.cmake: add a hack required for CTS math divide test
same as in pocl_llvm_build_program()
@@ -51,14 +51,25 @@ if [ "$MODE" != "spir-v" ]; then
fi
CL_IS_30=false
+CL_FAST_MATH=false
+CL_UNSAFE_MATH=false
BUILD_OPTIONS=""
CL_STD="-cl-std=CL1.2"
+
for i in "$@"; do
case $i in
-cl-std=*)
CL_STD="$i"
shift
;;
+ -cl-fast-relaxed-math)
+ CL_FAST_MATH=true
+ shift
+ ;;
+ -cl-unsafe-math)
+ CL_UNSAFE_MATH=true
+ shift
+ ;;
*)
BUILD_OPTIONS="$BUILD_OPTIONS $i"
shift
@@ -89,6 +100,16 @@ if [ -e "${CL_DEV_INFO}" ]; then
fi
fi
+ if [ "$CL_FAST_MATH" = "true" ]; then
+ CL_EXT_DEFS="${CL_EXT_DEFS} -cl-finite-math-only"
+ CL_UNSAFE_MATH=true
+ fi
+
+ if [ "$CL_UNSAFE_MATH" = "true" ]; then
+ CL_EXT_DEFS="${CL_EXT_DEFS} -cl-no-signed-zeros -cl-mad-enable -ffp-contract=fast"
+ fi
+
+
if [[ "$CL_DEVICE_VERSION" =~ "PoCL" ]] && [ "$CL_IS_30" = "true" ]; then
if [[ "$CL_DEVICE_VERSION" =~ "basic" ]] || [[ "$CL_DEVICE_VERSION" =~ "pthread" ]]; then
CL_EXT_DEFS="${CL_EXT_DEFS} -D__opencl_c_named_address_space_builtins=1 -D__opencl_c_int64=1 -D__opencl_c_atomic_order_acq_rel=1 -D__opencl_c_atomic_order_seq_cst=1 -D__opencl_c_atomic_scope_device=1"
