[vectorIntrinsics] RFR: 8283316: Add new vector operation REVERSE_BYTES

Xiaohong Gong xgong at openjdk.java.net
Fri Mar 18 03:18:59 UTC 2022


On Thu, 17 Mar 2022 15:39:33 GMT, Swati Sharma <duke at openjdk.java.net> wrote:

> Hi All,
> 
> Summary of changes:
> a) Java implementation of new vector operation REVERSE_BYTES for all  integral types.
> b) Extended existing JTREG and JMH suite with test points corresponding to new operations.
> 
> Please review and share your feedback.
> 
> Thanks,
> Swati

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 1812:

> 1810:         return b;
> 1811:     }
> 1812:     static int reverseBytes(byte a) {

Please insert a blank like between the two methods. Thanks!

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 1812:

> 1810:         return b;
> 1811:     }
> 1812:     static int reverseBytes(byte a) {

Can we return a "byte" type here?

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java line 1813:

> 1811:         return b;
> 1812:     }
> 1813:     static int reverseBytes(short a) {

Can it return "short" ?

test/jdk/jdk/incubator/vector/Byte128VectorTests.java line 1229:

> 1227: 
> 1228:     static byte REVERSE_BYTES_scalar(byte a) {
> 1229:         return (byte) a;

Can we remove the "cast" ?

test/jdk/jdk/incubator/vector/templates/Unit-header.template line 1513:

> 1511: #end[short]
> 1512: #end[intOrLong]
> 1513:     }

Is it possible to move these scalar operations into the `gen-template.sh `? It can also generate different codes for different types. And the codes can be generated finally by `Unit-Unary-Scalar-op.template`. I guess it doesn't need to add the same codes both in `Perf-Scalar-header.template` after then.

-------------

PR: https://git.openjdk.java.net/panama-vector/pull/181


More information about the panama-dev mailing list