[backend-O1-1]在后端添加kAnd和kOr的支持

This commit is contained in:
Lixuanwang
2025-08-20 02:46:15 +08:00
parent 7648d9f01f
commit b014efe183

View File

@ -673,6 +673,22 @@ void RISCv64ISel::selectNode(DAGNode* node) {
CurMBB->addInstruction(std::move(xori));
break;
}
case BinaryInst::kAnd: {
auto instr = std::make_unique<MachineInstr>(RVOpcodes::AND);
instr->addOperand(std::make_unique<RegOperand>(dest_vreg));
instr->addOperand(std::make_unique<RegOperand>(lhs_vreg));
instr->addOperand(std::make_unique<RegOperand>(rhs_vreg));
CurMBB->addInstruction(std::move(instr));
break;
}
case BinaryInst::kOr: {
auto instr = std::make_unique<MachineInstr>(RVOpcodes::OR);
instr->addOperand(std::make_unique<RegOperand>(dest_vreg));
instr->addOperand(std::make_unique<RegOperand>(lhs_vreg));
instr->addOperand(std::make_unique<RegOperand>(rhs_vreg));
CurMBB->addInstruction(std::move(instr));
break;
}
default:
throw std::runtime_error("Unsupported binary instruction in ISel");
}