@@ -430,29 +430,18 @@ void PPCInstPrinter::printS16ImmOperand(const MCInst *MI, unsigned OpNo,
430430 printOperand (MI, OpNo, STI, O);
431431}
432432
433- void PPCInstPrinter::printS32ImmOperand (const MCInst *MI, unsigned OpNo,
433+ template <uint64_t N>
434+ void PPCInstPrinter::printSImmOperand (const MCInst *MI, unsigned OpNo,
434435 const MCSubtargetInfo &STI,
435436 raw_ostream &O) {
436437 if (MI->getOperand (OpNo).isImm ()) {
437- long long Value = MI->getOperand (OpNo).getImm ();
438- assert (isInt<32 >(Value) && " Invalid s32imm argument!" );
439- O << (long long )Value;
438+ int64_t Value = MI->getOperand (OpNo).getImm ();
439+ assert (isInt<N >(Value) && " Invalid imm argument!" );
440+ O << (int64_t )Value;
440441 } else
441442 printOperand (MI, OpNo, STI, O);
442443}
443444
444- void PPCInstPrinter::printS34ImmOperand (const MCInst *MI, unsigned OpNo,
445- const MCSubtargetInfo &STI,
446- raw_ostream &O) {
447- if (MI->getOperand (OpNo).isImm ()) {
448- long long Value = MI->getOperand (OpNo).getImm ();
449- assert (isInt<34 >(Value) && " Invalid s34imm argument!" );
450- O << (long long )Value;
451- }
452- else
453- printOperand (MI, OpNo, STI, O);
454- }
455-
456445void PPCInstPrinter::printU16ImmOperand (const MCInst *MI, unsigned OpNo,
457446 const MCSubtargetInfo &STI,
458447 raw_ostream &O) {
@@ -543,7 +532,7 @@ void PPCInstPrinter::printMemRegImmHash(const MCInst *MI, unsigned OpNo,
543532void PPCInstPrinter::printMemRegImm34PCRel (const MCInst *MI, unsigned OpNo,
544533 const MCSubtargetInfo &STI,
545534 raw_ostream &O) {
546- printS34ImmOperand (MI, OpNo, STI, O);
535+ printSImmOperand< 34 > (MI, OpNo, STI, O);
547536 O << ' (' ;
548537 printImmZeroOperand (MI, OpNo + 1 , STI, O);
549538 O << ' )' ;
@@ -552,7 +541,7 @@ void PPCInstPrinter::printMemRegImm34PCRel(const MCInst *MI, unsigned OpNo,
552541void PPCInstPrinter::printMemRegImm34 (const MCInst *MI, unsigned OpNo,
553542 const MCSubtargetInfo &STI,
554543 raw_ostream &O) {
555- printS34ImmOperand (MI, OpNo, STI, O);
544+ printSImmOperand< 34 > (MI, OpNo, STI, O);
556545 O << ' (' ;
557546 printOperand (MI, OpNo + 1 , STI, O);
558547 O << ' )' ;
0 commit comments