diff --git a/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h b/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h --- a/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h +++ b/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h @@ -32,6 +32,12 @@ class RISCVRegisterBankInfo final : public RISCVGenRegisterBankInfo { public: RISCVRegisterBankInfo(unsigned HwMode); + + const RegisterBank &getRegBankFromRegClass(const TargetRegisterClass &RC, + LLT Ty) const override; + + const InstructionMapping & + getInstrMapping(const MachineInstr &MI) const override; }; } // end namespace llvm #endif diff --git a/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp b/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp @@ -12,6 +12,7 @@ #include "RISCVRegisterBankInfo.h" #include "MCTargetDesc/RISCVMCTargetDesc.h" +#include "RISCVSubtarget.h" #include "llvm/CodeGen/GlobalISel/RegisterBank.h" #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -20,7 +21,115 @@ #define GET_TARGET_REGBANK_IMPL #include "RISCVGenRegisterBank.inc" +namespace llvm { +namespace RISCV { + +RegisterBankInfo::PartialMapping PartMappings[] = { + {0, 32, GPRRegBank}, + {0, 64, GPRRegBank} +}; + +enum PartialMappingIdx { + PMI_GPR32 = 0, + PMI_GPR64 = 1 +}; + +RegisterBankInfo::ValueMapping ValueMappings[] = { + // Invalid value mapping. + {nullptr, 0}, + // Maximum 3 GPR operands; 32 bit. + {&PartMappings[PMI_GPR32], 1}, + {&PartMappings[PMI_GPR32], 1}, + {&PartMappings[PMI_GPR32], 1}, + // Maximum 3 GPR operands; 64 bit. + {&PartMappings[PMI_GPR64], 1}, + {&PartMappings[PMI_GPR64], 1}, + {&PartMappings[PMI_GPR64], 1} +}; + +enum ValueMappingsIdx { + InvalidIdx = 0, + GPR32Idx = 1, + GPR64Idx = 4 +}; +} // namespace RISCV +} // namespace llvm + using namespace llvm; RISCVRegisterBankInfo::RISCVRegisterBankInfo(unsigned HwMode) : RISCVGenRegisterBankInfo(HwMode) {} + +const RegisterBank & +RISCVRegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC, + LLT Ty) const { + switch (RC.getID()) { + default: + llvm_unreachable("Register class not supported"); + case RISCV::GPRRegClassID: + case RISCV::GPRNoX0RegClassID: + case RISCV::GPRNoX0X2RegClassID: + case RISCV::GPRTCRegClassID: + case RISCV::GPRCRegClassID: + case RISCV::GPRC_and_GPRTCRegClassID: + case RISCV::GPRX0RegClassID: + case RISCV::SPRegClassID: + return getRegBank(RISCV::GPRRegBankID); + case RISCV::FPR32RegClassID: + case RISCV::FPR32CRegClassID: + case RISCV::FPR64RegClassID: + case RISCV::FPR64CRegClassID: + llvm_unreachable("Register class not supported"); + } +} + +const RegisterBankInfo::InstructionMapping & +RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { + const auto &Mapping = getInstrMappingImpl(MI); + if (Mapping.isValid()) + return Mapping; + + const MachineFunction &MF = *MI.getParent()->getParent(); + bool IsRV64 = MF.getSubtarget().is64Bit(); + + size_t NumOperands = MI.getNumOperands(); + const ValueMapping *GPRValueMapping = + &RISCV::ValueMappings[IsRV64 ? RISCV::GPR64Idx : RISCV::GPR32Idx]; + const ValueMapping *OperandsMapping = GPRValueMapping; + unsigned MappingID = DefaultMappingID; + + switch (MI.getOpcode()) { + case TargetOpcode::G_ADD: + case TargetOpcode::G_SUB: + case TargetOpcode::G_SHL: + case TargetOpcode::G_ASHR: + case TargetOpcode::G_LSHR: + case TargetOpcode::G_AND: + case TargetOpcode::G_OR: + case TargetOpcode::G_XOR: + case TargetOpcode::G_MUL: + case TargetOpcode::G_SDIV: + case TargetOpcode::G_SREM: + case TargetOpcode::G_UDIV: + case TargetOpcode::G_UREM: + case TargetOpcode::G_UMULH: + break; + case TargetOpcode::G_ANYEXT: + case TargetOpcode::G_TRUNC: + OperandsMapping = + getOperandsMapping({GPRValueMapping, GPRValueMapping, nullptr}); + break; + case TargetOpcode::G_CONSTANT: + OperandsMapping = getOperandsMapping({GPRValueMapping, nullptr}); + break; + case TargetOpcode::G_ICMP: + OperandsMapping = getOperandsMapping( + {GPRValueMapping, nullptr, GPRValueMapping, GPRValueMapping}); + break; + default: + return getInvalidInstructionMapping(); + } + + return getInstructionMapping(MappingID, /*Cost=*/1, OperandsMapping, + NumOperands); +} diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu32.mir b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu32.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu32.mir @@ -0,0 +1,499 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=riscv32 -run-pass=regbankselect -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s -o - \ +# RUN: | FileCheck -check-prefix=RV32I %s + +--- +name: add_anyext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: add_anyext + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[ADD]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %2:_(s32) = COPY $x11 + %8:_(s32) = G_ADD %0, %2 + $x10 = COPY %8(s32) + PseudoRET implicit $x10 + +... +--- +name: add_signext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: add_signext + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY1]] + ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 24 + ; RV32I-NEXT: [[SHL:%[0-9]+]]:gprb(s32) = G_SHL [[ADD]], [[C]](s32) + ; RV32I-NEXT: [[ASHR:%[0-9]+]]:gprb(s32) = G_ASHR [[SHL]], [[C]](s32) + ; RV32I-NEXT: $x10 = COPY [[ASHR]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %2:_(s32) = COPY $x11 + %8:_(s32) = G_ADD %0, %2 + %10:_(s32) = G_CONSTANT i32 24 + %9:_(s32) = G_SHL %8, %10(s32) + %5:_(s32) = G_ASHR %9, %10(s32) + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: add_zeroext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: add_zeroext + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY1]] + ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 255 + ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[ADD]], [[C]] + ; RV32I-NEXT: $x10 = COPY [[AND]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %2:_(s32) = COPY $x11 + %8:_(s32) = G_ADD %0, %2 + %9:_(s32) = G_CONSTANT i32 255 + %5:_(s32) = G_AND %8, %9 + $x10 = COPY %5(s32) + PseudoRET implicit $x10 + +... +--- +name: add_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: add_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[ADD]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_ADD %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: sub_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: sub_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[SUB:%[0-9]+]]:gprb(s32) = G_SUB [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[SUB]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_SUB %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: shl_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: shl_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[SHL:%[0-9]+]]:gprb(s32) = G_SHL [[COPY]], [[COPY1]](s32) + ; RV32I-NEXT: $x10 = COPY [[SHL]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_SHL %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: ashr_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: ashr_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[ASHR:%[0-9]+]]:gprb(s32) = G_ASHR [[COPY]], [[COPY1]](s32) + ; RV32I-NEXT: $x10 = COPY [[ASHR]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_ASHR %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: lshr_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: lshr_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[LSHR:%[0-9]+]]:gprb(s32) = G_LSHR [[COPY]], [[COPY1]](s32) + ; RV32I-NEXT: $x10 = COPY [[LSHR]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_LSHR %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: and_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: and_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[AND]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_AND %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: or_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: or_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[OR:%[0-9]+]]:gprb(s32) = G_OR [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[OR]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_OR %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: xor_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: xor_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[XOR:%[0-9]+]]:gprb(s32) = G_XOR [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[XOR]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_XOR %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: mul_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: mul_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[MUL:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[MUL]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_MUL %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: sdiv_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: sdiv_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[SDIV:%[0-9]+]]:gprb(s32) = G_SDIV [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[SDIV]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_SDIV %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: srem_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: srem_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[SREM:%[0-9]+]]:gprb(s32) = G_SREM [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[SREM]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_SREM %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: udiv_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: udiv_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[UDIV:%[0-9]+]]:gprb(s32) = G_UDIV [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[UDIV]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_UDIV %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: urem_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: urem_i32 + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[UREM:%[0-9]+]]:gprb(s32) = G_UREM [[COPY]], [[COPY1]] + ; RV32I-NEXT: $x10 = COPY [[UREM]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = G_UREM %0, %1 + $x10 = COPY %2(s32) + PseudoRET implicit $x10 + +... +--- +name: add_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV32I-LABEL: name: add_i64 + ; RV32I: liveins: $x10, $x11, $x12, $x13 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x12 + ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s32) = COPY $x13 + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[COPY]], [[COPY2]] + ; RV32I-NEXT: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[COPY2]] + ; RV32I-NEXT: [[ADD1:%[0-9]+]]:gprb(s32) = G_ADD [[COPY1]], [[COPY3]] + ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1 + ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[ICMP]], [[C]] + ; RV32I-NEXT: [[ADD2:%[0-9]+]]:gprb(s32) = G_ADD [[ADD1]], [[AND]] + ; RV32I-NEXT: $x10 = COPY [[ADD]](s32) + ; RV32I-NEXT: $x11 = COPY [[ADD2]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s32) = COPY $x13 + %13:_(s32) = G_ADD %0, %2 + %19:_(s32) = G_ICMP intpred(ult), %13(s32), %2 + %17:_(s32) = G_ADD %1, %3 + %20:_(s32) = G_CONSTANT i32 1 + %18:_(s32) = G_AND %19, %20 + %15:_(s32) = G_ADD %17, %18 + $x10 = COPY %13(s32) + $x11 = COPY %15(s32) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: sub_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV32I-LABEL: name: sub_i64 + ; RV32I: liveins: $x10, $x11, $x12, $x13 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x12 + ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s32) = COPY $x13 + ; RV32I-NEXT: [[SUB:%[0-9]+]]:gprb(s32) = G_SUB [[COPY]], [[COPY2]] + ; RV32I-NEXT: [[ICMP:%[0-9]+]]:gprb(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY2]] + ; RV32I-NEXT: [[SUB1:%[0-9]+]]:gprb(s32) = G_SUB [[COPY1]], [[COPY3]] + ; RV32I-NEXT: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1 + ; RV32I-NEXT: [[AND:%[0-9]+]]:gprb(s32) = G_AND [[ICMP]], [[C]] + ; RV32I-NEXT: [[SUB2:%[0-9]+]]:gprb(s32) = G_SUB [[SUB1]], [[AND]] + ; RV32I-NEXT: $x10 = COPY [[SUB]](s32) + ; RV32I-NEXT: $x11 = COPY [[SUB2]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s32) = COPY $x13 + %13:_(s32) = G_SUB %0, %2 + %21:_(s32) = G_ICMP intpred(ult), %0(s32), %2 + %17:_(s32) = G_SUB %1, %3 + %22:_(s32) = G_CONSTANT i32 1 + %18:_(s32) = G_AND %21, %22 + %15:_(s32) = G_SUB %17, %18 + $x10 = COPY %13(s32) + $x11 = COPY %15(s32) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: mul_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV32I-LABEL: name: mul_i64 + ; RV32I: liveins: $x10, $x11, $x12, $x13 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gprb(s32) = COPY $x11 + ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gprb(s32) = COPY $x12 + ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gprb(s32) = COPY $x13 + ; RV32I-NEXT: [[MUL:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY2]] + ; RV32I-NEXT: [[MUL1:%[0-9]+]]:gprb(s32) = G_MUL [[COPY1]], [[COPY2]] + ; RV32I-NEXT: [[MUL2:%[0-9]+]]:gprb(s32) = G_MUL [[COPY]], [[COPY3]] + ; RV32I-NEXT: [[UMULH:%[0-9]+]]:gprb(s32) = G_UMULH [[COPY]], [[COPY2]] + ; RV32I-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[MUL1]], [[MUL2]] + ; RV32I-NEXT: [[ADD1:%[0-9]+]]:gprb(s32) = G_ADD [[ADD]], [[UMULH]] + ; RV32I-NEXT: $x10 = COPY [[MUL]](s32) + ; RV32I-NEXT: $x11 = COPY [[ADD1]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s32) = COPY $x10 + %1:_(s32) = COPY $x11 + %2:_(s32) = COPY $x12 + %3:_(s32) = COPY $x13 + %13:_(s32) = G_MUL %0, %2 + %14:_(s32) = G_MUL %1, %2 + %15:_(s32) = G_MUL %0, %3 + %16:_(s32) = G_UMULH %0, %2 + %17:_(s32) = G_ADD %14, %15 + %18:_(s32) = G_ADD %17, %16 + $x10 = COPY %13(s32) + $x11 = COPY %18(s32) + PseudoRET implicit $x10, implicit $x11 + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu64.mir b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu64.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/alu64.mir @@ -0,0 +1,779 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=riscv64 -run-pass=regbankselect -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s -o - \ +# RUN: | FileCheck -check-prefix=RV64I %s + +--- +name: add_anyext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: add_anyext + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[ADD]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_ADD %0, %2 + $x10 = COPY %8(s64) + PseudoRET implicit $x10 + +... +--- +name: add_signext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: add_signext + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 56 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[ADD]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_ADD %0, %2 + %10:_(s64) = G_CONSTANT i64 56 + %9:_(s64) = G_SHL %8, %10(s64) + %5:_(s64) = G_ASHR %9, %10(s64) + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: add_zeroext +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: add_zeroext + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 255 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[ADD]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_ADD %0, %2 + %9:_(s64) = G_CONSTANT i64 255 + %5:_(s64) = G_AND %8, %9 + $x10 = COPY %5(s64) + PseudoRET implicit $x10 + +... +--- +name: add_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: add_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 32 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[ADD]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_ADD %0, %2 + %11:_(s64) = G_CONSTANT i64 32 + %10:_(s64) = G_SHL %8, %11(s64) + %9:_(s64) = G_ASHR %10, %11(s64) + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: sub_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: sub_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SUB:%[0-9]+]]:gprb(s64) = G_SUB [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 32 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[SUB]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_SUB %0, %2 + %11:_(s64) = G_CONSTANT i64 32 + %10:_(s64) = G_SHL %8, %11(s64) + %9:_(s64) = G_ASHR %10, %11(s64) + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: shl_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: shl_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4294967295 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[SHL]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_SHL %0, %2(s64) + %10:_(s64) = G_CONSTANT i64 4294967295 + %9:_(s64) = G_AND %8, %10 + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: ashr_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: ashr_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4294967295 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[ASHR]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_ASHR %0, %2(s64) + %10:_(s64) = G_CONSTANT i64 4294967295 + %9:_(s64) = G_AND %8, %10 + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: lshr_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: lshr_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[LSHR:%[0-9]+]]:gprb(s64) = G_LSHR [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4294967295 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[LSHR]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_LSHR %0, %2(s64) + %10:_(s64) = G_CONSTANT i64 4294967295 + %9:_(s64) = G_AND %8, %10 + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: mul_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: mul_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[MUL:%[0-9]+]]:gprb(s64) = G_MUL [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 32 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[MUL]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_MUL %0, %2 + %11:_(s64) = G_CONSTANT i64 32 + %10:_(s64) = G_SHL %8, %11(s64) + %9:_(s64) = G_ASHR %10, %11(s64) + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: sdiv_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: sdiv_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SDIV:%[0-9]+]]:gprb(s64) = G_SDIV [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 32 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[SDIV]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_SDIV %0, %2 + %11:_(s64) = G_CONSTANT i64 32 + %10:_(s64) = G_SHL %8, %11(s64) + %9:_(s64) = G_ASHR %10, %11(s64) + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: srem_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: srem_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SREM:%[0-9]+]]:gprb(s64) = G_SREM [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 32 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[SREM]], [[C]](s64) + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[SHL]], [[C]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_SREM %0, %2 + %11:_(s64) = G_CONSTANT i64 32 + %10:_(s64) = G_SHL %8, %11(s64) + %9:_(s64) = G_ASHR %10, %11(s64) + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: udiv_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: udiv_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[UDIV:%[0-9]+]]:gprb(s64) = G_UDIV [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4294967295 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[UDIV]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_UDIV %0, %2 + %10:_(s64) = G_CONSTANT i64 4294967295 + %9:_(s64) = G_AND %8, %10 + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: urem_i32 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: urem_i32 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[UREM:%[0-9]+]]:gprb(s64) = G_UREM [[COPY]], [[COPY1]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 4294967295 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[UREM]], [[C]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %2:_(s64) = COPY $x11 + %8:_(s64) = G_UREM %0, %2 + %10:_(s64) = G_CONSTANT i64 4294967295 + %9:_(s64) = G_AND %8, %10 + $x10 = COPY %9(s64) + PseudoRET implicit $x10 + +... +--- +name: add_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: add_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[ADD]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_ADD %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: sub_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: sub_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SUB:%[0-9]+]]:gprb(s64) = G_SUB [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[SUB]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_SUB %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: shl_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: shl_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SHL:%[0-9]+]]:gprb(s64) = G_SHL [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: $x10 = COPY [[SHL]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_SHL %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: ashr_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: ashr_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[ASHR:%[0-9]+]]:gprb(s64) = G_ASHR [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: $x10 = COPY [[ASHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_ASHR %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: lshr_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: lshr_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[LSHR:%[0-9]+]]:gprb(s64) = G_LSHR [[COPY]], [[COPY1]](s64) + ; RV64I-NEXT: $x10 = COPY [[LSHR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_LSHR %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: and_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: and_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[AND]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_AND %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: or_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: or_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[OR:%[0-9]+]]:gprb(s64) = G_OR [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[OR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_OR %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: xor_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: xor_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[XOR:%[0-9]+]]:gprb(s64) = G_XOR [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[XOR]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_XOR %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: mul_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: mul_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[MUL:%[0-9]+]]:gprb(s64) = G_MUL [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[MUL]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_MUL %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: sdiv_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: sdiv_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SDIV:%[0-9]+]]:gprb(s64) = G_SDIV [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[SDIV]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_SDIV %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: srem_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: srem_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[SREM:%[0-9]+]]:gprb(s64) = G_SREM [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[SREM]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_SREM %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: udiv_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: udiv_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[UDIV:%[0-9]+]]:gprb(s64) = G_UDIV [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[UDIV]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_UDIV %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: urem_i64 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: urem_i64 + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[UREM:%[0-9]+]]:gprb(s64) = G_UREM [[COPY]], [[COPY1]] + ; RV64I-NEXT: $x10 = COPY [[UREM]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = G_UREM %0, %1 + $x10 = COPY %2(s64) + PseudoRET implicit $x10 + +... +--- +name: add_i128 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV64I-LABEL: name: add_i128 + ; RV64I: liveins: $x10, $x11, $x12, $x13 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x12 + ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gprb(s64) = COPY $x13 + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[COPY]], [[COPY2]] + ; RV64I-NEXT: [[ICMP:%[0-9]+]]:gprb(s64) = G_ICMP intpred(ult), [[ADD]](s64), [[COPY2]] + ; RV64I-NEXT: [[ADD1:%[0-9]+]]:gprb(s64) = G_ADD [[COPY1]], [[COPY3]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[ICMP]], [[C]] + ; RV64I-NEXT: [[ADD2:%[0-9]+]]:gprb(s64) = G_ADD [[ADD1]], [[AND]] + ; RV64I-NEXT: $x10 = COPY [[ADD]](s64) + ; RV64I-NEXT: $x11 = COPY [[ADD2]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s64) = COPY $x13 + %13:_(s64) = G_ADD %0, %2 + %19:_(s64) = G_ICMP intpred(ult), %13(s64), %2 + %17:_(s64) = G_ADD %1, %3 + %20:_(s64) = G_CONSTANT i64 1 + %18:_(s64) = G_AND %19, %20 + %15:_(s64) = G_ADD %17, %18 + $x10 = COPY %13(s64) + $x11 = COPY %15(s64) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: sub_i128 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV64I-LABEL: name: sub_i128 + ; RV64I: liveins: $x10, $x11, $x12, $x13 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x12 + ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gprb(s64) = COPY $x13 + ; RV64I-NEXT: [[SUB:%[0-9]+]]:gprb(s64) = G_SUB [[COPY]], [[COPY2]] + ; RV64I-NEXT: [[ICMP:%[0-9]+]]:gprb(s64) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY2]] + ; RV64I-NEXT: [[SUB1:%[0-9]+]]:gprb(s64) = G_SUB [[COPY1]], [[COPY3]] + ; RV64I-NEXT: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1 + ; RV64I-NEXT: [[AND:%[0-9]+]]:gprb(s64) = G_AND [[ICMP]], [[C]] + ; RV64I-NEXT: [[SUB2:%[0-9]+]]:gprb(s64) = G_SUB [[SUB1]], [[AND]] + ; RV64I-NEXT: $x10 = COPY [[SUB]](s64) + ; RV64I-NEXT: $x11 = COPY [[SUB2]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s64) = COPY $x13 + %13:_(s64) = G_SUB %0, %2 + %21:_(s64) = G_ICMP intpred(ult), %0(s64), %2 + %17:_(s64) = G_SUB %1, %3 + %22:_(s64) = G_CONSTANT i64 1 + %18:_(s64) = G_AND %21, %22 + %15:_(s64) = G_SUB %17, %18 + $x10 = COPY %13(s64) + $x11 = COPY %15(s64) + PseudoRET implicit $x10, implicit $x11 + +... +--- +name: mul_i128 +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $x13 + + ; RV64I-LABEL: name: mul_i128 + ; RV64I: liveins: $x10, $x11, $x12, $x13 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gprb(s64) = COPY $x11 + ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gprb(s64) = COPY $x12 + ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gprb(s64) = COPY $x13 + ; RV64I-NEXT: [[MUL:%[0-9]+]]:gprb(s64) = G_MUL [[COPY]], [[COPY2]] + ; RV64I-NEXT: [[MUL1:%[0-9]+]]:gprb(s64) = G_MUL [[COPY1]], [[COPY2]] + ; RV64I-NEXT: [[MUL2:%[0-9]+]]:gprb(s64) = G_MUL [[COPY]], [[COPY3]] + ; RV64I-NEXT: [[UMULH:%[0-9]+]]:gprb(s64) = G_UMULH [[COPY]], [[COPY2]] + ; RV64I-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[MUL1]], [[MUL2]] + ; RV64I-NEXT: [[ADD1:%[0-9]+]]:gprb(s64) = G_ADD [[ADD]], [[UMULH]] + ; RV64I-NEXT: $x10 = COPY [[MUL]](s64) + ; RV64I-NEXT: $x11 = COPY [[ADD1]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11 + %0:_(s64) = COPY $x10 + %1:_(s64) = COPY $x11 + %2:_(s64) = COPY $x12 + %3:_(s64) = COPY $x13 + %13:_(s64) = G_MUL %0, %2 + %14:_(s64) = G_MUL %1, %2 + %15:_(s64) = G_MUL %0, %3 + %16:_(s64) = G_UMULH %0, %2 + %17:_(s64) = G_ADD %14, %15 + %18:_(s64) = G_ADD %17, %16 + $x10 = COPY %13(s64) + $x11 = COPY %18(s64) + PseudoRET implicit $x10, implicit $x11 + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy32.mir b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy32.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy32.mir @@ -0,0 +1,70 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=riscv32 -run-pass=regbankselect -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s -o - \ +# RUN: | FileCheck -check-prefix=RV32I %s + +--- +name: virt_to_phys +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + + ; RV32I-LABEL: name: virt_to_phys + ; RV32I: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1 + ; RV32I-NEXT: $x10 = COPY [[C]](s32) + ; RV32I-NEXT: PseudoRET implicit $x10 + %0:_(s32) = G_CONSTANT i32 1 + $x10 = COPY %0(s32) + PseudoRET implicit $x10 + +... +--- +name: phys_to_phys +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV32I-LABEL: name: phys_to_phys + ; RV32I: liveins: $x10, $x11 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: $x10 = COPY $x11 + ; RV32I-NEXT: PseudoRET implicit $x10 + $x10 = COPY $x11 + PseudoRET implicit $x10 + +... +--- +name: virt_to_virt +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + + ; RV32I-LABEL: name: virt_to_virt + ; RV32I: [[C:%[0-9]+]]:gprb(s32) = G_CONSTANT i32 1 + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY [[C]](s32) + ; RV32I-NEXT: PseudoRET + %0:_(s32) = G_CONSTANT i32 1 + %1:_(s32) = COPY %0(s32) + PseudoRET + +... +--- +name: phys_to_virt +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10 + + ; RV32I-LABEL: name: phys_to_virt + ; RV32I: liveins: $x10 + ; RV32I-NEXT: {{ $}} + ; RV32I-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY $x10 + ; RV32I-NEXT: PseudoRET + %0:_(s32) = COPY $x10 + PseudoRET + +... diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy64.mir b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy64.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/regbankselect/copy64.mir @@ -0,0 +1,70 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc -march=riscv64 -run-pass=regbankselect -disable-gisel-legality-check -simplify-mir -verify-machineinstrs %s -o - \ +# RUN: | FileCheck -check-prefix=RV64I %s + +--- +name: virt_to_phys +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + + ; RV64I-LABEL: name: virt_to_phys + ; RV64I: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1 + ; RV64I-NEXT: $x10 = COPY [[C]](s64) + ; RV64I-NEXT: PseudoRET implicit $x10 + %0:_(s64) = G_CONSTANT i64 1 + $x10 = COPY %0(s64) + PseudoRET implicit $x10 + +... +--- +name: phys_to_phys +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10, $x11 + + ; RV64I-LABEL: name: phys_to_phys + ; RV64I: liveins: $x10, $x11 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: $x10 = COPY $x11 + ; RV64I-NEXT: PseudoRET implicit $x10 + $x10 = COPY $x11 + PseudoRET implicit $x10 + +... +--- +name: virt_to_virt +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + + ; RV64I-LABEL: name: virt_to_virt + ; RV64I: [[C:%[0-9]+]]:gprb(s64) = G_CONSTANT i64 1 + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY [[C]](s64) + ; RV64I-NEXT: PseudoRET + %0:_(s64) = G_CONSTANT i64 1 + %1:_(s64) = COPY %0(s64) + PseudoRET + +... +--- +name: phys_to_virt +legalized: true +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $x10 + + ; RV64I-LABEL: name: phys_to_virt + ; RV64I: liveins: $x10 + ; RV64I-NEXT: {{ $}} + ; RV64I-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY $x10 + ; RV64I-NEXT: PseudoRET + %0:_(s64) = COPY $x10 + PseudoRET + +...