Skip to content

Commit

Permalink
[M68k] allow 16-bit registers for MOVE to/from CCR
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnoElf committed Sep 6, 2024
1 parent fdf72c9 commit 0c16555
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions llvm/lib/Target/M68k/M68kInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,19 @@ void M68kInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
bool ToSR = DstReg == M68k::SR;

if (FromCCR) {
assert(M68k::DR8RegClass.contains(DstReg) &&
"Need DR8 register to copy CCR");
Opc = M68k::MOV8dc;
if (M68k::DR8RegClass.contains(DstReg))
Opc = M68k::MOV8dc;
else if (M68k::DR16RegClass.contains(DstReg))
Opc = M68k::MOV16dc;
else
llvm_unreachable("Invalid register for MOVE from CCR");
} else if (ToCCR) {
assert(M68k::DR8RegClass.contains(SrcReg) &&
"Need DR8 register to copy CCR");
Opc = M68k::MOV8cd;
if (M68k::DR8RegClass.contains(SrcReg))
Opc = M68k::MOV8cd;
else if (M68k::DR16RegClass.contains(SrcReg))
Opc = M68k::MOV16cd;
else
llvm_unreachable("Invalid register for MOVE to CCR");
} else if (FromSR || ToSR)
llvm_unreachable("Cannot emit SR copy instruction");

Expand Down

0 comments on commit 0c16555

Please sign in to comment.