[PATCH] D126190: [InstCombine] Add combine for fcmp sqrt(x),C --> fcmp x,C*C

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 10:55:58 PDT 2022


efriedma added a comment.

I think I'd prefer to start with the cases that don't require fast-math flags, then expand the transform as needed to include the cases that do require them.

For example, Alive2 says the following is correct without any fast-math flags:

  declare half @llvm.sqrt.f16(half)
  define i1 @src(half %x) {
    %sqrt = call half @llvm.sqrt.f16(half %x)
    %cmp = fcmp ogt half %sqrt, 2.0
    ret i1 %cmp
  }
  define i1 @tgt(half %x) {
    %r = fcmp ogt half %x, 4.00390625
    ret i1 %r
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126190



More information about the llvm-commits mailing list