[PATCH] D62818: [InstCombine] Introduce fold for icmp pred (and X, (sh signbit, Y)), 0.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 10:55:14 PDT 2019


huihuiz added a comment.

In D62818#1534806 <https://reviews.llvm.org/D62818#1534806>, @xbolva00 wrote:

> More signum, sgn patterns
>  https://godbolt.org/z/tE00f4


Hey @xbolva00 , I don't see there is much difference between codegen of x86-clang and x86-gcc.
Let's focus on the missing folds we are trying to resolve here:

  (X & (signbit l>> Y)) ==/!= 0 -> (X << Y) >=/< 0
  (X & (signbit << Y)) ==/!= 0 -> (X l>> Y) >=/< 0

and fold order issue of

  ((X << Y) & signbit) ==/!= 0) -> (X << Y) >=/< 0;
  (X << Y) & ~C ==/!= 0 -> (X << Y) </>= C+1, C+1 is power of 2;
  and
  ((X << Y) & C) == 0 -> (X & (C >> Y)) == 0.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62818





More information about the llvm-commits mailing list