diff mbox

[AArch64,costs,6/18] Set default costs and handle vector modes.

Message ID 1395941622-22926-7-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

James Greenhalgh March 27, 2014, 5:33 p.m. UTC
Hi,

The GCC rtx_costs function will try to be helpful by setting the
cost of a multiply to something very high.  As this is unlikely
to be appropriate we want to overwrite these costs as soon as
possible.

We start with the assumption that everything will be as expensive
as the cheapest instruction.

Additionally, we do a terrible job of costing vector operations,
and we really shouldn't pretend that any of the code in this function
will make the right decision when faced with a vector. So we take
the simplifying view that all vector operations are basically the
same. This will not give a good costing function, and there is
scope for improvement in future. Just trying to cost the
element-function is unlikely to be appropriate, it would imply an ADD
and a vector ADD were equally expensive.

Tested in series on aarch64-none-elf.

OK for stage 1?

Thanks,
James

---
2014-03-27  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64.c (aarch64_rtx_costs): Set default costs.
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 11dc788..766d70d 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4808,6 +4808,21 @@  aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
     = aarch64_tune_params->insn_extra_cost;
   enum machine_mode mode = GET_MODE (x);
 
+  /* By default, assume that everything has equivalent cost to the
+     cheapest instruction.  Any additional costs are applied as a delta
+     above this default.  */
+  *cost = COSTS_N_INSNS (1);
+
+  /* TODO: The cost infrastructure currently does not handle
+     vector operations.  Assume that all vector operations
+     are equally expensive.  */
+  if (VECTOR_MODE_P (mode))
+    {
+      if (speed)
+	*cost += extra_cost->vect.alu;
+      return true;
+    }
+
   switch (code)
     {
     case SET: