Vector.shiftER, Vector.shiftEL not working as expected.
Paul Sandoz
paul.sandoz at oracle.com
Tue Oct 10 18:22:51 UTC 2017
Hi Richard,
Thanks for reporting. It’s a silly bug in the Java implementation as these are not intensified (they lack the @HotSpotIntrinsicCandidate annotation). I just pushed a fix. We currently lack docs and testing, the latter should be easily amenable to some combinator approach.
These methods shift elements left or right into different lanes. I am not familiar with specific Intel instructions that might do this can you provide some links?
They are not btiwise operations that shift the bits of the elements. The bitwise and logical operations reside on the bitwise compatible vectors (namely for byte, short, int and long [*])
Paul.
[*] It’s an open question whether we should have a BitWise and FloatingPoint type in the hierarchy.
> On 8 Oct 2017, at 11:03, Richard Startin <richard at openkappa.co.uk> wrote:
>
> What are the methods shiftEL and shiftER supposed to do? I read these as "shift elements left/right" and expect them to behave like the PS[L|R]L[W|D|Q] instructions.
>
>
> Specifically, I expected the code below to print:
>
>
> [2, 3, 4, 5, 6, 7, 8, 0]
>
> [0, 1, 2, 3, 4, 5, 6, 7]
>
>
> int[] ymmword = new int[] {1, 2, 3, 4, 5, 6, 7, 8};
>
> int[] result = new int[8];
>
> IntVector.IntSpecies<Shapes.S256Bit> species = (IntVector.IntSpecies<Shapes.S256Bit>)Vector.speciesInstance(Integer.class, Shapes.S_256_BIT);
>
> IntVector<Shapes.256Bit> vector1 = (IntVector<Shapes.256Bit>)species.fromArray(ymmword, 0).shiftEL(1);
>
> vector1.intoArray(result, 0);
>
> System.out.println(Arrays.toString(result));// This prints [0, 1, 2, 3, 4, 5, 6, 7]
>
>
> IntVector<Shapes.256Bit> vector2 = (IntVector<Shapes.256Bit>)species.fromArray(ymmword, 0).shiftER(1);
>
> vector2.intoArray(result, 0);
>
> System.out.println(Arrays.toString(result)); // This prints [2, 2, 2, 2, 2, 2, 2, 0]
>
>
> To build the Panama code I followed the instructions at https://software.intel.com/en-us/articles/vector-api-developer-program-for-java
>
>
> Have I understood the purpose of these methods correctly and is the observed output as expected? For reference is it possible to access the intended assembly snippets for a given method?
>
>
> Thanks,
> Richard
>
>
>
>
>
>
>
>
>
>
> Richard Startin
>
More information about the panama-dev
mailing list