[cfe-dev] [OpenCL patch] support for __builtin_astype, __builtin_convert, __builtin_vec_step

Anton Lokhmotov Anton.Lokhmotov at arm.com
Mon Mar 21 02:45:23 PDT 2011


Hi Chris,

> I'm not familiar with any of the OpenCL implementations that exist, but
> it seems that the best way to represent this is as either: 1) a
> function call to a properly overloaded set of functions (with
> attribute(overload)
Yes, as I mentioned, I view as/convert_<dst_type>(<src_type>) as a family of
built-in functions overloaded on the <src_type> [by declaring them with
__attribute__((overloadable))].

> or 2) as a specific new Expr subclass to represent this.
I'm not in favour of this approach because then one would argue that all
OpenCL built-ins should be represented as Expr subclasses.  I don't think
there's need for this.

> Defining these in terms of a macro that expands out to a bunch of 
> builtins seems to obfuscate a lot of semantic information.
Agree.

Cheers,
Anton.







More information about the cfe-dev mailing list