[PATCH] D124150: [InstCombine] Handle predicates for fold fcmp-of-copysign
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 11:16:37 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:6762-6763
+ // copysign(non-zero constant, X) > 0.0 --> (bitcast X) > 0
+ // copysign(non-zero constant, X) <= 0.0 --> (bitcast X) <= 0
+ // copysign(non-zero constant, X) >= 0.0 --> (bitcast X) >= 0
+ switch (Pred) {
----------------
This is not correct if X is 0.0 (0x00000000).
copysign(1.0, 0.0) <= 0.0 is false
(bitcast 0.0) <= 0 is true
Similarly:
copysign(1.0, 0.0) > 0.0 is true
(bitcast 0.0) > 0 is false
I don't think we can verify copysign with Alive2, so please write a test program to check edge values so we know the transform is always correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124150/new/
https://reviews.llvm.org/D124150
More information about the llvm-commits
mailing list