[ARM] Teach getIntImmCostInst about the cost of saturating fp converts
authorDavid Green <david.green@arm.com>
Thu, 2 Dec 2021 07:56:27 +0000 (07:56 +0000)
committerDavid Green <david.green@arm.com>
Thu, 2 Dec 2021 07:56:27 +0000 (07:56 +0000)
commit646c872f9d74f12b46f6a5e7332188dfa7e251b1
tree36c1b829294ef3d235a8db2362ddf4e0ced1bb2a
parent758d54b462ffc480d6cb860984b8aa062925a396
[ARM] Teach getIntImmCostInst about the cost of saturating fp converts

Given a min(max(fptosi, INT_MIN), INT_MAX) with the correct constants,
we can now generate a fptosi.sat. But in the arm backend, the constant
can be treated as high cost, pulling it out of the basic block in a way
that the DAG combine can no longer see it. This teaches it again that it
is a low cost constant, not worth hoisting out.

Recommitted from 0e98659ea1193c with a fix for APInt comparison.

Differential Revision: https://reviews.llvm.org/D114380
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/test/CodeGen/ARM/fpclamptosat.ll