Vector.shiftER, Vector.shiftEL not working as expected.
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Tue Oct 10 11:51:05 UTC 2017
Richard has some problems posting on the list, so I'm doing that on his
behalf.
Best regards,
Vladimir Ivanov
------------------------------------------------------------------------
*From:* Richard Startin
*Sent:* 08 October 2017 19:03:09
*To:* panama-dev at openjdk.java.net
*Subject:* Vector.shiftER, Vector.shiftEL not working as expected.
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
More information about the panama-dev
mailing list