configure: Add --enable-runtime-subnormal option
authorTom Stellard <thomas.stellard@amd.com>
Mon, 20 Apr 2015 18:49:50 +0000 (18:49 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Mon, 20 Apr 2015 18:49:50 +0000 (18:49 +0000)
commitd9ca1f1596b9522c2a18731a9965e3f0a4677fec
tree1db1461e6d79f4d2ca005c1a2ae98ba21e37cc60
parentf18771bdfd8d34f72cae4a2571215e198c4ebef4
configure: Add --enable-runtime-subnormal option

This makes it possible for runtime implementations to disable
subnormal handling at runtime.

When this flag is enabled, decisions about how to handle subnormals
in the library will be controlled by an external variable called
__CLC_SUBNORMAL_DISABLE.

Function implementations should use these new helpers for querying subnormal
support:
__clc_fp16_subnormals_supported();
__clc_fp32_subnormals_supported();
__clc_fp64_subnormals_supported();

In order for the library to link correctly with this feature,
users will be required to either:

1. Insert this variable into the module (if using the LLVM/Clang C++/C APIs).

2. Pass either subnormal_disable.bc or subnormal_use_default.bc to the
linker.  These files are distributed with liblclc and installed to
$(installdir).  e.g.:

llvm-link -o kernel-out.bc kernel.bc builtins-nosubnormal.bc subnormal_disable.bc

or

llvm-link -o kernel-out.bc kernel.bc builtins-nosubnormal.bc subnormal_use_default.bc

If you do not supply the --enable-runtime-subnormal then the library
behaves the same as it did before this commit.

In addition to these changes, the patch adds helper functions that
should be used when implementing library functions that need
special handling for denormals:

__clc_fp16_subnormals_supported();
__clc_fp32_subnormals_supported();
__clc_fp64_subnormals_supported();

llvm-svn: 235329
libclc/configure.py
libclc/generic/include/config.h [new file with mode: 0644]
libclc/generic/lib/SOURCES
libclc/generic/lib/subnormal_config.cl [new file with mode: 0644]
libclc/generic/lib/subnormal_disable.ll [new file with mode: 0644]
libclc/generic/lib/subnormal_helper_func.ll [new file with mode: 0644]
libclc/generic/lib/subnormal_use_default.ll [new file with mode: 0644]