Difference between Predicates and Requires in td file

Hi All,

  I am looking for how to distinguish instructions between subtargets,
and it seems both
Predicates and Requires be able to do that. Take Hexagon as example, I see

  let Predicates = [HasV5T] in {
    def: Pat<(f32 (fminnum F32:$Rs, F32:$Rt)), (F2_sfmin F32:$Rs, F32:$Rt)>;
    def: Pat<(f32 (fmaxnum F32:$Rs, F32:$Rt)), (F2_sfmax F32:$Rs, F32:$Rt)>;

and this

  def: Pat<(sra (add (sra I64:$src, u6_0ImmPred:$u6), 1), (i32 1)),
                (S2_asr_i_p_rnd DoubleRegs:$src, imm:$u6)>, Requires<[HasV5T]>;

Are they really the same? If so, I guess if I have multiple
instructions belong to one
specific subtarget, I should use Predicates; otherwise, just use
Requires. Am I right
or wrong?



They are the same. There is a member "Predicates" in class Pat, and both forms assign a value to that member.

You can use whichever one you prefer. The "let" form allows you to specify it once for multiple defs.