[LLVMdev] Indexed Load and Store Intrinsics - proposal

Philip Reames listmail at philipreames.com
Sun Dec 21 10:24:54 PST 2014


On 12/18/2014 11:56 AM, dag at cray.com wrote:
> "Demikhovsky, Elena" <elena.demikhovsky at intel.com> writes:
>
>> Semantics:
>> For i=0,1,…,N-1: if (Mask[i]) {*(BaseAddr + VectorOfIndices[i]*Scale)
>> = VectorValue[i];}
>> VectorValue: any float or integer vector type.
>> BaseAddr: a pointer; may be zero if full address is placed in the
>> index.
>> VectorOfIndices: a vector of i32 or i64 signed or unsigned integer
>> values.
> What about the case of a gather/scatter where the BaseAddr is zero and
> the indices are pointers?  Must we do a ptrtoint?  llvm.org is down at
> the moment but I don't think we currently have a vector ptrtoint.
I would be opposed to any representation which required the introduction 
of ptrtoint casts by the vectorizer.  If it were the only option 
available, I could be argued around, but I think we should try to avoid 
this.

More generally, I'm somewhat hesitant of representing a scatter with 
explicit base and offsets at all.  Why shouldn't the IR representation 
simply be a load from a vector of arbitrary pointers?  The backend can 
pattern match the actual gather instructions it supports and scalarize 
the rest.  The proposal being made seems very specific to the current 
generation of x86 hardware.

p.s. Where is the documentation for the existing mask load intrinsics?  
I can't find it with a quick search through the LangRef.

Philip






More information about the llvm-dev mailing list