[PATCH] D115629: [RISCV] Use binvi and bexti to fold and (not (srl X, C)), 1

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 23:04:05 PST 2021


jacquesguan added a comment.

In D115629#3189585 <https://reviews.llvm.org/D115629#3189585>, @craig.topper wrote:

> Have you seen real cases of this pattern? InstCombine canonicalizes this to (xor (and (srl X, C), 1), 1) before we get to SelectionDAG.

Yes. As you said, InstCombine do canonicalize this to `xor (and (srl X, C), 1), 1` , but DAGCombine will also fold `(xor (and x, y), y) -> (and (not x), y)`. So we still get `and (not (srl X, C)), 1` in SelectionDAG. I will add another case `xor (and (srl X, C), 1), 1` to show this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115629



More information about the llvm-commits mailing list