diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2014-09-02 16:44:56 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2014-09-02 16:44:56 +0000 |
commit | 7676fe1878b73eec676a362a0653892b0694c928 (patch) | |
tree | f8cf9d3be7f922c5d2a56f46725d94846a0c64ec /llvm/lib/CodeGen/MachineCombiner.cpp | |
parent | 12cc99eb13d18ed7208a64fe2c830f662a747236 (diff) | |
download | llvm-7676fe1878b73eec676a362a0653892b0694c928.zip llvm-7676fe1878b73eec676a362a0653892b0694c928.tar.gz llvm-7676fe1878b73eec676a362a0653892b0694c928.tar.bz2 |
[APFloat] Fixed a bug in method 'fusedMultiplyAdd'.
When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.
Example:
define double @test() {
%1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
ret double %1
}
Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).
Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.
This fixes PR20832.
Differential Revision: http://reviews.llvm.org/D5152
llvm-svn: 216913
Diffstat (limited to 'llvm/lib/CodeGen/MachineCombiner.cpp')
0 files changed, 0 insertions, 0 deletions