diff options
author | 2015-04-03 16:02:44 +0100 | |
---|---|---|
committer | 2015-04-15 12:51:49 +0100 | |
commit | 66d126ea06ce3f507d86ca5f0d1f752170ac9be1 (patch) | |
tree | 8e247db17ef085b55725b21c64d292414fd00b32 /compiler/optimizing/boolean_simplifier.cc | |
parent | 9bb3e8e10d7d9230a323511094a9e260062a1473 (diff) |
ART: Implement HBooleanNot instruction
Optimizations simplifying operations on boolean values (boolean
simplifier, instruction simplifier) can benefit from having a special
HInstruction for negating booleans in order to perform more transforms
and produce faster machine code.
This patch implements HBooleanNot as 'x xor 1', assuming that booleans
are 1-bit integers and allowing for a single-instruction negation on
all supported platforms.
Change-Id: I33a2649c1821255b18a86ca68ed16416063c739f
Diffstat (limited to 'compiler/optimizing/boolean_simplifier.cc')
-rw-r--r-- | compiler/optimizing/boolean_simplifier.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/optimizing/boolean_simplifier.cc b/compiler/optimizing/boolean_simplifier.cc index be432c5a20..06328f2490 100644 --- a/compiler/optimizing/boolean_simplifier.cc +++ b/compiler/optimizing/boolean_simplifier.cc @@ -73,8 +73,8 @@ static HInstruction* GetOppositeCondition(HInstruction* cond) { } } else { // General case when 'cond' is another instruction of type boolean. - // Negate with 'cond == 0'. - return new (allocator) HEqual(cond, graph->GetIntConstant(0)); + DCHECK_EQ(cond->GetType(), Primitive::Type::kPrimBoolean); + return new (allocator) HBooleanNot(cond); } } |