Adds Math Min/Max to arm64.

Also fixes bugs and enables tests.

R=regis@google.com

Review URL: https://codereview.chromium.org//284843004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36116 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
zra@google.com 2014-05-13 18:10:16 +00:00
parent 0c4403ee54
commit 03f2f289b4
5 changed files with 105 additions and 42 deletions

View file

@ -253,6 +253,8 @@ matcher/test/*_minified_test: Skip # DO NOT COPY THIS UNLESS YOU WORK ON DART2JS
watcher/test/directory_watcher/linux_test: Skip # Issue 16118
[ $arch == simarm64 ]
# Timeout. These are not unit tests. They do not run efficiently on our
# simulator.
*: Skip
# Skip serialization test that explicitly has no library declaration in the

View file

@ -848,13 +848,17 @@ void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* LoadUntaggedInstr::MakeLocationSummary(bool opt) const {
UNIMPLEMENTED();
return NULL;
const intptr_t kNumInputs = 1;
return LocationSummary::Make(kNumInputs,
Location::RequiresRegister(),
LocationSummary::kNoCall);
}
void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
UNIMPLEMENTED();
Register object = locs()->in(0).reg();
Register result = locs()->out(0).reg();
__ LoadFieldFromOffset(result, object, offset(), PP);
}
@ -1013,17 +1017,11 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
element_address = Address(array, index.reg(), UXTX, Address::Unscaled);
if ((representation() == kUnboxedDouble) ||
(representation() == kUnboxedMint) ||
(representation() == kUnboxedFloat32x4) ||
(representation() == kUnboxedInt32x4) ||
(representation() == kUnboxedFloat64x2)) {
const VRegister result = locs()->out(0).fpu_reg();
switch (class_id()) {
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid:
// TODO(zra): Add when we have simd.
UNIMPLEMENTED();
break;
case kTypedDataFloat32ArrayCid:
// Load single precision float.
__ fldrs(result, element_address);
@ -1035,8 +1033,7 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case kTypedDataFloat64x2ArrayCid:
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
// TODO(zra): Add when we have simd.
UNIMPLEMENTED();
__ fldrq(result, element_address);
break;
}
return;
@ -1099,10 +1096,9 @@ Representation StoreIndexedInstr::RequiredInputRepresentation(
case kExternalTypedDataUint8ClampedArrayCid:
case kTypedDataInt16ArrayCid:
case kTypedDataUint16ArrayCid:
return kTagged;
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid:
return value()->IsSmiValue() ? kTagged : kUnboxedMint;
return kTagged;
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return kUnboxedDouble;
@ -1147,14 +1143,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const {
break;
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid:
// Mints are stored in Q registers. For smis, use a writable register
// because the value must be untagged before storing.
if (value()->IsSmiValue()) {
locs->set_in(2, Location::WritableRegister());
} else {
// TODO(zra): Implement when we add simd loads and stores.
UNIMPLEMENTED();
}
locs->set_in(2, Location::WritableRegister());
break;
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants.
@ -1163,8 +1152,7 @@ LocationSummary* StoreIndexedInstr::MakeLocationSummary(bool opt) const {
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid:
case kTypedDataFloat64x2ArrayCid:
// TODO(zra): Implement when we add simd loads and stores.
UNIMPLEMENTED();
locs->set_in(2, Location::RequiresFpuRegister());
break;
default:
UNREACHABLE();
@ -1280,15 +1268,9 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
case kTypedDataInt32ArrayCid:
case kTypedDataUint32ArrayCid: {
if (value()->IsSmiValue()) {
ASSERT(RequiredInputRepresentation(2) == kTagged);
const Register value = locs()->in(2).reg();
__ SmiUntag(value);
__ str(value, element_address, kUnsignedWord);
} else {
// TODO(zra): Implement when we add simd loads and stores.
UNIMPLEMENTED();
}
const Register value = locs()->in(2).reg();
__ SmiUntag(value);
__ str(value, element_address, kUnsignedWord);
break;
}
case kTypedDataFloat32ArrayCid: {
@ -1306,8 +1288,9 @@ void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
case kTypedDataFloat64x2ArrayCid:
case kTypedDataInt32x4ArrayCid:
case kTypedDataFloat32x4ArrayCid: {
// TODO(zra): Implement when we add simd loads and stores.
UNIMPLEMENTED();
const VRegister in2 = locs()->in(2).fpu_reg();
__ add(index.reg(), index.reg(), Operand(array));
__ StoreQToOffset(in2, index.reg(), 0, PP);
break;
}
default:
@ -3460,13 +3443,87 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* MathMinMaxInstr::MakeLocationSummary(bool opt) const {
UNIMPLEMENTED();
return NULL;
if (result_cid() == kDoubleCid) {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresFpuRegister());
summary->set_in(1, Location::RequiresFpuRegister());
// Reuse the left register so that code can be made shorter.
summary->set_out(0, Location::SameAsFirstInput());
return summary;
}
ASSERT(result_cid() == kSmiCid);
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
summary->set_in(1, Location::RequiresRegister());
// Reuse the left register so that code can be made shorter.
summary->set_out(0, Location::SameAsFirstInput());
return summary;
}
void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
UNIMPLEMENTED();
ASSERT((op_kind() == MethodRecognizer::kMathMin) ||
(op_kind() == MethodRecognizer::kMathMax));
const intptr_t is_min = (op_kind() == MethodRecognizer::kMathMin);
if (result_cid() == kDoubleCid) {
Label done, returns_nan, are_equal;
const VRegister left = locs()->in(0).fpu_reg();
const VRegister right = locs()->in(1).fpu_reg();
const VRegister result = locs()->out(0).fpu_reg();
__ fcmpd(left, right);
__ b(&returns_nan, VS);
__ b(&are_equal, EQ);
const Condition double_condition =
is_min ? TokenKindToDoubleCondition(Token::kLTE)
: TokenKindToDoubleCondition(Token::kGTE);
ASSERT(left == result);
__ b(&done, double_condition);
__ fmovdd(result, right);
__ b(&done);
__ Bind(&returns_nan);
__ LoadDImmediate(result, NAN, PP);
__ b(&done);
__ Bind(&are_equal);
// Check for negative zero: -0.0 is equal 0.0 but min or max must return
// -0.0 or 0.0 respectively.
// Check for negative left value (get the sign bit):
// - min -> left is negative ? left : right.
// - max -> left is negative ? right : left
// Check the sign bit.
__ fmovrd(TMP, left); // Sign bit is in bit 63 of TMP.
__ CompareImmediate(TMP, 0, PP);
if (is_min) {
ASSERT(left == result);
__ b(&done, LT);
__ fmovdd(result, right);
} else {
__ b(&done, GE);
__ fmovdd(result, right);
ASSERT(left == result);
}
__ Bind(&done);
return;
}
ASSERT(result_cid() == kSmiCid);
Register left = locs()->in(0).reg();
Register right = locs()->in(1).reg();
Register result = locs()->out(0).reg();
__ CompareRegisters(left, right);
ASSERT(result == left);
if (is_min) {
__ csel(result, right, left, GT);
} else {
__ csel(result, right, left, LT);
}
}

View file

@ -288,7 +288,6 @@ mirrors/mirrors_reader_test: Skip # Timeout
convert/chunked_conversion_utf88_test: Skip # Timeout
convert/utf85_test: Skip # Timeout
convert/streamed_conversion_json_utf8_decode_test: Skip # Timeout
math/min_max_test: Crash # Unimplemented
[ $compiler == none && $runtime == dartium ]
async/schedule_microtask5_test: Pass, Timeout # Issue 13719: Please triage this failure.

View file

@ -122,7 +122,15 @@ io/signals_test: Skip # Starts 10 dart subprocesses, uses too much memory
io/file_read_special_device_test: Fail # dartbug.com/17440
[ $arch == simarm64 ]
*: Skip
# Timeout
io/http_proxy_test: Skip
io/http_auth_digest_test: Skip
io/web_socket_test: Skip
io/http_server_response_test: Skip
io/http_content_length_test: Skip
typed_data_test: Skip
# Unimplemented
javascript_int_overflow_test: RuntimeError
[ $compiler == none && ($runtime == dartium || $runtime == ContentShellOnAndroid) && $unchecked ]
assert_test: Fail # Issue 13719: Please triage this failure.

View file

@ -20,6 +20,3 @@ dart2js_test: Skip # Uses dart:io.
source_mirrors_test: Slow, Pass
dummy_compiler_test: Slow, Pass
source_mirrors_test: Slow, Pass
[ $compiler == none && $runtime == vm && $arch == simarm64 ]
*: Skip