summaryrefslogtreecommitdiff
path: root/generic/lib/shared/max.inc
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-06-26 18:21:49 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-06-26 18:21:49 +0000
commit7424a799130628aae0c61e78299e4f5e06b2bd74 (patch)
treed1504b9e399568451112a7c59699aef8cfd039c9 /generic/lib/shared/max.inc
parentb05141061f4f14eb497f0ee1a578fb30fb220c4d (diff)
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
Diffstat (limited to 'generic/lib/shared/max.inc')
-rw-r--r--generic/lib/shared/max.inc6
1 files changed, 6 insertions, 0 deletions
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