JDK-8338124 : C2 SuperWord: MulAddS2I input permutation still partially broken after JDK-8333840
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,23,24
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-08-09
  • Updated: 2024-08-19
  • Resolved: 2024-08-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b11Fixed
Related Reports
Duplicate :  
Relates :  
Description
JDK-8333840 attempted to fix some input permutation cases. Sadly, there is a typo which means that there can still be some broken cases that produce wrong results.

This patch should fix it:

diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp
index 0e1328a4485..5b420487b06 100644
--- a/src/hotspot/share/opto/superword.cpp
+++ b/src/hotspot/share/opto/superword.cpp
@@ -2272,7 +2272,7 @@ Node_List* PackSet::strided_pack_input_at_index_or_null(const Node_List* pack, c
     return nullptr; // size mismatch
   }
 
- for (uint i = 1; i < pack->size(); i++) {
+ for (uint i = 0; i < pack->size(); i++) {
     if (pack->at(i)->in(index) != pack_in->at(i * stride + offset)) {
       return nullptr; // use-def mismatch
     }

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

Reproduce with (passes with -Xint):
java Test1b.java

We can see that it vectorizes (even though it should not):
./java -XX:CompileCommand=printcompilation,Test1::* -XX:CompileCommand=compileonly,Test1b::test -Xbatch -XX:+TraceNewVectors Test1b.java

Result:
Exception in thread "main" java.lang.RuntimeException: errors: 2032
	at Test1b.compare(Test1b.java:41)
	at Test1b.main(Test1b.java:20)
Comments
Changeset: c27a8c8c Branch: master Author: Emanuel Peter <epeter@openjdk.org> Date: 2024-08-13 05:52:58 +0000 URL: https://git.openjdk.org/jdk/commit/c27a8c8c8b867e6812b905f6154762802a498dbd
13-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20539 Date: 2024-08-12 07:17:22 +0000
12-08-2024

Originally reported among other bugs in JDK-8337817
12-08-2024

ILW = Same as JDK-8337817 = P3
12-08-2024