diff options
author | Show Liu <show.liu@linaro.org> | 2015-06-22 16:22:35 +0800 |
---|---|---|
committer | Gil Pitney <gil.pitney@linaro.org> | 2015-06-23 01:20:36 +0000 |
commit | 634950819358e754e7dfb83a91f6c1d9253ba0e8 (patch) | |
tree | 253ea0177e8b65a2de66bf23ccfb2cfd4148f73e | |
parent | 5579456e68c0a91b3596169461bf276405251041 (diff) |
fixed the mul_hi() builtin function crash issue
-rw-r--r-- | src/builtins/mul_hi.cl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/builtins/mul_hi.cl b/src/builtins/mul_hi.cl index 5b3368e..ad94af0 100644 --- a/src/builtins/mul_hi.cl +++ b/src/builtins/mul_hi.cl @@ -92,6 +92,36 @@ _CLC_OVERLOAD _CLC_DEF ulong mul_hi(ulong x, ulong y) return (f + (hadd(o, (i + (l>>32))) >> 31)); } +_CLC_OVERLOAD _CLC_DEF char mul_hi(char x, char y) +{ + return( (char)(((short)x * (short)y) >> 8)); +} + +_CLC_OVERLOAD _CLC_DEF uchar mul_hi(uchar x, uchar y) +{ + return( (char)(((ushort)x * (ushort)y) >> 8)); +} + +_CLC_OVERLOAD _CLC_DEF short mul_hi(short x, short y) +{ + return( (short)(((int)x * (int)y) >> 16)); +} + +_CLC_OVERLOAD _CLC_DEF ushort mul_hi(ushort x, ushort y) +{ + return( (ushort)(((uint)x * (uint)y) >> 16)); +} + +_CLC_OVERLOAD _CLC_DEF int mul_hi(int x, int y) +{ + return( (int)(((long)x * (long)y) >> 32)); +} + +_CLC_OVERLOAD _CLC_DEF uint mul_hi(uint x, uint y) +{ + return( (uint)(((ulong)x * (ulong)y) >> 32)); +} + BINARY_VEC_DEF(char, char, mul_hi, mul_hi) BINARY_VEC_DEF(uchar, uchar, mul_hi, mul_hi) BINARY_VEC_DEF(short, short, mul_hi, mul_hi) |