[llvm] r184834 - [PowerPC] Add extended rotate/shift mnemonics

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Wed Jun 26 05:18:34 PDT 2013


Chris Lattner <clattner at apple.com> wrote on 25.06.2013 23:59:36:
> On Jun 25, 2013, at 6:17 AM, Ulrich Weigand <Ulrich.Weigand at de.ibm.com>
wrote:
> > +  case PPC::EXTRWI:
> > +  case PPC::EXTRWIo: {
> > +    MCInst TmpInst;
> > +    int64_t N = Inst.getOperand(2).getImm();
> > +    int64_t B = Inst.getOperand(3).getImm();
> > +    TmpInst.setOpcode(Opcode == PPC::EXTRWI? PPC::RLWINM :
PPC::RLWINMo);
> > +    TmpInst.addOperand(Inst.getOperand(0));
> > +    TmpInst.addOperand(Inst.getOperand(1));
> > +    TmpInst.addOperand(MCOperand::CreateImm(B + N));
> > +    TmpInst.addOperand(MCOperand::CreateImm(32 - N));
> > +    TmpInst.addOperand(MCOperand::CreateImm(31));
> > +    Inst = TmpInst;
> > +    break;
> > +  }
>
> is really unfortunate.  Is there any way to extend tablegen to
> generate this for you?

Hi Chris,

I agree that it would be nicer if tablegen could generate this,
but I don't know off-hand how to fit this into the existing
AsmMatcher generator.  The logic there really fundamentally
handles one operand after the other; but for a transformation
like the above it is necessary to look at two incoming operands
at the same time.

If anyone has any suggestions on how to extend tablegen to
help with transformations like those, I'd certainly appreciate
that ...


Bye,
Ulrich




More information about the llvm-commits mailing list