RFR(M): 8073480: C2 should optimize explicit range checks
Roland Westrelin
roland.westrelin at oracle.com
Wed Feb 25 16:28:39 UTC 2015
> For example, here is the main loop for u_loop on jdk9/dev (using -XX:LoopUnrollLimit=0):
>
> 0x000000010ba77938: test %ecx,%ecx
> 0x000000010ba7793a: jl 0x000000010ba779d2 ;*iflt
> ; - arrays.ArrayTest::u at 1 (line 71)
> ; - arrays.ArrayTest::u_loop at 19 (line 65)
>
> 0x000000010ba77940: cmp %ebp,%ecx
> 0x000000010ba77942: jge 0x000000010ba779f9 ;*if_icmplt
> ; - arrays.ArrayTest::u at 7 (line 71)
> ; - arrays.ArrayTest::u_loop at 19 (line 65)
>
> 0x000000010ba77948: movslq %ecx,%r10
> 0x000000010ba7794b: add 0x10(%rbx,%r10,4),%eax ;*iadd
> ; - arrays.ArrayTest::u_loop at 22 (line 65)
>
> 0x000000010ba77950: inc %ecx ;*iinc
> ; - arrays.ArrayTest::u_loop at 24 (line 64)
>
> 0x000000010ba77952: cmp %r8d,%ecx
> 0x000000010ba77955: jl 0x000000010ba77938 ;*if_icmpge
> ; - arrays.ArrayTest::u_loop at 12 (line 64)
>
>
> And here is the same on jdk9/hs-rt with your patch applied:
>
> 0x0000000110355f40: movslq %r10d,%r9
> 0x0000000110355f43: add 0x10(%r8,%r9,4),%eax ;*iadd
> ; - arrays.ArrayTest::u_loop at 22 (line 65)
>
> 0x0000000110355f48: inc %r10d ;*iinc
> ; - arrays.ArrayTest::u_loop at 24 (line 64)
>
> 0x0000000110355f4b: cmp %r11d,%r10d
> 0x0000000110355f4e: jl 0x0000000110355f40 ;*if_icmpge
> ; - arrays.ArrayTest::u_loop at 12 (line 64)
>
> I wish we could get rid of those pesky "movslq" instructions :-) but IIUC that is tricky.
Are the movslq there only for the u_loop() case? Can you send me your test case. I’ll see if I can make them go away.
Roland.
More information about the hotspot-compiler-dev
mailing list