From d77b43937911b33bf39175e45e3d9d97aa949617 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Wed, 14 Jan 2026 21:37:25 +0900 Subject: [PATCH] Check E-Core with Leaf 1Ah --- src/hotspot/cpu/x86/vm_version_x86.cpp | 21 +++++++++++++++++---- src/hotspot/cpu/x86/vm_version_x86.hpp | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 0522d87dddb..66134e6b0bc 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -141,7 +141,7 @@ class VM_Version_StubGenerator: public StubCodeGenerator { const uint32_t CPU_FAMILY_486 = (4 << CPU_FAMILY_SHIFT); bool use_evex = FLAG_IS_DEFAULT(UseAVX) || (UseAVX > 2); - Label detect_486, cpu486, detect_586, std_cpuid1, std_cpuid4, std_cpuid24, std_cpuid29; + Label detect_486, cpu486, detect_586, std_cpuid1, std_cpuid4, std_cpuidb, std_cpuid24, std_cpuid29; Label sef_cpuid, sefsl1_cpuid, ext_cpuid, ext_cpuid1, ext_cpuid5, ext_cpuid7; Label ext_cpuid8, done, wrapup, vector_save_restore, apx_save_restore_warning; Label legacy_setup, save_restore_except, legacy_save_restore, start_simd_check; @@ -215,11 +215,25 @@ class VM_Version_StubGenerator: public StubCodeGenerator { __ movl(Address(rsi,12), rdx); __ cmpl(rax, 0xa); // Is cpuid(0xB) supported? - __ jccb(Assembler::belowEqual, std_cpuid4); + __ jcc(Assembler::belowEqual, std_cpuid4); + + __ cmpl(rax, 0x19); // Is cpuid(0x1A) supported? + __ jccb(Assembler::belowEqual, std_cpuidb); + + // + // cpuid(0x1A) Native Model ID + // + __ movl(rax, 0x1A); + __ xorl(rcx, rcx); // must be 0 + __ cpuid(); + + __ lea(rsi, Address(rbp, in_bytes(VM_Version::std_cpuid1a_offset()))); + __ movl(Address(rsi, 0), rax); // // cpuid(0xB) Processor Topology // + __ bind(std_cpuidb); __ movl(rax, 0xb); __ xorl(rcx, rcx); // Threads level __ cpuid(); @@ -921,8 +935,7 @@ void VM_Version::get_processor_features() { // Check if processor has Intel Ecore if (FLAG_IS_DEFAULT(EnableX86ECoreOpts) && is_intel() && is_intel_server_family() && - (supports_hybrid() || - _model == 0xAF /* Xeon 6 E-cores (Sierra Forest) */ )) { + (_cpuid_info.std_cpuid1a_eax.bits.core_type == 0x20 /* Atom (E-Core) */ || supports_hybrid())) { FLAG_SET_DEFAULT(EnableX86ECoreOpts, true); } diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index cc93ee3564e..18b1d13a279 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -306,6 +306,14 @@ class VM_Version : public Abstract_VM_Version { } bits; }; + union StdCpuid1AEax { + uint32_t value; + struct { + uint32_t core_native_model_id : 24, + core_type : 8; + } bits; + }; + union StdCpuidEax29Ecx0 { uint32_t value; struct { @@ -594,6 +602,13 @@ protected: SefCpuid7SubLeaf1Eax sefsl1_cpuid7_eax; SefCpuid7SubLeaf1Edx sefsl1_cpuid7_edx; + // cpuid function 1A (Native Model ID Enumeration) + // eax = 0x1A, ecx = 0 + StdCpuid1AEax std_cpuid1a_eax; + uint32_t std_cpuid1a_ebx; // unused currently + uint32_t std_cpuid1a_ecx; // unused currently + uint32_t std_cpuid1a_edx; // unused currently + // cpuid function 24 converged vector ISA main leaf // eax = 24, ecx = 0 StdCpuid24MainLeafEax std_cpuid24_eax; @@ -722,6 +737,7 @@ public: // Offsets for cpuid asm stub static ByteSize std_cpuid0_offset() { return byte_offset_of(CpuidInfo, std_max_function); } static ByteSize std_cpuid1_offset() { return byte_offset_of(CpuidInfo, std_cpuid1_eax); } + static ByteSize std_cpuid1a_offset() { return byte_offset_of(CpuidInfo, std_cpuid1a_eax); } static ByteSize std_cpuid24_offset() { return byte_offset_of(CpuidInfo, std_cpuid24_eax); } static ByteSize std_cpuid29_offset() { return byte_offset_of(CpuidInfo, std_cpuid29_ebx); } static ByteSize dcp_cpuid4_offset() { return byte_offset_of(CpuidInfo, dcp_cpuid4_eax); }