<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 16, 2014, at 8:05 AM, Tom Stellard <<a href="mailto:tom@stellard.net">tom@stellard.net</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Jul 15, 2014 at 05:24:47PM -0500, Aaron Watry wrote:<br><blockquote type="cite">Signed-off-by: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br>---<br>generic/include/clc/relational/signbit.h | 21 +++-------<br>generic/lib/relational/signbit.cl        | 72 +-------------------------------<br>2 files changed, 8 insertions(+), 85 deletions(-)<br><br>diff --git a/generic/include/clc/relational/signbit.h b/generic/include/clc/relational/signbit.h<br>index 774d6e0..41e5284 100644<br>--- a/generic/include/clc/relational/signbit.h<br>+++ b/generic/include/clc/relational/signbit.h<br>@@ -1,18 +1,9 @@<br>+#undef signbit<br><br></blockquote><br>What happens if someone compiles a kernel with:<br>-Dsignbit=__builtin_amdgpu_signbit<br><br>Won't the undef here break this kernel?  Are these kinds of defines<br>even allowed?<br><br>-Tom<br></div></blockquote><div><br></div><div>I also think defining most library function as macros could have unpleasant consequences on warnings. Is the final clc header preprocessed at install time or anything like that? I also noticed that none of the function are currently marked with __attribute__((const)), but nearly every function should have it.</div><div><br></div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><blockquote type="cite">-#define _CLC_SIGNBIT_DECL(TYPE, RETTYPE) \<br>-  _CLC_OVERLOAD _CLC_DECL RETTYPE signbit(TYPE x);<br>+#define __CLC_FUNCTION signbit<br>+#define __CLC_BODY <clc/relational/unary_decl.inc><br><br>-#define _CLC_VECTOR_SIGNBIT_DECL(TYPE, RETTYPE) \<br>-  _CLC_SIGNBIT_DECL(TYPE##2, RETTYPE##2)  \<br>-  _CLC_SIGNBIT_DECL(TYPE##3, RETTYPE##3)  \<br>-  _CLC_SIGNBIT_DECL(TYPE##4, RETTYPE##4)  \<br>-  _CLC_SIGNBIT_DECL(TYPE##8, RETTYPE##8)  \<br>-  _CLC_SIGNBIT_DECL(TYPE##16, RETTYPE##16)<br>+#include <clc/relational/floatn.inc><br><br>-_CLC_SIGNBIT_DECL(float, int)<br>-_CLC_VECTOR_SIGNBIT_DECL(float, int)<br>-<br>-#ifdef cl_khr_fp64<br>-_CLC_SIGNBIT_DECL(double, int)<br>-_CLC_VECTOR_SIGNBIT_DECL(double, long)<br>-#endif<br>\ No newline at end of file<br>+#undef __CLC_BODY<br>+#undef __CLC_FUNCTION<br>diff --git a/generic/lib/relational/signbit.cl b/generic/lib/relational/signbit.cl<br>index f429960..ab37d2f 100644<br>--- a/generic/lib/relational/signbit.cl<br>+++ b/generic/lib/relational/signbit.cl<br>@@ -1,61 +1,5 @@<br>#include <clc/clc.h><br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_NAME, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x){ \<br>-<span class="Apple-tab-span" style="white-space: pre;">     </span>return BUILTIN_NAME(x); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( (RET_TYPE){FUNCTION(x.lo), FUNCTION(x.hi)} != (RET_TYPE)0); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( (RET_TYPE){FUNCTION(x.lo), FUNCTION(x.hi)} != (RET_TYPE)0); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( (RET_TYPE){FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2)} != (RET_TYPE)0); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( \<br>-<span class="Apple-tab-span" style="white-space: pre;">   </span>(RET_TYPE){ \<br>-<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3) \<br>-<span class="Apple-tab-span" style="white-space: pre;">       </span>} != (RET_TYPE)0); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( \<br>-<span class="Apple-tab-span" style="white-space: pre;">     </span>(RET_TYPE){ \<br>-<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3), \<br>-<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s4), FUNCTION(x.s5), FUNCTION(x.s6), FUNCTION(x.s7) \<br>-<span class="Apple-tab-span" style="white-space: pre;">       </span>} != (RET_TYPE)0); \<br>-} \<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE, FUNCTION, ARG_TYPE) \<br>-_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG_TYPE x) { \<br>-  return (RET_TYPE)( \<br>-<span class="Apple-tab-span" style="white-space: pre;">    </span>(RET_TYPE){ \<br>-<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s0), FUNCTION(x.s1), FUNCTION(x.s2), FUNCTION(x.s3), \<br>-<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s4), FUNCTION(x.s5), FUNCTION(x.s6), FUNCTION(x.s7), \<br>-<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.s8), FUNCTION(x.s9), FUNCTION(x.sa), FUNCTION(x.sb), \<br>-<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>FUNCTION(x.sc), FUNCTION(x.sd), FUNCTION(<a href="http://x.se">x.se</a>), FUNCTION(x.sf) \<br>-<span class="Apple-tab-span" style="white-space: pre;">       </span>} != (RET_TYPE)0); \<br>-} \<br>-<br>-<br>-#define _CLC_DEFINE_RELATIONAL_UNARY(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG_TYPE) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_SCALAR(RET_TYPE, FUNCTION, BUILTIN_FUNCTION, ARG_TYPE) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC2(RET_TYPE##2, FUNCTION, ARG_TYPE##2) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC3(RET_TYPE##3, FUNCTION, ARG_TYPE##3) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC4(RET_TYPE##4, FUNCTION, ARG_TYPE##4) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC8(RET_TYPE##8, FUNCTION, ARG_TYPE##8) \<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC16(RET_TYPE##16, FUNCTION, ARG_TYPE##16) \<br>+#include "relational.h"<br><br>_CLC_DEFINE_RELATIONAL_UNARY(int, signbit, __builtin_signbitf, float)<br><br>@@ -70,18 +14,6 @@ _CLC_DEF _CLC_OVERLOAD int signbit(double x){<br><span class="Apple-tab-span" style="white-space: pre;"> </span>return __builtin_signbit(x);<br>}<br><br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC2(long2, signbit, double2)<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC3(long3, signbit, double3)<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC4(long4, signbit, double4)<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC8(long8, signbit, double8)<br>-_CLC_DEFINE_RELATIONAL_UNARY_VEC16(long16, signbit, double16)<br>+_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, signbit, double)<br><br>#endif<br>-<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_SCALAR<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_VEC2<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_VEC3<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_VEC4<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_VEC8<br>-#undef _CLC_DEFINE_RELATIONAL_UNARY_VEC16<br>\ No newline at end of file<br>--<span class="Apple-converted-space"> </span><br>1.9.1<br><br><br>_______________________________________________<br>Libclc-dev mailing list<br><a href="mailto:Libclc-dev@pcc.me.uk">Libclc-dev@pcc.me.uk</a><br>http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev<br></blockquote><br>_______________________________________________<br>Libclc-dev mailing list<br><a href="mailto:Libclc-dev@pcc.me.uk">Libclc-dev@pcc.me.uk</a><br><a href="http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev">http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev</a></div></blockquote></div><br></body></html>