diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 5011eb45991..7c2766a8aeb 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1477,16 +1477,6 @@ void VM_Version::get_processor_features() { UseUnalignedLoadStores = true; // use movdqu on newest ZX cpus } } - if (supports_sse4_2()) { - if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { - FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); - } - } else { - if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { - warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); - } - FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); - } } if (FLAG_IS_DEFAULT(AllocatePrefetchInstr) && supports_3dnow_prefetch()) { @@ -1531,16 +1521,6 @@ void VM_Version::get_processor_features() { UseXmmI2D = false; } } - if (supports_sse4_2()) { - if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { - FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); - } - } else { - if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { - warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); - } - FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); - } // some defaults for AMD family 15h if (cpu_family() == 0x15) { @@ -1629,16 +1609,6 @@ void VM_Version::get_processor_features() { UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus } } - if (supports_sse4_2()) { - if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { - FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); - } - } else { - if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { - warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); - } - FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); - } } if (is_atom_family() || is_knights_family()) { #ifdef COMPILER2 @@ -1699,7 +1669,16 @@ void VM_Version::get_processor_features() { } } #endif - + if (supports_sse4_2()) { + if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { + FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); + } + } else { + if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseSSE42Intrinsics)) { + warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled."); + } + FLAG_SET_DEFAULT(UseSSE42Intrinsics, false); + } if (UseSSE42Intrinsics) { if (FLAG_IS_DEFAULT(UseVectorizedMismatchIntrinsic)) { UseVectorizedMismatchIntrinsic = true; diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSSE42IntrinsicsWithLowLevelSSE.java b/test/hotspot/jtreg/compiler/arguments/TestUseSSE42IntrinsicsWithLowLevelSSE.java new file mode 100644 index 00000000000..27886fb7694 --- /dev/null +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSSE42IntrinsicsWithLowLevelSSE.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8358592 + * @summary Regression test for -XX:+UseSSE42Intrinsics -XX:UseSSE=1 crash + * @requires os.arch=="amd64" | os.arch=="x86_64" + * @requires vm.debug + * @run main/othervm -XX:+UseSSE42Intrinsics -XX:UseSSE=1 compiler.arguments.TestUseSSE42IntrinsicsWithLowLevelSSE + */ +package compiler.arguments; + +public class TestUseSSE42IntrinsicsWithLowLevelSSE { + + public static void main(String[] args) { + System.out.println("passed"); + } +} \ No newline at end of file