The patch tries to fold sqrt/sdiv test node, i.g FTSQRT, XVTDIVDP, and the branch, i.e br_cc if they satisfy these patterns:
(br_cc seteq, (truncateToi1 SWTestOp), 0) -> (BCC PRED_NU, SWTestOp) (br_cc seteq, (and Node_test, 2), 0) -> (BCC PRED_NE, PPCNode_test) (br_cc seteq, (and Node_test, 4), 0) -> (BCC PRED_LE, PPCNode_test) (br_cc seteq, (and Node_test, 8), 0) -> (BCC PRED_GE, PPCNode_test) (br_cc setne, (truncateToi1 SWTestOp), 0) -> (BCC PRED_UN, SWTestOp) (br_cc setne, (and Node_test, 2), 0) -> (BCC PRED_EQ, PPCNode_test) (br_cc setne, (and Node_test, 4), 0) -> (BCC PRED_GT, PPCNode_test) (br_cc setne, (and Node_test, 8), 0) -> (BCC PRED_LT, PPCNode_test)
Do you have any problems to implement this folding with .td ? It doesn't make sense to me to get the opcode and then do the folding, as that is done during instr match(.td).