[Libclc-dev] [PATCH 1/1] Make min follow the OCL 1.0 specs
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Fri Jul 22 11:18:44 PDT 2016
OpenCL 1.0: "Returns y if y < x, otherwise it returns x. If x *and* y
are infinite or NaN, the return values are undefined."
OpenCL 1.1+: "Returns y if y < x, otherwise it returns x. If x *or* y
are infinite or NaN, the return values are undefined."
The 1.0 version is stricter so use that one.
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generic/lib/shared/min.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/generic/lib/shared/min.inc b/generic/lib/shared/min.inc
index fe42864..e15e055 100644
--- a/generic/lib/shared/min.inc
+++ b/generic/lib/shared/min.inc
@@ -1,9 +1,9 @@
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_GENTYPE b) {
- return (a < b ? a : b);
+ return (b < a ? b : a);
}
#ifndef __CLC_SCALAR
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE min(__CLC_GENTYPE a, __CLC_SCALAR_GENTYPE b) {
- return (a < (__CLC_GENTYPE)b ? a : (__CLC_GENTYPE)b);
+ return (b < (__CLC_GENTYPE)a ? (__CLC_GENTYPE)b : a);
}
#endif
--
2.7.4
More information about the Libclc-dev
mailing list