VectorAPI VectorInsert Intrinsic

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Jun 5 23:30:54 UTC 2018


> http://cr.openjdk.java.net/~srukmannagar/VectorAPI_vectorInsert/webrev.00/

Overall, looks good!

+instruct rvinsert32B(vecY dst, vecY src, vecY tmp, rRegI val, immI idx) %{
...
+    if(id <= 15) {
...
+      __ vpinsrb($tmp$$XMMRegister, $tmp$$XMMRegister, $val$$Register, 
id - 16);
...

+  instruct rvinsert8D(vecZ dst, vecZ src, vecZ tmp, regD val, rRegL 
tmp1, immI idx) %{
+      } else if(id <= 5) {
...
+        __ vpinsrq($tmp$$XMMRegister, $tmp$$XMMRegister, 
$tmp1$$Register, id - 6);

"id - 16", "id - 6". Looks like copy-paste errors.



+instruct rvinsert8B(vecD dst, vecD src, rRegI val, immI idx) %{
...
+    int id = 0x7 & $idx$$constant;

I'd prefer to see "immU3 idx" instead. idx should always be in-bound and 
it's validated on JDK side before calling intrinsic.


On a more general topic: what are the plans for optimizing variable 
indexed element accesses? It would be unfortunate if a non-constant 
index usage caused vector boxing.

I remember I played with dispatch tables [1] and it worked ok. Are there 
better alternatives available?

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/panama/dev/file/dd9ee9434abe/test/jdk/panama/snippets/VectorUtils.java#l300


More information about the panama-dev mailing list