Add long bitwise not instruction in the optimizing compiler.
- Add support for the not-long (long integer one's
complement negation) instruction in the optimizing
compiler.
- Add a 64-bit NOT instruction (notq) to the x86-64
assembler.
- Generate ARM, x86 and x86-64 code for long HNot nodes.
- Gather not-related tests in test/416-optimizing-arith-not.
Change-Id: I2d5b75e9875664d6032d04f8401b2bbb84506948
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index e4dee46..cc9c6c1 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -758,6 +758,11 @@
break;
}
+ case Instruction::NOT_LONG: {
+ Unop_12x<HNot>(instruction, Primitive::kPrimLong);
+ break;
+ }
+
case Instruction::ADD_INT: {
Binop_23x<HAdd>(instruction, Primitive::kPrimInt);
break;
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc
index 4733432..7adf2cc 100644
--- a/compiler/optimizing/code_generator_arm.cc
+++ b/compiler/optimizing/code_generator_arm.cc
@@ -1411,7 +1411,10 @@
break;
case Primitive::kPrimLong:
- LOG(FATAL) << "Not yet implemented type for not operation " << not_->GetResultType();
+ __ mvn(out.AsRegisterPairLow<Register>(),
+ ShifterOperand(in.AsRegisterPairLow<Register>()));
+ __ mvn(out.AsRegisterPairHigh<Register>(),
+ ShifterOperand(in.AsRegisterPairHigh<Register>()));
break;
default:
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index aa0f06b..99fa11d 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1360,9 +1360,9 @@
void InstructionCodeGeneratorX86::VisitNot(HNot* not_) {
LocationSummary* locations = not_->GetLocations();
- DCHECK_EQ(locations->InAt(0).As<Register>(), locations->Out().As<Register>());
+ Location in = locations->InAt(0);
Location out = locations->Out();
- DCHECK_EQ(locations->InAt(0).As<Register>(), out.As<Register>());
+ DCHECK(in.Equals(out));
switch (not_->InputAt(0)->GetType()) {
case Primitive::kPrimBoolean:
__ xorl(out.As<Register>(), Immediate(1));
@@ -1373,7 +1373,8 @@
break;
case Primitive::kPrimLong:
- LOG(FATAL) << "Not yet implemented type for not operation " << not_->GetResultType();
+ __ notl(out.AsRegisterPairLow<Register>());
+ __ notl(out.AsRegisterPairHigh<Register>());
break;
default:
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 892ca9d..163156a 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -1299,7 +1299,7 @@
break;
case Primitive::kPrimLong:
- LOG(FATAL) << "Not yet implemented type for not operation " << not_->GetResultType();
+ __ notq(out.As<CpuRegister>());
break;
default: