Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365308

VectorAPI: Optimize VectorMask.toVector() with a hotspot intrinsic call

XMLWordPrintable

      Currently API "VectorMask.toVector()" is implemented with broadcast and blend optimizations:
      ```
      @ForceInline
      AbstractVector<E> toVectorTemplate() {
          AbstractSpecies<E> vsp = this.vspecies();
          Vector<E> zero = vsp.broadcast(0L);
          Vector<E> mone = vsp.broadcast(-1L);
          return (AbstractVector)zero.blend(mone, this);
      }
      ```
      This can be optimized by doing hotspot intrinsify directly. This is a cheap operation on some architectures like AArch64. No code should be generated on NEON, while a single `cpy` is needed on SVE. As the fallback implementation, we can use the original blend pattern if architectures do not support the direct vector instruction for this API.

            xgong Xiaohong Gong
            xgong Xiaohong Gong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: