summaryrefslogtreecommitdiffstats
path: root/libclc/generic/include/clc/math
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-07-24 18:07:14 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-07-24 18:07:14 +0000
commit7a09e88b6eac8c6b02ba02ef6b9c9d260247b7df (patch)
treeb6c37707096398927703333b18d87c2ce7bd93ba /libclc/generic/include/clc/math
parent44b6117dfde30d6cc292fabca8ecb0cef4657f7a (diff)
downloadbcm5719-llvm-7a09e88b6eac8c6b02ba02ef6b9c9d260247b7df.tar.gz
bcm5719-llvm-7a09e88b6eac8c6b02ba02ef6b9c9d260247b7df.zip
Fix double implementation of log
We need to use M_LOG2E instead of M_LOG2E_F. llvm-svn: 243132
Diffstat (limited to 'libclc/generic/include/clc/math')
-rw-r--r--libclc/generic/include/clc/math/log.h26
-rw-r--r--libclc/generic/include/clc/math/log.inc23
2 files changed, 46 insertions, 3 deletions
diff --git a/libclc/generic/include/clc/math/log.h b/libclc/generic/include/clc/math/log.h
index ee272eb30d3..5680de2c1e0 100644
--- a/libclc/generic/include/clc/math/log.h
+++ b/libclc/generic/include/clc/math/log.h
@@ -1,4 +1,24 @@
-#undef log
+/*
+ * 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.
+ */
-// log(x) = log2(x) * (1/log2(e))
-#define log(val) (log2(val) * 0.693147181f)
+#define __CLC_BODY <clc/math/log.inc>
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/include/clc/math/log.inc b/libclc/generic/include/clc/math/log.inc
new file mode 100644
index 00000000000..621dd0831b4
--- /dev/null
+++ b/libclc/generic/include/clc/math/log.inc
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE log(__CLC_GENTYPE a);
OpenPOWER on IntegriCloud