From cef58349a086b8294d14514c37fbacdf44395d18 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 3 Aug 2016 10:05:14 +0930 Subject: [PATCH] [RS6000] cost SLOW_UNALIGNED_ACCESS * config/rs6000/rs6000.c (rs6000_rtx_costs): Make unaligned mem cost more. From-SVN: r239012 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a75f39fdbbb..e8de5b9f605 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-08-03 Alan Modra + + * config/rs6000/rs6000.c (rs6000_rtx_costs): Make unaligned mem + cost more. + 2016-08-03 Alan Modra * config/rs6000/rs6000.md (fix_truncsi2): Force source operand diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5b9aae27681..2ae3e7e6796 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -34336,11 +34336,16 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, case CONST: case HIGH: case SYMBOL_REF: + *total = !speed ? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (2); + return true; + case MEM: /* When optimizing for size, MEM should be slightly more expensive than generating address, e.g., (plus (reg) (const)). L1 cache latency is about two instructions. */ *total = !speed ? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (2); + if (SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (x))) + *total += COSTS_N_INSNS (100); return true; case LABEL_REF: -- 2.30.2