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

Chris Lattner clattner at apple.com
Wed Jun 26 21:43:02 PDT 2013


On Jun 26, 2013, at 5:18 AM, Ulrich Weigand <ulrich.weigand at de.ibm.com> wrote:

> 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 ...

I haven't looked at this stuff in a while, but it seems possible to introduce something like SDNodeXForm that could allow custom transformations (e.g. negating a value) by running a specified function written in C++.

-Chris



More information about the llvm-commits mailing list