Skip to content

Commit 7f8a11b

Browse files
committed
8280867: Cpuid1Ecx feature parsing is incorrect for AMD CPUs
Reviewed-by: mdoerr Backport-of: a18beb4797a1ca6fc6b31e997be48b2bd91c6ac0
1 parent fee03ea commit 7f8a11b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/hotspot/cpu/x86/vm_version_x86.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -147,12 +147,11 @@ class VM_Version : public Abstract_VM_Version {
147147
uint32_t LahfSahf : 1,
148148
CmpLegacy : 1,
149149
: 3,
150-
lzcnt_intel : 1,
151150
lzcnt : 1,
152151
sse4a : 1,
153152
misalignsse : 1,
154153
prefetchw : 1,
155-
: 22;
154+
: 23;
156155
} bits;
157156
};
158157

@@ -588,21 +587,21 @@ class VM_Version : public Abstract_VM_Version {
588587
result |= CPU_SSE4A;
589588
}
590589
// Intel features.
591-
if(is_intel()) {
592-
if(_cpuid_info.ext_cpuid1_ecx.bits.lzcnt_intel != 0)
590+
if (is_intel()) {
591+
if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt != 0) {
593592
result |= CPU_LZCNT;
594-
// for Intel, ecx.bits.misalignsse bit (bit 8) indicates support for prefetchw
595-
if (_cpuid_info.ext_cpuid1_ecx.bits.misalignsse != 0) {
593+
}
594+
if (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0) {
596595
result |= CPU_3DNOW_PREFETCH;
597596
}
598597
}
599598

600599
// ZX features.
601600
if (is_zx()) {
602-
if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt_intel != 0)
601+
if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt != 0) {
603602
result |= CPU_LZCNT;
604-
// for ZX, ecx.bits.misalignsse bit (bit 8) indicates support for prefetchw
605-
if (_cpuid_info.ext_cpuid1_ecx.bits.misalignsse != 0) {
603+
}
604+
if (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0) {
606605
result |= CPU_3DNOW_PREFETCH;
607606
}
608607
}

0 commit comments

Comments
 (0)