[aarch64-port-dev ] RFR: 8152537 : aarch64: Make use of CBZ and CBNZ when comparing unsigned values with zero

Felix Yang felix.yang at linaro.org
Wed Mar 23 14:05:10 UTC 2016


Hi,

    Please review webrev:
http://cr.openjdk.java.net/~fyang/8152537/webrev.00
    JIRA issue: https://bugs.openjdk.java.net/browse/JDK-8152537

    For many times I noticed the following C2 JIT code in specJBB2005 and
other benchmarks:

    0x0000007f7cd8b4f8: ldr w11, [x17,#12] ;*arraylength
                                                              ; -
java.lang.String::hashCode at 13 (line 1467)
                                                              ; implicit
exception: dispatches to 0x0000007f7cd8b604
    0x0000007f7cd8b4fc: cmp w11, #0x0
    0x0000007f7cd8b500: b.le 0x0000007f7cd8b5e8 ;*ifle
                                                              ; -
java.lang.String::hashCode at 14 (line 1467)

    0x0000007f7cd8b504: cmp w11, #0x0
    0x0000007f7cd8b508: b.ls 0x0000007f7cd8b5f0
    0x0000007f7cd8b50c: sub w12, w11, #0x1
    0x0000007f7cd8b510: cmp w12, w11
    0x0000007f7cd8b514: b.cs 0x0000007f7cd8b5f0 ;*bipush
                                                              ; -
java.lang.String::hashCode at 33 (line 1471)

    0x0000007f7cd8b518: ldrh w0, [x17,#16] ;*caload
                                                              ; -
java.lang.String::hashCode at 39 (line 1471)

    0x0000007f7cd8b51c: sub w13, w11, #0x3
    0x0000007f7cd8b520: cmp w12, w13
    0x0000007f7cd8b524: orr w16, wzr, #0x80000000
    0x0000007f7cd8b528: lsl w10, w0, #5
    0x0000007f7cd8b52c: csel w16, w16, w13, lt
    0x0000007f7cd8b530: orr w1, wzr, #0x1
    0x0000007f7cd8b534: sub w14, w10, w0
    0x0000007f7cd8b538: cmp w16, #0x1
    0x0000007f7cd8b53c: b.le 0x0000007f7cd8b5a4
    0x0000007f7cd8b540: b 0x0000007f7cd8b554

    Patch combines the following two instructions into one cbzw instruction:
    0x0000007f7cd8b504: cmp w11, #0x0
    0x0000007f7cd8b508: b.ls 0x0000007f7cd8b5f0

    Tested with JTreg hotspot, langtools and jdk.  Is it OK?

Thanks,
Felix


More information about the aarch64-port-dev mailing list