]>
git.ipfire.org Git - thirdparty/gcc.git/commit
math-opts: Only build FMA when use is in addends. [PR123940]
When looking for an FMA opportunity we can find a multiplication use in an
else operand:
vect_pretmp_50.23_121 = MEM <vector(2) charD.2> [(charD.2 *)&dD.2916 + 14B];
vect__28.25_123 = vect_pretmp_50.23_121 * { 2, 2 };
vect_patt_99.26_124 = .COND_ADD ({ -1, -1 }, vect_pretmp_50.23_121, { 14, 15 }, vect__28.25_123);
and build it:
vect_pretmp_50.23_121 = MEM <vector(2) charD.2> [(charD.2 *)&dD.2916 + 14B];
vect_patt_99.26_124 = .FMA (vect_pretmp_50.23_121, { 2, 2 }, vect_pretmp_50.23_121);
This patch checks if the use is in one of the addends.
PR tree-optimization/123940
gcc/ChangeLog:
* tree-ssa-math-opts.cc (convert_mult_to_fma): Check
multiplication result is an addend.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr123940.c: New test.
Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>