[jdk16] RFR: 8260585: AArch64: Wrong code generated for shifting right and accumulating four unsigned short integers [v3]

Andrew Haley aph at redhat.com
Mon Feb 1 12:32:00 UTC 2021


On 2/1/21 8:11 AM, dongbo (E) wrote:
> The tests passed with the newest version and still can catch the typo.
> Also tested a few of injected errors, the tests failed as expected.

One oddity has come up.

I'm running compiler/c2/TestShiftRightAndAccumulate
and the generated code I see for compiler.c2.TestShiftRightAndAccumulate::test_shorts
looks like:

;; B313: #     out( B313 B314 ) <- in( B312 B313 ) Loop( B313-B313 inner main of N1776 strip mined) Freq: 1006.03
  0x0000ffff70394cb0:   sbfiz   x16, x13, #1, #32           ;*saload {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 268 (line 156)
  0x0000ffff70394cb4:   add     xmethod, xbcp, x16          ;*saload {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - jdk.internal.util.ArraysSupport::mismatch at 9 (line 362)
                                                            ; - java.util.Arrays::equals at 31 (line 2518)
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 286 (line 158)
  0x0000ffff70394cb8:   add     x14, xdispatch, x16         ;*iconst_m1 {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - jdk.internal.util.ArraysSupport::mismatch at 70 (line 376)
                                                            ; - java.util.Arrays::equals at 31 (line 2518)
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 213 (line 152)
  0x0000ffff70394cbc:   ldrsh   w11, [xmethod,#16]
  0x0000ffff70394cc0:   ldrsh   w15, [x14,#16]
  0x0000ffff70394cc4:   add     w11, w15, w11, lsr #23      ;*if_icmpge {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - jdk.internal.util.ArraysSupport::mismatch at 50 (line 372)
                                                            ; - java.util.Arrays::equals at 31 (line 2518)
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 213 (line 152)
  0x0000ffff70394cc8:   add     x16, xesp, x16              ;*if_icmpge {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 226 (line 154)
  0x0000ffff70394ccc:   strh    w11, [x16,#16]              ;*aaload {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 212 (line 152)
  0x0000ffff70394cd0:   ldrsh   w15, [xmethod,#16]
  0x0000ffff70394cd4:   ldrsh   w17, [x14,#16]
  0x0000ffff70394cd8:   add     x11, x17, w11, sxth
  0x0000ffff70394cdc:   add     w11, w11, w15
  0x0000ffff70394ce0:   strh    w11, [x16,#16]              ;*ifeq {reexecute=0 rethrow=0 return_oop=0}
                                                            ; - jdk.internal.util.ArraysSupport::vectorizedMismatch at 62 (line 128)
                                                            ; - jdk.internal.util.ArraysSupport::mismatch at 32 (line 364)
                                                            ; - java.util.Arrays::equals at 31 (line 2518)
                                                            ; - compiler.c2.TestShiftRightAndAccumulate::test_shorts at 140 (line 146)
  0x0000ffff70394ce4:   ldrsh   w11, [xmethod,#18]

No vector instructions here. As far as I can see vectors are never used
for jshort, just for jchar. All very strange, and probably not your fault,
but since I'm looking I had to mention it.

The other weird thing is that {u,s}sra is never generated with the .8B form.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-compiler-dev mailing list