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

Vectorize unsigned shift right on signed subword types

XMLWordPrintable

    • b26
    • generic
    • generic

      In current C2 SLP, vectorization of unsigned shift right on signed subword types (byte, short) is intentionally disabled because the difference of unsigned shift behavior between the Java spec and AArch64 SIMD instructions. But in some cases where the shift amount is a constant and not larger than the amount of higher bits to be extended, the unsigned shift can be transformed into a signed shift and hence becomes vectorizable. We could consider introducing this optimization to benefit more cases.

      Testcase:
      public short[] vectorUnsignedShiftRight() {
          short[] res = new short[SIZE];
          for (int i = 0; i < SIZE; i++) {
              res[i] = (short) (shorts2[i] >>> 3);
          }
          return res;
      }

            fgao Fei Gao
            fgao Fei Gao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: