aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2014-04-23 15:17:54 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2014-04-23 15:17:54 +0000
commitba9b1a639fb8dfcf7d54700905fd1ba58d20f739 (patch)
tree077fa5686b7c88606c9f0005913c67cd2423f14b
parentda4cfeacb0a152f4cc3afa7473ccad1b8455eae2 (diff)
downloadgcc-ba9b1a639fb8dfcf7d54700905fd1ba58d20f739.zip
gcc-ba9b1a639fb8dfcf7d54700905fd1ba58d20f739.tar.gz
gcc-ba9b1a639fb8dfcf7d54700905fd1ba58d20f739.tar.bz2
[ARM] Handle FMA code in rtx costs.
* config/arm/arm.c (arm_new_rtx_costs): Handle FMA. From-SVN: r209701
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/arm/arm.c30
2 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c79f26a..5f86e3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/arm/arm.c (arm_new_rtx_costs): Handle FMA.
+
2014-04-23 Richard Biener <rguenther@suse.de>
* Makefile.in (OBJS): Remove loop-unswitch.o.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 88d957a..42df6fe 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -10635,6 +10635,36 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = LIBCALL_COST (1);
return false;
+ case FMA:
+ if (TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_FMA)
+ {
+ rtx op0 = XEXP (x, 0);
+ rtx op1 = XEXP (x, 1);
+ rtx op2 = XEXP (x, 2);
+
+ *cost = COSTS_N_INSNS (1);
+
+ /* vfms or vfnma. */
+ if (GET_CODE (op0) == NEG)
+ op0 = XEXP (op0, 0);
+
+ /* vfnms or vfnma. */
+ if (GET_CODE (op2) == NEG)
+ op2 = XEXP (op2, 0);
+
+ *cost += rtx_cost (op0, FMA, 0, speed_p);
+ *cost += rtx_cost (op1, FMA, 1, speed_p);
+ *cost += rtx_cost (op2, FMA, 2, speed_p);
+
+ if (speed_p)
+ *cost += extra_cost->fp[mode ==DFmode].fma;
+
+ return true;
+ }
+
+ *cost = LIBCALL_COST (3);
+ return false;
+
case FIX:
case UNSIGNED_FIX:
if (TARGET_HARD_FLOAT)