Reduces all vector upsamples down to its scalar components, so probably not the most efficient thing in the world, but it does what the spec says it needs to do. Another possible implementation would be to convert/cast everything as unsigned if necessary, upsample the input vectors, create the upsampled value, and then cast back to signed if required. Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Tom Stellard <thomas.stellard at amd.com> llvm-svn: 186691
26 lines
985 B
C
26 lines
985 B
C
#define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
|
|
_CLC_OVERLOAD _CLC_DECL BGENTYPE upsample(GENTYPE hi, UGENTYPE lo);
|
|
|
|
#define __CLC_UPSAMPLE_VEC(BGENTYPE, GENTYPE, UGENTYPE) \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE); \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE##2, GENTYPE##2, UGENTYPE##2); \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE##3, GENTYPE##3, UGENTYPE##3); \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE##4, GENTYPE##4, UGENTYPE##4); \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE##8, GENTYPE##8, UGENTYPE##8); \
|
|
__CLC_UPSAMPLE_DECL(BGENTYPE##16, GENTYPE##16, UGENTYPE##16); \
|
|
|
|
#define __CLC_UPSAMPLE_TYPES() \
|
|
__CLC_UPSAMPLE_VEC(short, char, uchar) \
|
|
__CLC_UPSAMPLE_VEC(ushort, uchar, uchar) \
|
|
__CLC_UPSAMPLE_VEC(int, short, ushort) \
|
|
__CLC_UPSAMPLE_VEC(uint, ushort, ushort) \
|
|
__CLC_UPSAMPLE_VEC(long, int, uint) \
|
|
__CLC_UPSAMPLE_VEC(ulong, uint, uint) \
|
|
|
|
__CLC_UPSAMPLE_TYPES()
|
|
|
|
#undef __CLC_UPSAMPLE_TYPES
|
|
#undef __CLC_UPSAMPLE_DECL
|
|
#undef __CLC_UPSAMPLE_VEC
|
|
|