[LLVMdev] [LLVMDev] Add not instruction to PTX backend

Dan Bailey
Mon, 09 May 2011 10:18:55 -0000

<meta content="text/html;charset=UTF-8"
http-equiv="Content-Type">


陳韋任 wrote:
<blockquote cite="mid:20110509013918.GA13760@cs.nctu.edu.tw"
type="cite">
Hi, Justin



We're been writing multiclasses for each
unique type of instruction.  The
current PTX_LOGIC version is for 3-operand instructions.  A new multiclass
needs to be created for 2-operand logic instructions.



  I am trying to add a multiclass for 2-operand logic instructions. For
example,

multiclass PTX_LOGIC_2OP<string opcstr, SDNode opnode> {
  def ripreds : InstPTX<(outs Preds:$d),
                     (ins Preds:$a),
                     !strconcat(opcstr, ".pred\t$d, $a"),
                     [(set Preds:$d, (opnode Preds:$a))]>;

  ...
}


The error here is due to the fact that the 'not' dag is defined as a
pattern fragment rather than being an explicit dag node in itself.

As a result, you'd need to define your multiclass as:

multiclass PTX_LOGIC_20P<string opcstr, PatFrag opnode> { ... }

This will correctly match the opnode, though it'll depend on the other
2-operand logic instructions whether this is how it should be done. If
you look at the definitions in include/Target/TargetSelectionDAG.td,
you'll see which instructions are defined as a PatFrag and which are
plain SDNodes.

Dan

<blockquote cite="mid:20110509013918.GA13760@cs.nctu.edu.tw"
type="cite">
But the error is still the same. Where else
should I look into?