[libclc] 58/291: libclc: Add clamp(vec, scalar, scalar) and max(vec, scalar)

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit 7424a799130628aae0c61e78299e4f5e06b2bd74
Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Wed Jun 26 18:21:49 2013 +0000

    libclc: Add clamp(vec, scalar, scalar) and max(vec, scalar)
    
    For any GENTYPE that isn't scalar, we need to implement a mixed
    vector/scalar version of clamp/max.
    
    This depends on the min() patches I sent to the list a few minutes ago.
    
    Patch by: Aaron Watry
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@185003 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/shared/clamp.inc | 4 ++++
 generic/include/clc/shared/max.inc   | 4 ++++
 generic/lib/shared/clamp.inc         | 6 ++++++
 generic/lib/shared/max.inc           | 6 ++++++
 4 files changed, 20 insertions(+)

diff --git a/generic/include/clc/shared/clamp.inc b/generic/include/clc/shared/clamp.inc
index 3e3a435..67c8142 100644
--- a/generic/include/clc/shared/clamp.inc
+++ b/generic/include/clc/shared/clamp.inc
@@ -1 +1,5 @@
 _CLC_OVERLOAD _CLC_DECL GENTYPE clamp(GENTYPE x, GENTYPE y, GENTYPE z);
+
+#ifndef SCALAR
+_CLC_OVERLOAD _CLC_DECL GENTYPE clamp(GENTYPE x, SCALAR_GENTYPE y, SCALAR_GENTYPE z);
+#endif
diff --git a/generic/include/clc/shared/max.inc b/generic/include/clc/shared/max.inc
index ce6c6d0..9fe73c4 100644
--- a/generic/include/clc/shared/max.inc
+++ b/generic/include/clc/shared/max.inc
@@ -1 +1,5 @@
 _CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);
+
+#ifndef SCALAR
+_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, SCALAR_GENTYPE b);
+#endif
diff --git a/generic/lib/shared/clamp.inc b/generic/lib/shared/clamp.inc
index ed49b8e..58370d3 100644
--- a/generic/lib/shared/clamp.inc
+++ b/generic/lib/shared/clamp.inc
@@ -1,3 +1,9 @@
 _CLC_OVERLOAD _CLC_DEF GENTYPE clamp(GENTYPE x, GENTYPE y, GENTYPE z) {
   return (x > z ? z : (x < y ? y : x));
 }
+
+#ifndef SCALAR
+_CLC_OVERLOAD _CLC_DEF GENTYPE clamp(GENTYPE x, SCALAR_GENTYPE y, SCALAR_GENTYPE z) {
+  return (x > (GENTYPE)z ? (GENTYPE)z : (x < (GENTYPE)y ? (GENTYPE)y : x));
+}
+#endif
\ No newline at end of file
diff --git a/generic/lib/shared/max.inc b/generic/lib/shared/max.inc
index 37409fc..6a12b6f 100644
--- a/generic/lib/shared/max.inc
+++ b/generic/lib/shared/max.inc
@@ -1,3 +1,9 @@
 _CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
   return (a > b ? a : b);
 }
+
+#ifndef SCALAR
+_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, SCALAR_GENTYPE b) {
+  return (a > (GENTYPE)b ? a : (GENTYPE)b);
+}
+#endif
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list