<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 5, 2018, 9:12 PM Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, 2018-03-05 at 21:02 -0600, Aaron Watry wrote:<br>
> On Wed, Feb 28, 2018 at 1:50 PM, Jan Vesely via Libclc-dev<br>
> <<a href="mailto:libclc-dev@lists.llvm.org" target="_blank">libclc-dev@lists.llvm.org</a>> wrote:<br>
> > Passes CTS on Carrizo<br>
> ><br>
> > Signed-off-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" target="_blank">jan.vesely@rutgers.edu</a>><br>
> > ---<br>
> > generic/include/clc/relational/select.h | 12 +++++++-<br>
> > generic/include/clc/relational/select.inc | 25 ++++++++++++++++<br>
> > generic/lib/SOURCES | 1 +<br>
> > generic/lib/relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a> | 7 +++++<br>
> > generic/lib/relational/select.inc | 47 +++++++++++++++++++++++++++++++<br>
> > 5 files changed, 91 insertions(+), 1 deletion(-)<br>
> > create mode 100644 generic/include/clc/relational/select.inc<br>
> > create mode 100644 generic/lib/relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a><br>
> > create mode 100644 generic/lib/relational/select.inc<br>
> ><br>
> > diff --git a/generic/include/clc/relational/select.h b/generic/include/clc/relational/select.h<br>
> > index 33a6909..d20deae 100644<br>
> > --- a/generic/include/clc/relational/select.h<br>
> > +++ b/generic/include/clc/relational/select.h<br>
> > @@ -1 +1,11 @@<br>
> > -#define select(a, b, c) ((c) ? (b) : (a))<br>
> > +/* Duplciate these so we don't have to distribute utils.h */<br>
> > +#define __CLC_CONCAT(x, y) x ## y<br>
> > +#define __CLC_XCONCAT(x, y) __CLC_CONCAT(x, y)<br>
> > +<br>
> > +#define __CLC_BODY <clc/relational/select.inc><br>
> > +#include <clc/math/gentype.inc><br>
> > +#define __CLC_BODY <clc/relational/select.inc><br>
> > +#include <clc/integer/gentype.inc><br>
> > +<br>
> > +#undef __CLC_CONCAT<br>
> > +#undef __CLC_XCONCAT<br>
><br>
> I don't mind the previous patches where you removed the #undef<br>
> __CLC_BODY lines (those were all in lib/*), but<br>
> don't we want to clean up after ourselves in the installed headers?<br>
><br>
> I'd prefer to undef __CLC_BODY here, if possible.<br>
<br>
gentype.inc (both of them) undefs this for us. compiler would complain<br>
(__CLC_BODY redefined in the next instance) otherwise.<br>
It's not nicely symmetric, but it should be correct.<br></blockquote></div><div><br></div><div>Sounds good.</div><div><br></div><div>Series looks good to me.</div><div><br></div><div>--Aaron</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Jan<br>
<br>
><br>
> --Aaron<br>
><br>
> > diff --git a/generic/include/clc/relational/select.inc b/generic/include/clc/relational/select.inc<br>
> > new file mode 100644<br>
> > index 0000000..2911009<br>
> > --- /dev/null<br>
> > +++ b/generic/include/clc/relational/select.inc<br>
> > @@ -0,0 +1,25 @@<br>
> > +#ifdef __CLC_SCALAR<br>
> > +#define __CLC_VECSIZE<br>
> > +#endif<br>
> > +<br>
> > +#if __CLC_FPSIZE == 64<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE)<br>
> > +#elif __CLC_FPSIZE == 32<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE)<br>
> > +#elif __CLC_FPSIZE == 16<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE)<br>
> > +#endif<br>
> > +<br>
> > +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z);<br>
> > +_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z);<br>
> > +<br>
> > +#ifdef __CLC_FPSIZE<br>
> > +#undef __CLC_S_GENTYPE<br>
> > +#undef __CLC_U_GENTYPE<br>
> > +#endif<br>
> > +#ifdef __CLC_SCALAR<br>
> > +#undef __CLC_VECSIZE<br>
> > +#endif<br>
> > diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES<br>
> > index 13fe4fa..f9104a3 100644<br>
> > --- a/generic/lib/SOURCES<br>
> > +++ b/generic/lib/SOURCES<br>
> > @@ -189,6 +189,7 @@ relational/<a href="http://isnormal.cl" rel="noreferrer" target="_blank">isnormal.cl</a><br>
> > relational/<a href="http://isnotequal.cl" rel="noreferrer" target="_blank">isnotequal.cl</a><br>
> > relational/<a href="http://isordered.cl" rel="noreferrer" target="_blank">isordered.cl</a><br>
> > relational/<a href="http://isunordered.cl" rel="noreferrer" target="_blank">isunordered.cl</a><br>
> > +relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a><br>
> > relational/<a href="http://signbit.cl" rel="noreferrer" target="_blank">signbit.cl</a><br>
> > shared/<a href="http://clamp.cl" rel="noreferrer" target="_blank">clamp.cl</a><br>
> > shared/<a href="http://max.cl" rel="noreferrer" target="_blank">max.cl</a><br>
> > diff --git a/generic/lib/relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a> b/generic/lib/relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a><br>
> > new file mode 100644<br>
> > index 0000000..dc2e273<br>
> > --- /dev/null<br>
> > +++ b/generic/lib/relational/<a href="http://select.cl" rel="noreferrer" target="_blank">select.cl</a><br>
> > @@ -0,0 +1,7 @@<br>
> > +#include <clc/clc.h><br>
> > +#include <utils.h><br>
> > +<br>
> > +#define __CLC_BODY <select.inc><br>
> > +#include <clc/math/gentype.inc><br>
> > +#define __CLC_BODY <select.inc><br>
> > +#include <clc/integer/gentype.inc><br>
> > diff --git a/generic/lib/relational/select.inc b/generic/lib/relational/select.inc<br>
> > new file mode 100644<br>
> > index 0000000..b990d26<br>
> > --- /dev/null<br>
> > +++ b/generic/lib/relational/select.inc<br>
> > @@ -0,0 +1,47 @@<br>
> > +#ifdef __CLC_SCALAR<br>
> > +#define __CLC_VECSIZE<br>
> > +#endif<br>
> > +<br>
> > +#if __CLC_FPSIZE == 64<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(long, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(ulong, __CLC_VECSIZE)<br>
> > +#elif __CLC_FPSIZE == 32<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(int, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(uint, __CLC_VECSIZE)<br>
> > +#elif __CLC_FPSIZE == 16<br>
> > +#define __CLC_S_GENTYPE __CLC_XCONCAT(char, __CLC_VECSIZE)<br>
> > +#define __CLC_U_GENTYPE __CLC_XCONCAT(uchar, __CLC_VECSIZE)<br>
> > +#endif<br>
> > +#ifdef __CLC_FPSIZE<br>
> > +#define __CLC_GENSIZE __CLC_FPSIZE<br>
> > +#endif<br>
> > +<br>
> > +#define __CLC_AS_S_GENTYPE __CLC_XCONCAT(as_, __CLC_S_GENTYPE)<br>
> > +#define __CLC_AS_GENTYPE __CLC_XCONCAT(as_, __CLC_GENTYPE)<br>
> > +<br>
> > +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_S_GENTYPE z)<br>
> > +{<br>
> > +#ifdef __CLC_SCALAR<br>
> > + return z ? y : x;<br>
> > +#else<br>
> > + __CLC_S_GENTYPE bitmask = z >> (__CLC_GENSIZE - 1);<br>
> > + return __CLC_AS_GENTYPE(bitselect(__CLC_AS_S_GENTYPE(x), __CLC_AS_S_GENTYPE(y), bitmask));<br>
> > +#endif<br>
> > +}<br>
> > +<br>
> > +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE select(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_U_GENTYPE z)<br>
> > +{<br>
> > + return select(x, y, __CLC_AS_S_GENTYPE(z));<br>
> > +}<br>
> > +<br>
> > +#undef __CLC_AS_S_GENTYPE<br>
> > +#undef __CLC_AS_GENTYPE<br>
> > +<br>
> > +#ifdef __CLC_FPSIZE<br>
> > +#undef __CLC_S_GENTYPE<br>
> > +#undef __CLC_U_GENTYPE<br>
> > +#undef __CLC_GENSIZE<br>
> > +#endif<br>
> > +#ifdef __CLC_SCALAR<br>
> > +#undef __CLC_VECSIZE<br>
> > +#endif<br>
> > --<br>
> > 2.14.3<br>
> ><br>
> > _______________________________________________<br>
> > Libclc-dev mailing list<br>
> > <a href="mailto:Libclc-dev@lists.llvm.org" target="_blank">Libclc-dev@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev</a><br>
</blockquote></div>