aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/aarch64
diff options
context:
space:
mode:
authorJames Greenhalgh <james.greenhalgh@arm.com>2014-05-16 09:25:48 +0000
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>2014-05-16 09:25:48 +0000
commit909734beb71dbf888dfda464541f5acd614e5d25 (patch)
treea472934fbcd212001e9f77a0d2679e80b05ccce2 /gcc/config/aarch64
parentfb620c4a9a2120478ce4d6c9fc09826d39c89529 (diff)
downloadgcc-909734beb71dbf888dfda464541f5acd614e5d25.zip
gcc-909734beb71dbf888dfda464541f5acd614e5d25.tar.gz
gcc-909734beb71dbf888dfda464541f5acd614e5d25.tar.bz2
[AArch64 costs 17/18] Cost for SYMBOL_REF, HIGH and LO_SUM
gcc/ * config/aarch64/aarch64.c (aarch64_rtx_costs): Cost SYMBOL_REF, HIGH, LO_SUM. From-SVN: r210509
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r--gcc/config/aarch64/aarch64.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 58627b5..9eff2fd 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5508,15 +5508,44 @@ cost_plus:
return false; /* All arguments need to be in registers. */
}
- case HIGH:
- if (!CONSTANT_P (XEXP (x, 0)))
- *cost += rtx_cost (XEXP (x, 0), HIGH, 0, speed);
+ case SYMBOL_REF:
+
+ if (aarch64_cmodel == AARCH64_CMODEL_LARGE)
+ {
+ /* LDR. */
+ if (speed)
+ *cost += extra_cost->ldst.load;
+ }
+ else if (aarch64_cmodel == AARCH64_CMODEL_SMALL
+ || aarch64_cmodel == AARCH64_CMODEL_SMALL_PIC)
+ {
+ /* ADRP, followed by ADD. */
+ *cost += COSTS_N_INSNS (1);
+ if (speed)
+ *cost += 2 * extra_cost->alu.arith;
+ }
+ else if (aarch64_cmodel == AARCH64_CMODEL_TINY
+ || aarch64_cmodel == AARCH64_CMODEL_TINY_PIC)
+ {
+ /* ADR. */
+ if (speed)
+ *cost += extra_cost->alu.arith;
+ }
+
+ if (flag_pic)
+ {
+ /* One extra load instruction, after accessing the GOT. */
+ *cost += COSTS_N_INSNS (1);
+ if (speed)
+ *cost += extra_cost->ldst.load;
+ }
return true;
+ case HIGH:
case LO_SUM:
- if (!CONSTANT_P (XEXP (x, 1)))
- *cost += rtx_cost (XEXP (x, 1), LO_SUM, 1, speed);
- *cost += rtx_cost (XEXP (x, 0), LO_SUM, 0, speed);
+ /* ADRP/ADD (immediate). */
+ if (speed)
+ *cost += extra_cost->alu.arith;
return true;
case ZERO_EXTRACT: