JDK-8351844 : C2 x64 AVX2 vpminmax: assert(regs[i] != regs[j]) failed: regs[1] and regs[2] are both: xmm0
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17,21,25,26
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • CPU: x86
  • Submitted: 2025-03-12
  • Updated: 2025-05-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 26
26Unresolved
Related Reports
Causes :  
Description
I found this with the Template Framework JDK-8344942.

java -Xbatch -XX:CompileCommand=compileonly,Test::test* -XX:CompileCommand=printcompilation,Test::test* --add-modules=jdk.incubator.vector -XX:UseAVX=2 Test.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (.../src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp:1010), pid=1913056, tid=1913070
#  assert(regs[i] != regs[j]) failed: regs[1] and regs[2] are both: xmm0
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-internal-LTS-2025-03-11-0926490.emanuel...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-internal-LTS-2025-03-11-0926490.emanuel..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8bb13d]  void assert_different_registers_impl<XMMRegister, XMMRegister, XMMRegister>(char const*, int, XMMRegister, XMMRegister, XMMRegister)+0xfd
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /oracle-work/jdk-fork0/build/linux-x64-debug/jdk/bin/core.1913056)
#
# An error report file with more information is saved as:
# /.../build/linux-x64-debug/jdk/bin/hs_err_pid1913056.log
#
# Compiler replay data is saved as:
# /.../build/linux-x64-debug/jdk/bin/replay_pid1913056.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#


Current CompileTask:
C2:2396  103    b  4       Test::test (43 bytes)

Stack: [0x000074f69a700000,0x000074f69a800000],  sp=0x000074f69a7fb740,  free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x8bb13d]  void assert_different_registers_impl<XMMRegister, XMMRegister, XMMRegister>(char const*, int, XMMRegister, XMMRegister, XMMRegister)+0xfd  (c2_MacroAssembler_x86.cpp:1010)
V  [libjvm.so+0x8b92b4]  C2_MacroAssembler::vpminmax(int, BasicType, XMMRegister, XMMRegister, XMMRegister, int)+0x154  (c2_MacroAssembler_x86.cpp:1010)
V  [libjvm.so+0x3f7453]  vminmaxL_reg_avxNode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const+0x173  (x86.ad:6561)
V  [libjvm.so+0x161b95e]  PhaseOutput::scratch_emit_size(Node const*)+0x49e  (output.cpp:3385)
V  [libjvm.so+0x1613b22]  PhaseOutput::shorten_branches(unsigned int*)+0x382  (output.cpp:539)
V  [libjvm.so+0x1625e36]  PhaseOutput::Output()+0xa36  (output.cpp:339)
V  [libjvm.so+0xa7f124]  Compile::Code_Gen()+0xa14  (compile.cpp:3081)
V  [libjvm.so+0xa8430f]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1fcf  (compile.cpp:891)
V  [libjvm.so+0x8c3d00]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x440  (c2compiler.cpp:141)
V  [libjvm.so+0xa91cec]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbfc  (compileBroker.cpp:2331)
V  [libjvm.so+0xa92c28]  CompileBroker::compiler_thread_loop()+0x598  (compileBroker.cpp:1975)
V  [libjvm.so+0xf7eb0f]  JavaThread::thread_main_inner()+0x12f  (javaThread.cpp:776)
V  [libjvm.so+0x1947b56]  Thread::call_run()+0xb6  (thread.cpp:231)
V  [libjvm.so+0x15fa1b8]  thread_native_entry(Thread*)+0x128  (os_linux.cpp:877)
C  [libc.so.6+0x9caa4]
Comments
I'm tentatively deferring this to JDK 26 since it's an old issue and we are getting closer to RDP 1 (June 05, 2025). [~jbhateja] feel free to still fix this in JDK 25 if there's time.
13-05-2025

Thanks Jatin!
13-03-2025

Thanks for notifying [~thartmann]. Will analyze and get back.
12-03-2025

Paging [~jbhateja] since this is VectorAPI related.
12-03-2025

ILW = Assert during C2 compilation, single test using Vector API (incubator), no workaround but disable compilation of affected method = HLM = P3
12-03-2025

Looks like a day 1 bug in the Vector API (JDK-8223347) code.
12-03-2025