A strange bit of code in MacroAssembler::multiply_128_x_128_loop

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Apr 10 16:47:13 UTC 2015


On 4/10/15 9:30 AM, Vladimir Kozlov wrote:
> It restores counter after:
>
>    subl(idx, 2);
>    jcc(Assembler::negative, L_check_1);
>
> The value could be 1,2,3 before this point (idx & 3 before).
> After 'sub 2': -1, 0, 1.
>
> So we have to restore to positive values before subtracting 1.

And you are right, it is not needed. We get the same (correct) result from 'and idx,1' regardless executing 'add'.

Vladimir

>
> Vladimir
>
> On 4/10/15 8:12 AM, Daniel D. Daugherty wrote:
>> Adding in the Compiler team since this is the MacroAssembler...
>>
>> Dan
>>
>>
>> On 4/10/15 9:06 AM, Andrew Haley wrote:
>>> This is for x86:
>>>
>>>    addl (idx, 0x2);
>>>    andl (idx, 0x1);
>>>    subl(idx, 1);
>>>    jcc(Assembler::negative, L_post_third_loop_done);
>>>
>>> I'm trying to guess what the "addl (idx, 0x2)" instruction was supposed to do.
>>> I don't think it has any effect now.
>>>
>>> Andrew.
>>


More information about the hotspot-runtime-dev mailing list