[vector] swizzle intrinsic

John Rose john.r.rose at oracle.com
Wed May 23 17:19:11 UTC 2018


Masking the indexes is a good idea. 

The Shuffle type was added to hide the representation of indexes, BTW. 

> On May 23, 2018, at 9:27 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> Hi Vivek,
> 
> Thanks. The Java changes look good. You can remove the cast of the return value from the call to VectorIntrinsics.swizzleOp.
> 
> --
> 
> Your comments on the restrictions made me wonder if, in your quest to get swizzle working, any ideas came to mind on the API design of this method and Shuffle?
> 
> The use of int values for the swizzle lane elements is causing some restrictions and i wondered how me might in future revisions resolve that. Once reason why i ask is we could do reversal of say a vector of ints by rebracketing to bytes, performing a swizzle to flip the bytes associated with the ints, then rebracketing back to ints.
> 
> I wonder if the shuffle values should be masked by the vector length -1  before being operated on. So if one creates say an Int256Shuffle with values > 8 then the values will be masked by 0x7 and extraction will return the masked result. That reduces the need to perform bounds checks, it also may give us a way to optimize since for the vector lengths we currently support internally we could implement the Shuffle using byte for lane elements even if we expose values as int. IIUC even for ARM SVE the maximum vector size is 2048 meaning the indexes would still fit in a byte for a theoretical Byte2048Shuffle, how convenient :-)
> 
> Paul.
> 
>> On May 22, 2018, at 5:46 PM, Deshpande, Vivek R <vivek.r.deshpande at intel.com> wrote:
>> 
>> Hi All
>> 
>> I would like to contribute a patch which generates intrinsics for swizzle operation for all the types.
>> For bytes it generates intrinsic code for 64 bits and 128 bits and for shorts it generates for 64, 128 and 256 bits.
>> The reason for not adding support for those sizes is, the Shuffle vector size is more than 512 bits
>> and support can be added later with more complex code.
>> For rest of the types it generates intrinsics for all the sizes.
>> 
>> Webrev:
>> http://cr.openjdk.java.net/~vdeshpande/VectorAPI_swizzle/webrev.00/
>> 
>> Regards,
>> Vivek
> 



More information about the panama-dev mailing list