riscv64: [codegen] Implement VisitNot
Test: m test-art-host-gtest
Bug: 283082089
Change-Id: I13f717040e474cee43211386ff669d3a5997c280
diff --git a/compiler/optimizing/code_generator_riscv64.cc b/compiler/optimizing/code_generator_riscv64.cc
index 9d74d15..e4160bd 100644
--- a/compiler/optimizing/code_generator_riscv64.cc
+++ b/compiler/optimizing/code_generator_riscv64.cc
@@ -2498,13 +2498,23 @@
}
void LocationsBuilderRISCV64::VisitNot(HNot* instruction) {
- UNUSED(instruction);
- LOG(FATAL) << "Unimplemented";
+ LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(instruction);
+ locations->SetInAt(0, Location::RequiresRegister());
+ locations->SetOut(Location::RequiresRegister(), Location::kNoOutputOverlap);
}
void InstructionCodeGeneratorRISCV64::VisitNot(HNot* instruction) {
- UNUSED(instruction);
- LOG(FATAL) << "Unimplemented";
+ LocationSummary* locations = instruction->GetLocations();
+ switch (instruction->GetResultType()) {
+ case DataType::Type::kInt32:
+ case DataType::Type::kInt64:
+ __ Not(locations->Out().AsRegister<XRegister>(), locations->InAt(0).AsRegister<XRegister>());
+ break;
+
+ default:
+ LOG(FATAL) << "Unexpected type for not operation " << instruction->GetResultType();
+ UNREACHABLE();
+ }
}
void LocationsBuilderRISCV64::VisitNotEqual(HNotEqual* instruction) {