Reviewers: Rodolph Perfetta (ARM),
Description:
Revert 19279 "A64: When truncating to an int, store the result in a ..."
[email protected]
BUG=none
LOG=n
Please review this at https://codereview.chromium.org/135273017/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64
Affected files (+23, -6 lines):
M src/a64/lithium-codegen-a64.cc
M src/a64/macro-assembler-a64.h
M src/a64/macro-assembler-a64.cc
M test/cctest/test-assembler-a64.cc
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index
0e2f40c3c4291b41d9fd69b9afadcdd617e0e191..da03ccc214700a949048b590d342a434f84521c2
100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -5493,7 +5493,7 @@ void
LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) {
ToRegister(instr->temp2()),
instr->tag_result()
? MacroAssembler::SMI
- : MacroAssembler::INT32);
+ : MacroAssembler::INT32_IN_W);
}
Index: src/a64/macro-assembler-a64.cc
diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc
index
90b7b26a5621f9062b2ac976b64324eec2a5bf83..623a54bd2d20edaa36718ec0b4d89df3ec2fd11f
100644
--- a/src/a64/macro-assembler-a64.cc
+++ b/src/a64/macro-assembler-a64.cc
@@ -2544,7 +2544,14 @@ void MacroAssembler::ECMA262ToInt32(Register result,
Bind(&tag);
switch (format) {
- case INT32:
+ case INT32_IN_W:
+ // There is nothing to do; the upper 32 bits are undefined.
+ if (emit_debug_code()) {
+ __ Mov(scratch1, 0x55555555);
+ __ Bfi(result, scratch1, 32, 32);
+ }
+ break;
+ case INT32_IN_X:
Sxtw(result, result);
break;
case SMI:
Index: src/a64/macro-assembler-a64.h
diff --git a/src/a64/macro-assembler-a64.h b/src/a64/macro-assembler-a64.h
index
0c70747f7b0447dfd56df850c47316280aa33606..c36a2e801612b8dd6b7ffc4de8ba2eca006aac7a
100644
--- a/src/a64/macro-assembler-a64.h
+++ b/src/a64/macro-assembler-a64.h
@@ -1094,9 +1094,13 @@ class MacroAssembler : public Assembler {
// ---- Floating point helpers ----
enum ECMA262ToInt32Result {
+ // Provide an untagged int32_t which can be read using result.W().
That is,
+ // the upper 32 bits of result are undefined.
+ INT32_IN_W,
+
// Provide an untagged int32_t which can be read using the 64-bit
result
// register. The int32_t result is sign-extended.
- INT32,
+ INT32_IN_X,
// Tag the int32_t result as a smi.
SMI
@@ -1107,7 +1111,7 @@ class MacroAssembler : public Assembler {
DoubleRegister input,
Register scratch1,
Register scratch2,
- ECMA262ToInt32Result format = INT32);
+ ECMA262ToInt32Result format = INT32_IN_X);
// As ECMA262ToInt32, but operate on a HeapNumber.
void HeapNumberECMA262ToInt32(Register result,
@@ -1115,7 +1119,7 @@ class MacroAssembler : public Assembler {
Register scratch1,
Register scratch2,
DoubleRegister double_scratch,
- ECMA262ToInt32Result format = INT32);
+ ECMA262ToInt32Result format = INT32_IN_X);
// ---- Code generation helpers ----
Index: test/cctest/test-assembler-a64.cc
diff --git a/test/cctest/test-assembler-a64.cc
b/test/cctest/test-assembler-a64.cc
index
63237bc2d2d90fb9153f43de2325edb03f6d1113..3597927443b3f2e6147e05bf25e54f90cca4e9a9
100644
--- a/test/cctest/test-assembler-a64.cc
+++ b/test/cctest/test-assembler-a64.cc
@@ -9352,15 +9352,21 @@ static void ECMA262ToInt32Helper(int32_t expected,
double input) {
__ Fmov(d0, input);
- __ ECMA262ToInt32(x1, d0, x10, x11, MacroAssembler::INT32);
+ __ ECMA262ToInt32(x0, d0, x10, x11, MacroAssembler::INT32_IN_W);
+ __ ECMA262ToInt32(x1, d0, x10, x11, MacroAssembler::INT32_IN_X);
__ ECMA262ToInt32(x2, d0, x10, x11, MacroAssembler::SMI);
+ // The upper bits of INT32_IN_W are undefined, so make sure we don't try
to
+ // test them.
+ __ Mov(w0, w0);
+
END();
RUN();
int64_t expected64 = expected;
+ ASSERT_EQUAL_32(expected, w0);
ASSERT_EQUAL_64(expected64, x1);
ASSERT_EQUAL_64(expected64 << kSmiShift | kSmiTag, x2);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.