This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: opaque vector types?


On Wednesday 06 May 2009, DJ Delorie wrote:
> Is there an opaque vector type?  Something that can be assigned
> to/from other vector types of the same size, without warning?
>
> I'm working on a coprocessor which has separate SIMD arithmetic
> operations for each data size, but only one SIMD logical operation for
> all sizes.  I.e. there's four ADD insns (V8QI, V4HI, etc) , but only
> one AND insn.  I'd like to use an opaque vector type for the AND
> builtin, to avoid warnings.

FWIW ARM/NEON solve this by defining the full set of builtins for all types, 
and some of them (e.g. AND) happen to expand to the same machine instructions.

In practice I'd expect this actually makes writing vector code easier/safer 
because you don't loose type safety every time you use the AND builtin.

Having some of your intrinsics be type specific, and some type agnostic seems 
a somewhat strange programming model. I'd expect everything to be types, or 
everything to use opaque vectors (and select the opcode based on the actual 
argument types). The latter is problematic because C doesn't really have 
polymorphism.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]