summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-05-29 13:35:54 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2012-05-29 13:35:54 +0000
commit65f1c28f5dab19b12b3a00abd558bed9640901ba (patch)
tree911c2a3dac8ff84fd397a107e4a76332c27f4811
parentf69df75b298de2fb5b63e59ee4911d14cc6e462b (diff)
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
-rwxr-xr-xcompile-test.sh2
-rwxr-xr-xconfigure.py1
-rw-r--r--generic/lib/geometric/length.cl4
-rw-r--r--generic/lib/geometric/length.inc2
-rw-r--r--generic/lib/geometric/normalize.cl4
-rw-r--r--generic/lib/math/mad.cl4
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 <clc/clc.h>
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
#define BODY "length.inc"
#include <clc/geometric/floatn.inc>
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 <clc/clc.h>
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
#define BODY "normalize.inc"
#include <clc/geometric/floatn.inc>
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 <clc/clc.h>
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
#define BODY <mad.inc>
#include <clc/math/gentype.inc>