From 65f1c28f5dab19b12b3a00abd558bed9640901ba Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 29 May 2012 13:35:54 +0000 Subject: Enable cl_khr_fp64 when building the library, and fix several bugs uncovered when doing so. git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157617 91177308-0d34-0410-b5e6-96231b3b80d8 --- compile-test.sh | 2 +- configure.py | 1 + generic/lib/geometric/length.cl | 4 ++++ generic/lib/geometric/length.inc | 2 +- generic/lib/geometric/normalize.cl | 4 ++++ generic/lib/math/mad.cl | 4 ++++ 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/compile-test.sh b/compile-test.sh index d0f4bb4..7461811 100755 --- a/compile-test.sh +++ b/compile-test.sh @@ -1,3 +1,3 @@ #!/bin/sh -clang -ccc-host-triple nvptx--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers "$@" +clang -ccc-host-triple nvptx--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers -Dcl_khr_fp64 "$@" diff --git a/configure.py b/configure.py index 829ce6b..ab84a0d 100755 --- a/configure.py +++ b/configure.py @@ -93,6 +93,7 @@ for target in targets: # The rule for building a .bc file for the specified architecture using clang. clang_bc_flags = "-ccc-host-triple %s -I`dirname $in` %s " \ "-Dcl_clang_storage_class_specifiers " \ + "-Dcl_khr_fp64 " \ "-emit-llvm" % (target, clang_cl_includes) clang_bc_rule = "CLANG_CL_BC_" + target c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags) diff --git a/generic/lib/geometric/length.cl b/generic/lib/geometric/length.cl index 957fbfd..cbe84a0 100644 --- a/generic/lib/geometric/length.cl +++ b/generic/lib/geometric/length.cl @@ -1,4 +1,8 @@ #include +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + #define BODY "length.inc" #include diff --git a/generic/lib/geometric/length.inc b/generic/lib/geometric/length.inc index 66d1604..494789c 100644 --- a/generic/lib/geometric/length.inc +++ b/generic/lib/geometric/length.inc @@ -1,3 +1,3 @@ -_CLC_OVERLOAD _CLC_DEF float length(FLOATN p) { +_CLC_OVERLOAD _CLC_DEF FLOAT length(FLOATN p) { return native_sqrt(dot(p, p)); } diff --git a/generic/lib/geometric/normalize.cl b/generic/lib/geometric/normalize.cl index 95d327c..e5a521f 100644 --- a/generic/lib/geometric/normalize.cl +++ b/generic/lib/geometric/normalize.cl @@ -1,4 +1,8 @@ #include +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + #define BODY "normalize.inc" #include diff --git a/generic/lib/math/mad.cl b/generic/lib/math/mad.cl index ff0cdbb..e66e204 100644 --- a/generic/lib/math/mad.cl +++ b/generic/lib/math/mad.cl @@ -1,4 +1,8 @@ #include +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + #define BODY #include -- cgit v1.2.3