[PATCH] D102673: [ConstantFolding] Fold constrained arithmetic intrinsics
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 4 08:54:25 PDT 2021
spatel added inline comments.
================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:2408
if (auto *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
- if (!Ty->isHalfTy() && !Ty->isFloatTy() && !Ty->isDoubleTy())
+ if (!Ty->isFloatingPointTy())
return nullptr;
----------------
>From the tests, I'm assuming that this diff is here to support bfloat, but this change affects more than constrained intrinsics and more than only bfloat.
Either we need to limit this enhancement, or we need to split this into its own patch and add more tests to make sure it works as expected. I put in some basic coverage for copysign here:
8a4d05ddb3ff
I think things work as expected for simple cases like that one, but I don't know what happens if we are using the host mathlib to evaluate more complex functions (for example "pow" is in the switch under here).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102673/new/
https://reviews.llvm.org/D102673
More information about the llvm-commits
mailing list