RFR: 8310190: C2 SuperWord: AlignVector is broken, generates misaligned packs [v58]

Vladimir Kozlov kvn at openjdk.org
Wed Jan 3 19:53:39 UTC 2024


On Wed, 3 Jan 2024 19:41:57 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 124 commits:
>> 
>>  - Merge branch 'JDK-8311586' of https://github.com/eme64/jdk into JDK-8311586
>>  - Apply suggestions from code review by Christian
>>    
>>    Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
>>  - fix copyright year 2024
>>  - Merge branch 'master' into JDK-8311586
>>  - more comments in SuperWord::adjust_pre_loop_limit_to_align_main_loop_vectors
>>  - comments about modulo positive / negative values
>>  - Apply suggestions from code review from Christian
>>    
>>    Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
>>  - more small fixes by Christian
>>  - fix for yesterday's reviews by Christian
>>  - improve case analysis empty / constrained / trivial
>>  - ... and 114 more: https://git.openjdk.org/jdk/compare/06dd7353...d01a0cd9
>
> src/hotspot/share/opto/compile.cpp line 3713:
> 
>> 3711:         // to ObjectAlignmentInBytes. Hence, even if multiple arrays are accessed in
>> 3712:         // a loop we can expect at least the following alignment:
>> 3713:         jlong guaranteed_alignment = MIN2(vector_width, (jlong)ObjectAlignmentInBytes);
> 
> This is more relaxed check than the actual alignment required. As I understand it is because it checks only base address of array and not actually memory address to which vector instruction is accessed (which is (base,index,offset)).
> It is useful but does not guarantee correct alignment of vector access instructions.
> 
> Consider using `lea` instruction on x86 to load memory address into register and check it.

May be hack only `loadV` and `storeV` instructions in .ad file to use `lea` and do the check.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14785#discussion_r1440873324


More information about the hotspot-compiler-dev mailing list