From: Yufeng Zhang Date: Tue, 26 Nov 2013 16:36:14 +0000 (+0000) Subject: arm.c (arm_legitimize_address): Check xop1 is not a constant immediate before force_reg. X-Git-Tag: releases/gcc-4.9.0~2446 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=97c34bdbe2aa20ef2e74326e0799466176af8c5f;p=thirdparty%2Fgcc.git arm.c (arm_legitimize_address): Check xop1 is not a constant immediate before force_reg. gcc/ * config/arm/arm.c (arm_legitimize_address): Check xop1 is not a constant immediate before force_reg. gcc/testsuite/ * gcc.target/arm/20131120.c: New test. From-SVN: r205397 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 75ad19c9e34a..62dc6e0bca56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-11-26 Yufeng Zhang + + * config/arm/arm.c (arm_legitimize_address): Check xop1 is not + a constant immediate before force_reg. + 2013-11-26 Richard Biener PR tree-optimization/59245 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index f88ebbc15363..129e4280ae2c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -7118,7 +7118,8 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) if (CONSTANT_P (xop0) && !symbol_mentioned_p (xop0)) xop0 = force_reg (SImode, xop0); - if (CONSTANT_P (xop1) && !symbol_mentioned_p (xop1)) + if (CONSTANT_P (xop1) && !CONST_INT_P (xop1) + && !symbol_mentioned_p (xop1)) xop1 = force_reg (SImode, xop1); if (ARM_BASE_REGISTER_RTX_P (xop0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23113f3009de..9cbfd4184c72 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-11-26 Yufeng Zhang + + * gcc.target/arm/20131120.c: New test. + 2013-11-26 Richard Biener PR tree-optimization/59245 diff --git a/gcc/testsuite/gcc.target/arm/20131120.c b/gcc/testsuite/gcc.target/arm/20131120.c new file mode 100644 index 000000000000..c370ae60cd80 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/20131120.c @@ -0,0 +1,14 @@ +/* Check that CONST_INT is not forced into REG before PLUS. */ +/* { dg-do compile { target { arm_arm_ok || arm_thumb2_ok} } } */ +/* { dg-options "-O2 -fdump-rtl-expand" } */ + +typedef int Arr2[50][50]; + +void +foo (Arr2 a2, int i) +{ + a2[i+20][i] = 1; +} + +/* { dg-final { scan-rtl-dump-not "\\\(set \\\(reg:SI \[0-9\]*\\\)\[\n\r\]+\[ \t]*\\\(const_int 4000" "expand" } } */ +/* { dg-final { cleanup-rtl-dump "expand" } } */