[PATCH] D109194: [InstCombine] Optimize (a & b) | (~a & c)

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 17:50:33 PDT 2021


MatzeB added a comment.

> It looks like have a reverse fold to this in DAG: DAGCombiner::unfoldMaskedMerge

Notice that too. It depends on `TargetLower::hasAndNot()` to return `true`. I tried implementing `hasAndNot()` in the ARM and SystemZ backend trying to eliminate the differences here, unfortunately that has ripple effects in other areas and I am not sure how deep I want to dig (patterns like `select(x < 0, 0, x)` are DAGCombined into `(x & ~(x >>s 31))` making the targets fail to select specialized saturation instructions...). Though I could probably refactor things to make it possible to independently unfold masked merge separately from the and-not zero saturation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109194



More information about the llvm-commits mailing list