summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2014-11-06 15:59:38 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2014-11-06 16:01:03 +0000
commitcd2de0c1c7f1051a2f7bdb0e827dd6057f3bafcd (patch)
treee692ffff75418c935538ac7bf403f324204e4f13 /compiler/optimizing/nodes.h
parentf746cd9bb573b6b4b8c6dcdcf819c0203a186822 (diff)
Fix failures after div support.
- We need to special case divide by -1 because of x86. - Disable div test on arm64, which does not support div yet. Change-Id: I07e137cb555a958b02a6c4070f296503b7e30bae
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 6ee4dfc1eb..a57bbdb5dd 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -1715,7 +1715,12 @@ class HDiv : public HBinaryOperation {
HDiv(Primitive::Type result_type, HInstruction* left, HInstruction* right)
: HBinaryOperation(result_type, left, right) {}
- virtual int32_t Evaluate(int32_t x, int32_t y) const { return x / y; }
+ virtual int32_t Evaluate(int32_t x, int32_t y) const {
+ // Our graph structure ensures we never have 0 for `y` during constant folding.
+ DCHECK_NE(y, 0);
+ // Special case -1 to avoid getting a SIGFPE on x86.
+ return (y == -1) ? -x : x / y;
+ }
virtual int64_t Evaluate(int64_t x, int64_t y) const { return x / y; }
DECLARE_INSTRUCTION(Div);