Several users of (mostly math/) gentype.inc rely on types other than the 'gentype'. This is commonly intN as several maths builtins expose this as a return or paramter type. We were previously explicitly defining this type for every gentype. Other implementations rely on integer types of the same size and element width as the gentype, such as short/ushort for half, long/ulong for double, etc. Users might also rely on as_type or convert_type builtins to/from these types. The previous method we used to define intN was unscalable if we wanted to expose more types and helpers. This commit introduces a simpler system whereby several macros are defined at the beginning of gentype.inc. These rely on concatenating with the vector size. To facilitate this system, scalar gentypes now define an empty vector size. It was previously undefined, which was dangerous. An added benefit is that it matches how the integer gentype.inc vector size has been working. These macros will be especially helpful for the definitions of logb/ilogb in an upcoming patch.
24 lines
662 B
PHP
24 lines
662 B
PHP
#if __CLC_FPSIZE == 32
|
|
|
|
#ifndef __CLC_SCALAR
|
|
|
|
#if __CLC_VECSIZE == 3
|
|
# define __CLC_OFFSET 4
|
|
#else
|
|
# define __CLC_OFFSET __CLC_VECSIZE
|
|
#endif
|
|
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __private);
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __local);
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __global);
|
|
FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_OFFSET, __CLC_GENTYPE, __constant);
|
|
|
|
#undef __CLC_OFFSET
|
|
#else
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __private);
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __local);
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __global);
|
|
FUNC(, 1, 1, __CLC_GENTYPE, __constant);
|
|
#endif
|
|
#endif
|