re PR target/45670 (Less efficient x86 addressing mode selection on 4.6, causes -Os size regression from 4.5)

PR target/45670
	* expr.c (expand_expr_real_1) <case MEM_REF>: Use EXPAND_SUM
	instead of EXPAND_NORMAL for base expansion.

	* gcc.target/i386/pr45670.c: New test.

From-SVN: r166371
This commit is contained in:
Jakub Jelinek 2010-11-05 20:00:27 +01:00 committed by Jakub Jelinek
parent 444d6efeb6
commit ee01a467d1
4 changed files with 35 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2010-11-05 Jakub Jelinek <jakub@redhat.com>
PR target/45670
* expr.c (expand_expr_real_1) <case MEM_REF>: Use EXPAND_SUM
instead of EXPAND_NORMAL for base expansion.
2010-11-05 Uros Bizjak <ubizjak@gmail.com>
* config.gcc: Support --with-fpmath=avx for x86.

View file

@ -8754,7 +8754,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
align = MAX (TYPE_ALIGN (TREE_TYPE (exp)),
get_object_alignment (exp, BIGGEST_ALIGNMENT));
op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_NORMAL);
op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_SUM);
op0 = convert_memory_address_addr_space (address_mode, op0, as);
if (!integer_zerop (TREE_OPERAND (exp, 1)))
{

View file

@ -1,3 +1,8 @@
2010-11-05 Jakub Jelinek <jakub@redhat.com>
PR target/45670
* gcc.target/i386/pr45670.c: New test.
2010-11-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/45451

View file

@ -0,0 +1,23 @@
/* PR target/45670 */
/* { dg-do compile } */
/* { dg-options "-Os -mtune=generic" } */
struct S
{
float *buf;
int size;
};
void
foo (struct S *s)
{
int i;
for (i = 0; i < s->size; ++i)
s->buf[i] = 0;
}
/* Ensure we don't generate
lea (reg1,4),reg2; add (reg3),reg2; movl $0, (reg2)
instead of smaller
mov (reg3),reg2; movl $0, (reg2,reg1,4) */
/* { dg-final { scan-assembler-not "lea\[lq\]" } } */