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

aarch64: Make use of CBZ and CBNZ when comparing unsigned values with zero

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b115
    • CPU:
      aarch64
    • OS:
      linux

      Backports

        Description

        For many times I noticed the following C2 JIT code in specJBB2005 when checking array length:

            311 0x0000007f7cd8b4f8: ldr w11, [x17,#12] ;*arraylength
            312 ; - java.lang.String::hashCode@13 (line 1467)
            313 ; implicit exception: dispatches to 0x0000007f7cd8b604
            314 0x0000007f7cd8b4fc: cmp w11, #0x0
            315 0x0000007f7cd8b500: b.le 0x0000007f7cd8b5e8 ;*ifle
            316 ; - java.lang.String::hashCode@14 (line 1467)
            317
            318 0x0000007f7cd8b504: cmp w11, #0x0
            319 0x0000007f7cd8b508: b.ls 0x0000007f7cd8b5f0
            320 0x0000007f7cd8b50c: sub w12, w11, #0x1
            321 0x0000007f7cd8b510: cmp w12, w11
            322 0x0000007f7cd8b514: b.cs 0x0000007f7cd8b5f0 ;*bipush
            323 ; - java.lang.String::hashCode@33 (line 1471)
            324
            325 0x0000007f7cd8b518: ldrh w0, [x17,#16] ;*caload
            326 ; - java.lang.String::hashCode@39 (line 1471)
            327
            328 0x0000007f7cd8b51c: sub w13, w11, #0x3
            329 0x0000007f7cd8b520: cmp w12, w13
            330 0x0000007f7cd8b524: orr w16, wzr, #0x80000000
            331 0x0000007f7cd8b528: lsl w10, w0, #5
            332 0x0000007f7cd8b52c: csel w16, w16, w13, lt
            333 0x0000007f7cd8b530: orr w1, wzr, #0x1
            334 0x0000007f7cd8b534: sub w14, w10, w0
            335 0x0000007f7cd8b538: cmp w16, #0x1
            336 0x0000007f7cd8b53c: b.le 0x0000007f7cd8b5a4
            337 0x0000007f7cd8b540: b 0x0000007f7cd8b554

          The following two instructions can be combined into one cbzw instruction:
            318 0x0000007f7cd8b504: cmp w11, #0x0
            319 0x0000007f7cd8b508: b.ls 0x0000007f7cd8b5f0

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                fyang Fei Yang
                Reporter:
                fyang Fei Yang
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: