aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2010-11-11 10:42:35 -0800
committerRichard Henderson <rth@gcc.gnu.org>2010-11-11 10:42:35 -0800
commita1d8aa4b1fc433931788b63d51e652969509e4cd (patch)
treeef82f67ce81c13bd9e9d05a3fa9df5b50b2da485 /gcc
parent658bd5ca00275d0a7b1a987018bc663b8a2d4a57 (diff)
downloadgcc-a1d8aa4b1fc433931788b63d51e652969509e4cd.zip
gcc-a1d8aa4b1fc433931788b63d51e652969509e4cd.tar.gz
gcc-a1d8aa4b1fc433931788b63d51e652969509e4cd.tar.bz2
tree-ssa-math-opts.c (convert_mult_to_fma): Do not verify that the target has the exact fma operation that we matched.
* tree-ssa-math-opts.c (convert_mult_to_fma): Do not verify that the target has the exact fma operation that we matched. From-SVN: r166611
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-math-opts.c26
2 files changed, 17 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 542d959..2cdcaf2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-11 Richard Henderson <rth@redhat.com>
+
+ * tree-ssa-math-opts.c (convert_mult_to_fma): Do not verify
+ that the target has the exact fma operation that we matched.
+
2010-11-11 Joseph Myers <joseph@codesourcery.com>
* reginfo.c (fix_register): Avoid inserting English word in
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 2840150..a2dfac6 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1531,7 +1531,6 @@ convert_mult_to_fma (gimple mul_stmt)
enum tree_code use_code;
tree result = mul_result;
bool negate_p = false;
- optab opt;
use_stmt = USE_STMT (use_p);
@@ -1574,32 +1573,31 @@ convert_mult_to_fma (gimple mul_stmt)
negate_p = true;
}
- /* Determine if the target supports the exact form we found. */
switch (use_code)
{
case MINUS_EXPR:
- if (gimple_assign_rhs1 (use_stmt) == result)
- {
- opt = negate_p ? fnms_optab : fms_optab;
- break;
- }
- negate_p = !negate_p;
- /* FALLTHRU */
-
+ if (gimple_assign_rhs2 (use_stmt) == result)
+ negate_p = !negate_p;
+ break;
case PLUS_EXPR:
- opt = negate_p ? fnma_optab : fma_optab;
break;
-
default:
/* FMA can only be formed from PLUS and MINUS. */
return false;
}
- if (optab_handler (opt, TYPE_MODE (type)) == CODE_FOR_nothing)
- return false;
/* We can't handle a * b + a * b. */
if (gimple_assign_rhs1 (use_stmt) == gimple_assign_rhs2 (use_stmt))
return false;
+
+ /* While it is possible to validate whether or not the exact form
+ that we've recognized is available in the backend, the assumption
+ is that the transformation is never a loss. For instance, suppose
+ the target only has the plain FMA pattern available. Consider
+ a*b-c -> fma(a,b,-c): we've exchanged MUL+SUB for FMA+NEG, which
+ is still two operations. Consider -(a*b)-c -> fma(-a,b,-c): we
+ still have 3 operations, but in the FMA form the two NEGs are
+ independant and could be run in parallel. */
}
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, mul_result)