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

Optimize vector shift with zero shift count

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • b14
    • generic
    • generic

      Test code looks like:

         static final VectorSpecies<Byte> SPECIES = ByteVector.SPECIES_128;

         public static int iarr[];
         public static byte barr1[];
         public static byte barr2[];

         public static void shiftZero() {
           for (int i = 0; i < barr1.length; i += SPECIES.length()) {
             ByteVector vb = ByteVector.fromArray(SPECIES, barr1, i);
             vb.lanewise(VectorOperators.ASHR, 0).intoArray(barr2, i);
           }
         }
       

      https://github.com/openjdk/jdk/pull/2472 fixed the encoding problem but remains a redundant mov.

      // generated code from above test case.
        0x0000ffffb1115164: add x17, x12, x14
        0x0000ffffb1115168: ldr q16, [x17, #16]
        0x0000ffffb111516c: mov v16.16b, v16.16b // redundant?
        0x0000ffffb1115170: add x14, x13, x14
        0x0000ffffb1115174: str q16, [x14, #16]

            eliu Eric Liu
            eliu Eric Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: