diff --git a/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp b/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp --- a/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp +++ b/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp @@ -438,12 +438,12 @@ .addReg(DstLoReg, RegState::Define | getDeadRegState(DstIsDead)) .addReg(DstLoReg, getKillRegState(DstIsKill)); - // Do an extra SBCI. + // Do an extra SBC. auto MISBCI = - buildMI(MBB, MBBI, AVR::SBCIRdK) + buildMI(MBB, MBBI, AVR::SBCRdRr) .addReg(DstHiReg, RegState::Define | getDeadRegState(DstIsDead)) .addReg(DstHiReg, getKillRegState(DstIsKill)) - .addImm(0); + .addReg(ZERO_REGISTER); if (ImpIsDead) MISBCI->getOperand(3).setIsDead(); // SREG is always implicitly killed diff --git a/llvm/lib/Target/AVR/AVRInstrInfo.td b/llvm/lib/Target/AVR/AVRInstrInfo.td --- a/llvm/lib/Target/AVR/AVRInstrInfo.td +++ b/llvm/lib/Target/AVR/AVRInstrInfo.td @@ -757,7 +757,7 @@ // Expands to: // neg Rd+1 // neg Rd - // sbci Rd+1, 0 + // sbc Rd+1, r1 def NEGWRd : Pseudo<(outs DREGS:$rd), (ins DREGS:$src), "negw\t$rd", diff --git a/llvm/test/CodeGen/AVR/neg.ll b/llvm/test/CodeGen/AVR/neg.ll --- a/llvm/test/CodeGen/AVR/neg.ll +++ b/llvm/test/CodeGen/AVR/neg.ll @@ -15,7 +15,7 @@ ; CHECK: ; %bb.0: ; CHECK-NEXT: neg r25 ; CHECK-NEXT: neg r24 -; CHECK-NEXT: sbci r25, 0 +; CHECK-NEXT: sbc r25, r1 ; CHECK-NEXT: ret %sub = sub i16 0, %x ret i16 %sub diff --git a/llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir b/llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir --- a/llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir +++ b/llvm/test/CodeGen/AVR/pseudo/NEGWRd.mir @@ -19,7 +19,7 @@ ; CHECK: $r15 = NEGRd $r15, implicit-def dead $sreg ; CHECK-NEXT: $r14 = NEGRd $r14 - ; CHECK-NEXT: $r15 = SBCIRdK $r15, 0, implicit-def $sreg, implicit killed $sreg + ; CHECK-NEXT: $r15 = SBCRdRr $r15, $r1, implicit-def $sreg, implicit killed $sreg $r15r14 = NEGWRd $r15r14, implicit-def $sreg ...