8158214: Crash with "assert(VM_Version::supports_sse4_1()) failed" if UseSSE < 4 is set

Do not emit unsupported SSE 4.1 instructions in CRC32 intrinsic.

Reviewed-by: kvn, zmajo
This commit is contained in:
Tobias Hartmann 2016-06-02 13:19:05 +02:00
parent 35f9db149b
commit f92cc0c836
3 changed files with 47 additions and 4 deletions
hotspot

@ -10151,7 +10151,13 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Regi
movdqa(xmm1, Address(buf, 0));
movdl(rax, xmm1);
xorl(crc, rax);
pinsrd(xmm1, crc, 0);
if (VM_Version::supports_sse4_1()) {
pinsrd(xmm1, crc, 0);
} else {
pinsrw(xmm1, crc, 0);
shrl(crc, 16);
pinsrw(xmm1, crc, 1);
}
addptr(buf, 16);
subl(len, 4); // len > 0
jcc(Assembler::less, L_fold_tail);

@ -658,7 +658,7 @@ void VM_Version::get_processor_features() {
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
}
} else {
if(supports_sse4_1() && UseSSE >= 4) {
if(supports_sse4_1()) {
if (FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) {
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, true);
}
@ -970,7 +970,7 @@ void VM_Version::get_processor_features() {
UseXmmI2D = false;
}
}
if (supports_sse4_2() && UseSSE >= 4) {
if (supports_sse4_2()) {
if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
}
@ -1050,7 +1050,7 @@ void VM_Version::get_processor_features() {
UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus
}
}
if (supports_sse4_2() && UseSSE >= 4) {
if (supports_sse4_2()) {
if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
}

@ -0,0 +1,37 @@
/*
* Copyright (c) 2016, 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 TestSSE4Disabled
* @bug 8158214
* @requires (os.simpleArch == "x64")
* @summary Test correct execution without SSE 4.
* @run main/othervm -Xcomp -XX:UseSSE=3 TestSSE4Disabled
*/
public class TestSSE4Disabled {
public static void main(String args[]) {
System.out.println("Passed");
}
}