<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 16, 2015 at 7:33 PM, Jan Vesely <span dir="ltr"><<a href="mailto:jan.vesely@rutgers.edu" target="_blank">jan.vesely@rutgers.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 2015-09-16 at 17:18 -0500, Aaron Watry wrote:<br>
> On Tue, Sep 15, 2015 at 9:42 AM, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
> wrote:<br>
><br>
> ><br>
> ><br>
> > On Tue, Sep 15, 2015 at 7:28 AM, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a><br>
> > ><br>
> > wrote:<br>
> ><br>
> > > On Thu, 2015-09-10 at 10:12 -0500, Aaron Watry wrote:<br>
> > > > The char/short return buffers were declared as ints.<br>
> > > ><br>
> > > > Signed-off-by: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br>
> > ><br>
> > > Reviewed-by: Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>><br>
> > > For both patches.<br>
> > ><br>
> > > though, I agree with Serge that a spec reference would be nice.<br>
> > ><br>
> ><br>
> > PS: don't we need to test this for *_MAX too? I'd expect at least<br>
> > char and<br>
> > short to have the same problem.<br>
> ><br>
><br>
><br>
> Yes, it seems that the _MAX values are also broken because the values<br>
> are<br>
> upgraded to ints by llvm.<br>
<br>
</span>I checked the c99 specs, section 6.4.4.1 says that the type decimal<br>
constants without suffix is the first of int, long int, long long int,<br>
in which the value can be represented.<br>
So I guess llvm is doing the right thing here.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Yeah, I believe it...  It's just sad that the CL spec doesn't take into account that the main usage of [CHAR|SHORT]_[MIN|MAX] will be for comparisons that possibly include values of those types (or something smaller than an int).<br><br></div><div>I'm updating the patches to send the _MAX values for each type through a vector/scalar round trip.<br><br></div><div>While I'm at it, do we have any consensus on how the CHAR_BIT macro should be defined?  The value of CHAR_BIT is the number of bits in a byte, but I'm not really sure if it makes sense to cast it to char as well (probably doesn't hurt anything), or if we should leave it as an int.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
Jan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
><br>
> ><br>
> > > Jan<br>
> > ><br>
> > > > ---<br>
> > > >  tests/cl/program/execute/<a href="http://int-definitions.cl" rel="noreferrer" target="_blank">int-definitions.cl</a> | 8 ++++----<br>
> > > >  1 file changed, 4 insertions(+), 4 deletions(-)<br>
> > > ><br>
> > > > diff --git a/tests/cl/program/execute/<a href="http://int-definitions.cl" rel="noreferrer" target="_blank">int-definitions.cl</a><br>
> > > > b/tests/cl/program/execute/<a href="http://int-definitions.cl" rel="noreferrer" target="_blank">int-definitions.cl</a><br>
> > > > index 3d8ee63..a438fe4 100644<br>
> > > > --- a/tests/cl/program/execute/<a href="http://int-definitions.cl" rel="noreferrer" target="_blank">int-definitions.cl</a><br>
> > > > +++ b/tests/cl/program/execute/<a href="http://int-definitions.cl" rel="noreferrer" target="_blank">int-definitions.cl</a><br>
> > > > @@ -12,12 +12,12 @@ global_size: 1 0 0<br>
> > > >  [test]<br>
> > > >  name: Char Definitions<br>
> > > >  kernel_name: test_char<br>
> > > > -arg_out: 0 buffer int[6] 8 127 -128 127 -128 255<br>
> > > > +arg_out: 0 buffer char[6] 8 127 -128 127 -128 255<br>
> > > ><br>
> > > >  [test]<br>
> > > >  name: Short Definitions<br>
> > > >  kernel_name: test_short<br>
> > > > -arg_out: 0 buffer int[3] 32767 -32768 65535<br>
> > > > +arg_out: 0 buffer short[3] 32767 -32768 65535<br>
> > > ><br>
> > > >  [test]<br>
> > > >  name: Int Definitions<br>
> > > > @@ -32,7 +32,7 @@ arg_out: 0 buffer long[3] 9223372036854775807<br>
> > > > \<br>
> > > >                            18446744073709551615<br>
> > > >  !*/<br>
> > > ><br>
> > > > -kernel void test_char(global int* out) {<br>
> > > > +kernel void test_char(global char* out) {<br>
> > > >    int i = 0;<br>
> > > >    out[i++] = CHAR_BIT;<br>
> > > >    out[i++] = CHAR_MAX;<br>
> > > > @@ -42,7 +42,7 @@ kernel void test_char(global int* out) {<br>
> > > >    out[i++] = UCHAR_MAX;<br>
> > > >  }<br>
> > > ><br>
> > > > -kernel void test_short(global int* out) {<br>
> > > > +kernel void test_short(global short* out) {<br>
> > > >    int i = 0;<br>
> > > >    out[i++] = SHRT_MAX;<br>
> > > >    out[i++] = (SHRT_MIN - (short2)(0)).s0;<br>
> > ><br>
> ><br>
> ><br>
</div></div></blockquote></div><br></div></div>