[libclc] r276704 - Make min follow the OCL 1.0 specs
Jan Vesely via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 25 15:36:23 PDT 2016
Author: jvesely
Date: Mon Jul 25 17:36:22 2016
New Revision: 276704
URL: http://llvm.org/viewvc/llvm-project?rev=276704&view=rev
Log:
Make min follow the OCL 1.0 specs
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>
Modified:
libclc/trunk/generic/lib/shared/min.inc
Modified: libclc/trunk/generic/lib/shared/min.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/min.inc?rev=276704&r1=276703&r2=276704&view=diff
==============================================================================
--- libclc/trunk/generic/lib/shared/min.inc (original)
+++ libclc/trunk/generic/lib/shared/min.inc Mon Jul 25 17:36:22 2016
@@ -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
More information about the cfe-commits
mailing list