<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
陳韋任 wrote:
<blockquote cite="mid:20110509013918.GA13760@cs.nctu.edu.tw" type="cite">
  <pre wrap="">Hi, Justin

  </pre>
  <blockquote type="cite">
    <pre wrap="">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.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  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))]>;

  ...
}
  </pre>
</blockquote>
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.<br>
<br>
As a result, you'd need to define your multiclass as:<br>
<br>
multiclass PTX_LOGIC_20P<string opcstr, PatFrag opnode> { ... }<br>
<br>
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.<br>
<br>
Dan<br>
<br>
<blockquote cite="mid:20110509013918.GA13760@cs.nctu.edu.tw" type="cite">
  <pre wrap="">  But the error is still the same. Where else should I look into?

  Thanks.

Regards,
chenwj

  </pre>
</blockquote>
</body>
</html>