diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-06 05:01:47 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-06 05:01:47 +0000 |
commit | a5353ed5bc3a9e43fead0a591de28bb558de70bf (patch) | |
tree | f0a04f222e2f46b642413467003f32e7e133edac /gcc/config/epiphany | |
parent | cc8ef84f080417899bd41b06d4c73126a20d41a6 (diff) | |
download | gcc-a5353ed5bc3a9e43fead0a591de28bb558de70bf.tar.gz |
* config/epiphany/epiphany.c (epiphany_address_cost):
Use MODE parameter.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193205 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/epiphany')
-rw-r--r-- | gcc/config/epiphany/epiphany.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index 65bb1c8ee88..0b3e27a5669 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -729,7 +729,7 @@ epiphany_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED, If ADDR is not a valid address, its cost is irrelevant. */ static int -epiphany_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED, +epiphany_address_cost (rtx addr, enum machine_mode mode, addr_space_t as ATTRIBUTE_UNUSED, bool speed) { rtx reg; @@ -761,19 +761,28 @@ epiphany_address_cost (rtx addr, enum machine_mode mode ATTRIBUTE_UNUSED, } if (!satisfies_constraint_Rgs (reg)) return 1; - /* ??? We don't know the mode of the memory access. We are going to assume - SImode, unless lack of offset alignment indicates a smaller access. */ + /* The offset range available for short instructions depends on the mode + of the memory access. */ /* First, make sure we have a valid integer. */ if (!satisfies_constraint_L (off)) return 1; i = INTVAL (off); - if ((i & 1) == 0) - i >>= 1; - if ((i & 1) == 0) - i >>= 1; - if (i < -7 || i > 7) - return 1; - return 0; + switch (GET_MODE_SIZE (mode)) + { + default: + case 4: + if (i & 1) + return 1; + i >>= 1; + /* Fall through. */ + case 2: + if (i & 1) + return 1; + i >>= 1; + /* Fall through. */ + case 1: + return i < -7 || i > 7; + } } /* Compute the cost of moving data between registers and memory. |