[vm/sse41] Fix use of pextrd when sse41 is not available.

BUG=https://github.com/dart-lang/sdk/issues/50640
TEST=ci

Change-Id: Ief12c270cb59dace99e3a2845cb44ed5085dbdaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev 2022-12-08 23:29:14 +00:00 committed by Commit Queue
parent e38242621d
commit fb22336c28
5 changed files with 32 additions and 7 deletions

View file

@ -4,6 +4,9 @@
//
// This complements corelib/double_hash_code_test.dart and verifies hash code
// values of doubles that are not representable as integers.
//
// VMOptions=--use_sse41
// VMOptions=--no_use_sse41
import 'package:expect/expect.dart';

View file

@ -6,6 +6,9 @@
//
// This complements corelib/double_hash_code_test.dart and verifies hash code
// values of doubles that are not representable as integers.
//
// VMOptions=--use_sse41
// VMOptions=--no_use_sse41
import 'package:expect/expect.dart';

View file

@ -5097,7 +5097,14 @@ void HashDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler::Label hash_double, try_convert;
// extract high 32-bits out of double value.
__ pextrd(temp, value, compiler::Immediate(1));
if (TargetCPUFeatures::sse4_1_supported()) {
__ pextrd(temp, value, compiler::Immediate(1));
} else {
__ SubImmediate(ESP, compiler::Immediate(kDoubleSize));
__ movsd(compiler::Address(ESP, 0), value);
__ movl(temp, compiler::Address(ESP, kWordSize));
__ AddImmediate(ESP, compiler::Immediate(kDoubleSize));
}
__ andl(temp, compiler::Immediate(0x7FF00000));
__ cmpl(temp, compiler::Immediate(0x7FF00000));
__ j(EQUAL, &hash_double); // is infinity or nan
@ -5148,8 +5155,16 @@ void HashDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ jmp(&hash_integer);
__ Bind(&hash_double);
__ pextrd(EAX, value, compiler::Immediate(0));
__ pextrd(temp, value, compiler::Immediate(1));
if (TargetCPUFeatures::sse4_1_supported()) {
__ pextrd(EAX, value, compiler::Immediate(0));
__ pextrd(temp, value, compiler::Immediate(1));
} else {
__ SubImmediate(ESP, compiler::Immediate(kDoubleSize));
__ movsd(compiler::Address(ESP, 0), value);
__ movl(EAX, compiler::Address(ESP, 0));
__ movl(temp, compiler::Address(ESP, kWordSize));
__ AddImmediate(ESP, compiler::Immediate(kDoubleSize));
}
__ xorl(EAX, temp);
__ andl(EAX, compiler::Immediate(compiler::target::kSmiMax));

View file

@ -2,8 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--intrinsify
// VMOptions=--no_intrinsify
// VMOptions=--intrinsify --use_sse41
// VMOptions=--no_intrinsify --use_sse41
// VMOptions=--intrinsify --no_use_sse41
// VMOptions=--no_intrinsify --no_use_sse41
import 'package:expect/expect.dart';

View file

@ -4,8 +4,10 @@
// @dart = 2.9
// VMOptions=--intrinsify
// VMOptions=--no_intrinsify
// VMOptions=--intrinsify --use_sse41
// VMOptions=--no_intrinsify --use_sse41
// VMOptions=--intrinsify --no_use_sse41
// VMOptions=--no_intrinsify --no_use_sse41
import 'package:expect/expect.dart';