RFR: 8255438: [Vector API] More instructs in x86.ad should use legacy mode for code-gen

Jie Fu jiefu at openjdk.java.net
Tue Oct 27 07:40:23 UTC 2020


Hi all,

Just as @jatin-bhateja pointed out [1], there are more instructs in x86.ad which should use legacy mode.

It would be better to fix the following cases:
------------------------
1. instruct mul2L_reg
   The code-gen logic uses phaddd [2], which requires legacy mode here [3].
   This bug might be reproduced on AVX512 machines without avx512dq.

2. instruct vmul4L_reg_avx
   The code-gen logic uses vphaddd [4], which requires legacy mode here [5].
   This bug might be reproduced on AVX512 machines without avx512dq.

3. instruct reductionL
   For MulReductionVL, the code-gen chain can be:  reduceL --> reduce4L --> reduce_operation_128 --> vpmullq [6]
   vpmullq require legacy mode [7] if avx512dq isn't supported.
   This bug might be reproduced on AVX512 machines without avx512dq.

4. instruct reductionB
   For MinReductionV, the code-gen chain can be:  reduceB --> reduce32B --> reduce_operation_128 --> pminsb [8]
   pminsb require legacy mode [9] if avx512bw isn't supported.
   This bug might be reproduced on AVX512 machines without avx512bw.
------------------------
Bugs in mul2L_reg/vmul4L_reg_avx/reductionL can be only reproduced on AVX512 machines without avx512dq.
And bug in reductionB can be only reproduced on AVX512 machines without avx512bw.

Unfortunately, it's impossible for us to create reproducers since our AVX512 platforms support both avx512dq and avx512bw.
However, it do make sense to fix these unexposed bugs since vector api code will be sure to run on various paltforms (e.g., AVX512 machines without avx512dq/bw) in the future.

The fix just changes vec to legVec, which is quite safe in theory.

As for the reduction patterns of Float and Double, I don't see any reason that they should use legacy mode (maybe I've missed something).

Testing:
  - jdk/incubator/vector on both AVX512 and AVX256 machines

Any comments?

Thanks a lot.
Best regards,
Jie

[1] https://github.com/openjdk/jdk/pull/791#commitcomment-43473733
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L5472
[3] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6217
[4] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L5497
[5] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6165
[6] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L1521
[7] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6428
[8] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L1482
[9] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6475

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

Commit messages:
 - 8255438: [Vector API] More instructs in x86.ad should use legacy mode for code-gen

Changes: https://git.openjdk.java.net/jdk/pull/874/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=874&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255438
  Stats: 47 lines in 1 file changed: 0 ins; 41 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/874.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/874/head:pull/874

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


More information about the hotspot-compiler-dev mailing list