[jdk16] RFR: 8259775: [Vector API] Incorrect code-gen for VectorReinterpret operation [v3]

Jie Fu jiefu at openjdk.java.net
Sat Jan 16 05:34:41 UTC 2021


> Hi all,
> 
> The code-gen for VectorReinterpret may be wrong on x86.
> 
> Let's see the opto-assembly for the reproducer in the JBS, which was actually based on @XiaohongGong 's example in JDK-8259353 and many thanks to her.
> 066     B7: #   out( N1 ) <- in( B6 )  Freq: 0.999994
> 066     vector_reinterpret_expand XMM0,XMM0     !
> 066     store_vector [R12 + R11 << 3 + #16] (compressed oop addressing),XMM0
>  
> Please note that the dst and src [1] share the same XMM0 register and movdqu [2] should be generated for this case.
> But when dst == src, movdqu actually generates nothing [3], which leads to incorrect result;
> 
> For this case, movdqu should not be empty since the upper bits of dst should be zeroed.
> The similar error also exists for vmovdqu [4].
> 
> I think we should also change movflt [5] to movss but I just can't understand why we have 4-byte vectors.
> Isn't the shortest vectors 8-byte on x86?
> 
> Thanks.
> Best regards,
> Jie
> 
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L3354
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L3364
> [3] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L2490
> [4] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L2515
> [5] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L3379

Jie Fu has updated the pull request incrementally with one additional commit since the last revision:

  Add tests for both 256 and 512 vectors

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

Changes:
  - all: https://git.openjdk.java.net/jdk16/pull/122/files
  - new: https://git.openjdk.java.net/jdk16/pull/122/files/db5d7589..e17ba6cf

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk16&pr=122&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk16&pr=122&range=01-02

  Stats: 205 lines in 3 files changed: 128 ins; 77 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk16/pull/122.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/122/head:pull/122

PR: https://git.openjdk.java.net/jdk16/pull/122


More information about the hotspot-compiler-dev mailing list