<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 16 Mar 2018, at 19:22, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Thu, 2018-03-15 at 22:20 +0100, Jeroen Ketema via Libclc-dev wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Hi Jan,<br class=""><br class="">Sorry for being a bit late with this. Why was this change to select<br class="">needed? The ternary operator should behave like select in the case of<br class="">vectors and is implemented in Clang as such.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Ah, right. The specs explicitly states that vector ?: is equivalent to</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">select. Even if it's counter-intuitive (both in terms of truth</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">evaluation, and the fact that it evaluates both expressions).</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I'd still prefer to have a function rather than macro, but the #else</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">path definitely redundant.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Yes, agreed on keeping the function. It probably results in slightly better</div><div>compiler errors and warnings.</div><div><br class=""></div><div>Jeroen</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">thanks,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Jan</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">Jeroen<br class=""><br class=""><blockquote type="cite" class="">On 28 Feb 2018, at 20:50, Jan Vesely via Libclc-dev <<a href="mailto:libclc-dev@lists.llvm.org" class="">libclc-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Passes CTS on Carrizo<br class=""><br class="">Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a>><br class="">---<br class="">generic/include/clc/relational/select.h   | 12 +++++++-<br class="">generic/include/clc/relational/select.inc | 25 ++++++++++++++++<br class="">generic/lib/SOURCES                       |  1 +<br class="">generic/lib/relational/select.cl          |  7 +++++<br class="">generic/lib/relational/select.inc         | 47 +++++++++++++++++++++++++++++++<br class="">5 files changed, 91 insertions(+), 1 deletion(-)<br class="">create mode 100644 generic/include/clc/relational/select.inc<br class="">create mode 100644 generic/lib/relational/select.cl<br class="">create mode 100644 generic/lib/relational/select.inc<br class=""><br class="">diff --git a/generic/include/clc/relational/select.h b/generic/include/clc/relational/select.h<br class="">index 33a6909..d20deae 100644<br class="">--- a/generic/include/clc/relational/select.h<br class="">+++ b/generic/include/clc/relational/select.h<br class="">@@ -1 +1,11 @@<br class="">-#define select(a, b, c) ((c) ? (b) : (a))<br class="">+/* Duplciate these so we don't have to distribute utils.h */<br class="">+#define __CLC_CONCAT(x, y) x ## y<br class="">+#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y)<br class="">+<br class="">+#define __CLC_BODY <clc/relational/select.inc><br class="">+#include <clc/math/gentype.inc><br class="">+#define __CLC_BODY <clc/relational/select.inc><br class="">+#include <clc/integer/gentype.inc><br class="">+<br class="">+#undef __CLC_CONCAT<br class="">+#undef __CLC_XCONCAT<br class="">diff --git a/generic/include/clc/relational/select.inc b/generic/include/clc/relational/select.inc<br class="">new file mode 100644<br class="">index 0000000..2911009<br class="">--- /dev/null<br class="">+++ b/generic/include/clc/relational/select.inc<br class="">@@ -0,0 +1,25 @@<br class="">+#ifdef __CLC_SCALAR<br class="">+#define __CLC_VECSIZE<br class="">+#endif<br class="">+<br class="">+#if __CLC_FPSIZE == 64<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#elif __CLC_FPSIZE == 32<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#elif __CLC_FPSIZE == 16<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#endif<br class="">+<br class="">+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z);<br class="">+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z);<br class="">+<br class="">+#ifdef __CLC_FPSIZE<br class="">+#undef __CLC_S_GENTYPE<br class="">+#undef __CLC_U_GENTYPE<br class="">+#endif<br class="">+#ifdef __CLC_SCALAR<br class="">+#undef __CLC_VECSIZE<br class="">+#endif<br class="">diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES<br class="">index 13fe4fa..f9104a3 100644<br class="">--- a/generic/lib/SOURCES<br class="">+++ b/generic/lib/SOURCES<br class="">@@ -189,6 +189,7 @@ relational/isnormal.cl<br class="">relational/isnotequal.cl<br class="">relational/isordered.cl<br class="">relational/isunordered.cl<br class="">+relational/select.cl<br class="">relational/signbit.cl<br class="">shared/clamp.cl<br class="">shared/max.cl<br class="">diff --git a/generic/lib/relational/select.cl b/generic/lib/relational/select.cl<br class="">new file mode 100644<br class="">index 0000000..dc2e273<br class="">--- /dev/null<br class="">+++ b/generic/lib/relational/select.cl<br class="">@@ -0,0 +1,7 @@<br class="">+#include <clc/clc.h><br class="">+#include <utils.h><br class="">+<br class="">+#define __CLC_BODY <select.inc><br class="">+#include <clc/math/gentype.inc><br class="">+#define __CLC_BODY <select.inc><br class="">+#include <clc/integer/gentype.inc><br class="">diff --git a/generic/lib/relational/select.inc b/generic/lib/relational/select.inc<br class="">new file mode 100644<br class="">index 0000000..b990d26<br class="">--- /dev/null<br class="">+++ b/generic/lib/relational/select.inc<br class="">@@ -0,0 +1,47 @@<br class="">+#ifdef __CLC_SCALAR<br class="">+#define __CLC_VECSIZE<br class="">+#endif<br class="">+<br class="">+#if __CLC_FPSIZE == 64<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#elif __CLC_FPSIZE == 32<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#elif __CLC_FPSIZE == 16<br class="">+#define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE)<span class="Apple-converted-space"> </span><br class="">+#endif<br class="">+#ifdef __CLC_FPSIZE<br class="">+#define __CLC_GENSIZE   __CLC_FPSIZE<br class="">+#endif<br class="">+<br class="">+#define __CLC_AS_S_GENTYPE __CLC_XCONCAT(as_, __CLC_S_GENTYPE)<br class="">+#define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)<br class="">+<br class="">+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z)<br class="">+{<br class="">+#ifdef __CLC_SCALAR<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>return z ? y : x;<br class="">+#else<br class="">+<span class="Apple-tab-span" style="white-space: pre;">        </span>__CLC_S_GENTYPE bitmask = z >> (__CLC_GENSIZE - 1);<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span>return __CLC_AS_GENTYPE(bitselect(__CLC_AS_S_GENTYPE(x), __CLC_AS_S_GENTYPE(y), bitmask));<br class="">+#endif<br class="">+}<br class="">+<br class="">+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z)<br class="">+{<br class="">+<span class="Apple-tab-span" style="white-space: pre;">    </span>return select(x, y, __CLC_AS_S_GENTYPE(z));<br class="">+}<br class="">+<br class="">+#undef __CLC_AS_S_GENTYPE<br class="">+#undef __CLC_AS_GENTYPE<br class="">+<br class="">+#ifdef __CLC_FPSIZE<br class="">+#undef __CLC_S_GENTYPE<br class="">+#undef __CLC_U_GENTYPE<br class="">+#undef __CLC_GENSIZE<br class="">+#endif<br class="">+#ifdef __CLC_SCALAR<br class="">+#undef __CLC_VECSIZE<br class="">+#endif<br class="">--<span class="Apple-converted-space"> </span><br class="">2.14.3<br class=""><br class="">_______________________________________________<br class="">Libclc-dev mailing list<br class=""><a href="mailto:Libclc-dev@lists.llvm.org" class="">Libclc-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev<br class=""></blockquote><br class="">_______________________________________________<br class="">Libclc-dev mailing list<br class=""><a href="mailto:Libclc-dev@lists.llvm.org" class="">Libclc-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Jan Vesely <</span><a href="mailto:jan.vesely@rutgers.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">jan.vesely@rutgers.edu</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">></span></div></blockquote></div><br class=""></body></html>