[PATCH] D141180: [X86] Only match BMI (BLSR, BLSI, BLSMSK) if the add/sub op is single use

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 21:25:52 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.td:1272
 
+// An 'ineg' node with a single use.
+def ineg_su : PatFrag<(ops node:$v), (ineg node:$v), [{
----------------
Maybe we should have

```
`class binop_oneuse<SDPatternOperator operator>
    : PatFrag<(ops node:$A, node:$B),
              (operator node:$A, node:$B), [{
  return N->hasOneUse();
}]>;`

def add_su : binop_oneuse<add>;
def and_su : binop_oneuse<and>;
def srl_su : binop_oneuse<srl>;

class unop_oneuse<SDPatternOperator operator>
    : PatFrag<(ops node:$A),
              (operator node:$A), [{
  return N->hasOneUse();
}]>;

def ineg_su : unop_oneuse<ineg>;
def trunc_su : unop_oneuse<trunc>;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141180/new/

https://reviews.llvm.org/D141180



More information about the llvm-commits mailing list