Are you using llvm 3.2? It's interesting that it doesn't generate any warning
message with LLVM3.3.
Here is a patch should fix the warnings on your machine, please try it.
BTW, I'd like to recommend all of us to switch to LLVM 3.3 from LLVM 3.2. We
already found some
issues with LLVM 3.2.
On Tue, Sep 03, 2013 at 09:21:23AM +0000, Sun, Yi wrote:
> Hi Zhigang,
>
> Your patch introduced lots of warning while compiling like following:
> /home/OpenCL/beignet/backend/src/ocl_stdlib.h:14305:68: warning: shift count
> >= width of type
> {return (long2)(select(param0.s0, param1.s0, (long)(param2.s0 & (1 <<
> (sizeof(long)*8 - 1)))), select(param0.s1, param1.s1, (long)(param2.s1 & (1
> << (sizeof(long)*8 - 1))))); }
> ^
> ~~~~~~~~~~~~~~~~~~~~
>
> The detail is attached.
>
> Thanks
> --Sun, Yi
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of
> > Xing, Homer
> > Sent: Tuesday, September 3, 2013 3:40 PM
> > To: Zhigang Gong
> > Cc: [email protected]
> > Subject: Re: [Beignet] [PATCH] add all versions of built-in function
> > "select"
> >
> > OK. Your patch looks good to me.
> >
> > -----Original Message-----
> > From: Zhigang Gong [mailto:[email protected]]
> > Sent: Tuesday, September 3, 2013 3:41 PM
> > To: Xing, Homer
> > Cc: [email protected]
> > Subject: Re: [Beignet] [PATCH] add all versions of built-in function
> > "select"
> >
> > Homer,
> >
> > It's better to enhance our autoneration script to generate the select vector
> > functions. The attached is the patch, please review and give your comments,
> > thanks.
> >
> >
> > On Mon, Sep 02, 2013 at 01:03:30PM +0800, Homer Hsing wrote:
> > > some data type was missing in vector version of built-in function "select"
> > > this patch adds missing versions.
> > >
> > > Signed-off-by: Homer Hsing <[email protected]>
> > > ---
> > > backend/src/ocl_stdlib.tmpl.h | 107
> > > +++++++++++++++++++++++++++++++++---------
> > > 1 file changed, 84 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/backend/src/ocl_stdlib.tmpl.h
> > > b/backend/src/ocl_stdlib.tmpl.h index 7d8d480..8bb15e6 100644
> > > --- a/backend/src/ocl_stdlib.tmpl.h
> > > +++ b/backend/src/ocl_stdlib.tmpl.h
> > > @@ -1439,29 +1439,90 @@ DEF(float, int) DEF(float, uint) #undef DEF
> > >
> > > -// This will be optimized out by LLVM and will output LLVM select
> > > instructions -#define DECL_SELECT4(TYPE4, TYPE, COND_TYPE4, MASK) \
> > > -INLINE_OVERLOADABLE TYPE4 select(TYPE4 src0, TYPE4 src1, COND_TYPE4
> > > cond) { \
> > > - TYPE4 dst; \
> > > - const TYPE x0 = src0.x; /* Fix performance issue with CLANG */ \
> > > - const TYPE x1 = src1.x; \
> > > - const TYPE y0 = src0.y; \
> > > - const TYPE y1 = src1.y; \
> > > - const TYPE z0 = src0.z; \
> > > - const TYPE z1 = src1.z; \
> > > - const TYPE w0 = src0.w; \
> > > - const TYPE w1 = src1.w; \
> > > - dst.x = (cond.x & MASK) ? x1 : x0; \
> > > - dst.y = (cond.y & MASK) ? y1 : y0; \
> > > - dst.z = (cond.z & MASK) ? z1 : z0; \
> > > - dst.w = (cond.w & MASK) ? w1 : w0; \
> > > - return dst; \
> > > -}
> > > -DECL_SELECT4(int4, int, int4, 0x80000000) -DECL_SELECT4(int4, int,
> > > uint4, 0x80000000) -DECL_SELECT4(float4, float, int4, 0x80000000)
> > > -DECL_SELECT4(float4, float, uint4, 0x80000000) -#undef DECL_SELECT4
> > > +#define DEF2(TYPE, COND_TYPE, MASK) \
> > > + INLINE_OVERLOADABLE TYPE##2 select(TYPE##2 x, TYPE##2 y,
> > COND_TYPE##2 z) { \
> > > + return (TYPE##2)(select(x.s0, y.s0, (COND_TYPE)(z.s0 & MASK)), \
> > > + select(x.s1, y.s1, (COND_TYPE)(z.s1 & MASK))); \
> > > + }
> > > +
> > > +#define DEF3(TYPE, COND_TYPE, MASK) \
> > > + INLINE_OVERLOADABLE TYPE##3 select(TYPE##3 x, TYPE##3 y,
> > COND_TYPE##3 z) { \
> > > + return (TYPE##3)(select(x.s0, y.s0, (COND_TYPE)(z.s0 & MASK)), \
> > > + select(x.s1, y.s1, (COND_TYPE)(z.s1 & MASK)), \
> > > + select(x.s2, y.s2, (COND_TYPE)(z.s2 & MASK))); \
> > > + }
> > > +
> > > +#define DEF4(TYPE, COND_TYPE, MASK) \
> > > + INLINE_OVERLOADABLE TYPE##4 select(TYPE##4 x, TYPE##4 y,
> > COND_TYPE##4 z) { \
> > > + return (TYPE##4)(select(x.s0, y.s0, (COND_TYPE)(z.s0 & MASK)), \
> > > + select(x.s1, y.s1, (COND_TYPE)(z.s1 & MASK)), \
> > > + select(x.s2, y.s2, (COND_TYPE)(z.s2 & MASK)), \
> > > + select(x.s3, y.s3, (COND_TYPE)(z.s3 & MASK))); \
> > > + }
> > > +
> > > +#define DEF8(TYPE, COND_TYPE, MASK) \
> > > + INLINE_OVERLOADABLE TYPE##8 select(TYPE##8 x, TYPE##8 y,
> > COND_TYPE##8 z) { \
> > > + return (TYPE##8)(select(x.s0, y.s0, (COND_TYPE)(z.s0 & MASK)), \
> > > + select(x.s1, y.s1, (COND_TYPE)(z.s1 & MASK)), \
> > > + select(x.s2, y.s2, (COND_TYPE)(z.s2 & MASK)), \
> > > + select(x.s3, y.s3, (COND_TYPE)(z.s3 & MASK)), \
> > > + select(x.s4, y.s4, (COND_TYPE)(z.s4 & MASK)), \
> > > + select(x.s5, y.s5, (COND_TYPE)(z.s5 & MASK)), \
> > > + select(x.s6, y.s6, (COND_TYPE)(z.s6 & MASK)), \
> > > + select(x.s7, y.s7, (COND_TYPE)(z.s7 & MASK))); \
> > > + }
> > > +
> > > +#define DEF16(TYPE, COND_TYPE, MASK) \
> > > + INLINE_OVERLOADABLE TYPE##16 select(TYPE##16 x, TYPE##16 y,
> > COND_TYPE##16 z) { \
> > > + return (TYPE##16)(select(x.s0, y.s0, (COND_TYPE)(z.s0 & MASK)), \
> > > + select(x.s1, y.s1, (COND_TYPE)(z.s1 & MASK)), \
> > > + select(x.s2, y.s2, (COND_TYPE)(z.s2 & MASK)), \
> > > + select(x.s3, y.s3, (COND_TYPE)(z.s3 & MASK)), \
> > > + select(x.s4, y.s4, (COND_TYPE)(z.s4 & MASK)), \
> > > + select(x.s5, y.s5, (COND_TYPE)(z.s5 & MASK)), \
> > > + select(x.s6, y.s6, (COND_TYPE)(z.s6 & MASK)), \
> > > + select(x.s7, y.s7, (COND_TYPE)(z.s7 & MASK)), \
> > > + select(x.s8, y.s8, (COND_TYPE)(z.s8 & MASK)), \
> > > + select(x.s9, y.s9, (COND_TYPE)(z.s9 & MASK)), \
> > > + select(x.sa, y.sa, (COND_TYPE)(z.sa & MASK)), \
> > > + select(x.sb, y.sb, (COND_TYPE)(z.sb & MASK)), \
> > > + select(x.sc, y.sc, (COND_TYPE)(z.sc & MASK)), \
> > > + select(x.sd, y.sd, (COND_TYPE)(z.sd & MASK)), \
> > > + select(x.se, y.se, (COND_TYPE)(z.se & MASK)), \
> > > + select(x.sf, y.sf, (COND_TYPE)(z.sf & MASK))); \
> > > + }
> > > +
> > > +#define DEF(TYPE, COND_TYPE, MASK) \
> > > + DEF2(TYPE, COND_TYPE, MASK) \
> > > + DEF3(TYPE, COND_TYPE, MASK) \
> > > + DEF4(TYPE, COND_TYPE, MASK) \
> > > + DEF8(TYPE, COND_TYPE, MASK) \
> > > + DEF16(TYPE, COND_TYPE, MASK)
> > > +
> > > +DEF(char, char, 0x80)
> > > +DEF(char, uchar, 0x80)
> > > +DEF(uchar, char, 0x80)
> > > +DEF(uchar, uchar, 0x80)
> > > +DEF(short, short, 0x8000)
> > > +DEF(short, ushort, 0x8000)
> > > +DEF(ushort, short, 0x8000)
> > > +DEF(ushort, ushort, 0x8000)
> > > +DEF(int, int, 0x80000000)
> > > +DEF(int, uint, 0x80000000)
> > > +DEF(uint, int, 0x80000000)
> > > +DEF(uint, uint, 0x80000000)
> > > +DEF(long, long, 0x8000000000000000UL) DEF(long, ulong,
> > > +0x8000000000000000UL) DEF(ulong, long, 0x8000000000000000UL)
> > > +DEF(ulong, ulong, 0x8000000000000000UL) DEF(float, int, 0x80000000)
> > > +DEF(float, uint, 0x80000000) #undef DEF #undef DEF2 #undef DEF3
> > > +#undef DEF4 #undef DEF8 #undef DEF16
> > >
> > >
> > > //////////////////////////////////////////////////////////////////////
> > > /////// // Common Functions (see 6.11.4 of OCL 1.1 spec)
> > > --
> > > 1.8.1.2
> > >
> > > _______________________________________________
> > > Beignet mailing list
> > > [email protected]
> > > http://lists.freedesktop.org/mailman/listinfo/beignet
> > _______________________________________________
> > Beignet mailing list
> > [email protected]
> > http://lists.freedesktop.org/mailman/listinfo/beignet
>From ff6d93cbc44b696ae7a68f439441e97ca52e892b Mon Sep 17 00:00:00 2001
From: Zhigang Gong <[email protected]>
Date: Tue, 3 Sep 2013 18:01:32 +0800
Subject: [PATCH] GBE: silent the compilation warning when generate the pch
file.
Signed-off-by: Zhigang Gong <[email protected]>
---
backend/src/gen_builtin_vector.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/src/gen_builtin_vector.py b/backend/src/gen_builtin_vector.py
index cf023e7..cfd32b0 100755
--- a/backend/src/gen_builtin_vector.py
+++ b/backend/src/gen_builtin_vector.py
@@ -312,7 +312,7 @@ class builtinProto():
formatStr += '({} {} *)param{} + {:2d}'.format(ptype[2], ptype[0], n, j)
else:
if (self.functionName == 'select' and n == 2):
- formatStr += '({})(param{}.s{:x} & (1 << (sizeof({})*8 - 1)))'.format(ptype[0], n, j, ptype[0])
+ formatStr += '({0})(param{1}.s{2:x} & ({0})(1 << (sizeof({0})*8 - 1)))'.format(ptype[0], n, j)
else:
formatStr += 'param{}.s{:x}'.format(n, j)
--
1.7.9.5
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet