summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorzqchen <zqchen@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 04:54:06 +0000
committerzqchen <zqchen@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 04:54:06 +0000
commitdd41e03cbf28aea329757e8d1a72970e22be3c75 (patch)
tree68e96db1207de96e14f3c0c839ed05fc9d7d85ee /gcc/tree-ssa-loop-ivopts.c
parent39e3cef3b4444b6de1d917ef489f021b6dd883b6 (diff)
downloadgcc-dd41e03cbf28aea329757e8d1a72970e22be3c75.tar.gz
ChangeLog
2014-08-07 Zhenqiang Chen <zhenqiang.chen@arm.com> * tree-ssa-loop-ivopts.c (get_address_cost): Try aligned offset. testsuite/ChangeLog 2014-08-07 Zhenqiang Chen <zhenqiang.chen@arm.com> * gcc.target/arm/get_address_cost_aligned_max_offset.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213691 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 134a51b3abf..98b60abdcb5 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -3309,6 +3309,18 @@ get_address_cost (bool symbol_present, bool var_present,
XEXP (addr, 1) = gen_int_mode (off, address_mode);
if (memory_address_addr_space_p (mem_mode, addr, as))
break;
+ /* For some TARGET, like ARM THUMB1, the offset should be nature
+ aligned. Try an aligned offset if address_mode is not QImode. */
+ off = (address_mode == QImode)
+ ? 0
+ : ((unsigned HOST_WIDE_INT) 1 << i)
+ - GET_MODE_SIZE (address_mode);
+ if (off > 0)
+ {
+ XEXP (addr, 1) = gen_int_mode (off, address_mode);
+ if (memory_address_addr_space_p (mem_mode, addr, as))
+ break;
+ }
}
if (i == -1)
off = 0;