Revision: 19035
Author: [email protected]
Date: Mon Feb 3 16:47:02 2014 UTC
Log: A64: Add LSubS instruction.
[email protected]
Review URL: https://codereview.chromium.org/142323009
http://code.google.com/p/v8/source/detail?r=19035
Modified:
/branches/experimental/a64/src/a64/lithium-a64.cc
/branches/experimental/a64/src/a64/lithium-a64.h
/branches/experimental/a64/src/a64/lithium-codegen-a64.cc
=======================================
--- /branches/experimental/a64/src/a64/lithium-a64.cc Mon Feb 3 15:47:06
2014 UTC
+++ /branches/experimental/a64/src/a64/lithium-a64.cc Mon Feb 3 16:47:02
2014 UTC
@@ -2267,11 +2267,9 @@
LInstruction* LChunkBuilder::DoSub(HSub* instr) {
- // TODO(jbramley): Add smi support.
- if (instr->representation().IsInteger32()) {
- ASSERT(instr->left()->representation().IsInteger32());
- ASSERT(instr->right()->representation().IsInteger32());
-
+ if (instr->representation().IsSmiOrInteger32()) {
+
ASSERT(instr->left()->representation().Equals(instr->representation()));
+
ASSERT(instr->right()->representation().Equals(instr->representation()));
LOperand *left;
if (instr->left()->IsConstant() &&
(HConstant::cast(instr->left())->Integer32Value() == 0)) {
@@ -2280,8 +2278,9 @@
left = UseRegisterAtStart(instr->left());
}
LOperand* right = UseRegisterOrConstantAtStart(instr->right());
- LSubI* sub = new(zone()) LSubI(left, right);
- LInstruction* result = DefineAsRegister(sub);
+ LInstruction* result = instr->representation().IsSmi() ?
+ DefineAsRegister(new(zone()) LSubS(left, right)) :
+ DefineAsRegister(new(zone()) LSubI(left, right));
if (instr->CheckFlag(HValue::kCanOverflow)) {
result = AssignEnvironment(result);
}
=======================================
--- /branches/experimental/a64/src/a64/lithium-a64.h Mon Feb 3 15:47:06
2014 UTC
+++ /branches/experimental/a64/src/a64/lithium-a64.h Mon Feb 3 16:47:02
2014 UTC
@@ -181,6 +181,7 @@
V(StringCharFromCode) \
V(StringCompareAndBranch) \
V(SubI) \
+ V(SubS) \
V(TaggedToI) \
V(ThisFunction) \
V(Throw) \
@@ -2552,6 +2553,21 @@
};
+class LSubS: public LTemplateInstruction<1, 2, 0> {
+ public:
+ LSubS(LOperand* left, LOperand* right) {
+ inputs_[0] = left;
+ inputs_[1] = right;
+ }
+
+ LOperand* left() { return inputs_[0]; }
+ LOperand* right() { return inputs_[1]; }
+
+ DECLARE_CONCRETE_INSTRUCTION(SubS, "sub-s")
+ DECLARE_HYDROGEN_ACCESSOR(Sub)
+};
+
+
class LThisFunction: public LTemplateInstruction<1, 0, 0> {
public:
DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
=======================================
--- /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Mon Feb 3
15:47:06 2014 UTC
+++ /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Mon Feb 3
16:47:02 2014 UTC
@@ -5168,6 +5168,20 @@
__ Sub(result, left, right);
}
}
+
+
+void LCodeGen::DoSubS(LSubS* instr) {
+ bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
+ Register result = ToRegister(instr->result());
+ Register left = ToRegister(instr->left());
+ Operand right = ToOperand(instr->right());
+ if (can_overflow) {
+ __ Subs(result, left, right);
+ DeoptimizeIf(vs, instr->environment());
+ } else {
+ __ Sub(result, left, right);
+ }
+}
void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
--
--
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.