RFR: 8261671: X86 I2L conversion can be skipped for certain masked positive values [v7]

Marcus G K Williams github.com+168222+mgkwill at openjdk.java.net
Wed Mar 10 00:12:09 UTC 2021


On Mon, 8 Mar 2021 22:05:40 GMT, Marcus G K Williams <github.com+168222+mgkwill at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/codegen/BMI2.java line 56:
>> 
>>> 54:             z = BMITests.bzhiI2L(ix, i);
>>> 55: 
>>> 56:             for (int i2 = 0; i2 < ITERATIONS; i2++) {
>> 
>> Why are these manually unrolled? They are the same but with different index?
>> 
>> I mean something like:
>> 
>>         for (int i = 0; i <= 15; i++) {
>>             z = BMITests.bzhiI2L(ix, i);
>> 
>>             for (int i2 = 0; i2 < ITERATIONS; i2++) {
>>                 long ii = BMITests.bzhiI2L(ix, i);
>>                 if (ii != z) {
>>                     throw new Error(returnBzhiI2LErrMessage (z, ii));
>>                 }
>>             }
>>         }
>
> I wasn't able to get the above to C2 compile separately. I wrote essentially the same but could not verify the compilation. I then unrolled from the for loop and could verify the bzhi instructions were generated. Repetition felt like a reasonable compromise for completeness. I'll take another look and see if I can verify in a for loop. Perhaps one of the options I was using prevented it from working.

Rolling this into for loops appears to work. I'm guessing something else was at issue before when I couldn't verify bzhiq instructions in C2 compilation of bzhiI2L(). Pushed a patch with the change.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2590


More information about the hotspot-compiler-dev mailing list