Use strict_low_part for loading a constant only if it is cheaper

PR rtl-optimization/54555
	* postreload.c (move2add_use_add2_insn): Substitute
	STRICT_LOW_PART only if it is cheaper.

testsuite/:
	PR rtl-optimization/54555
	* gcc.target/m68k/pr54555.c: New test.

From-SVN: r211777
This commit is contained in:
Andreas Schwab 2014-06-18 10:37:14 +00:00 committed by Andreas Schwab
parent 9fdb837f67
commit a0f37b26c5
4 changed files with 32 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2014-06-18 Andreas Schwab <schwab@suse.de>
PR rtl-optimization/54555
* postreload.c (move2add_use_add2_insn): Substitute
STRICT_LOW_PART only if it is cheaper.
2014-06-18 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*sibcall_memory): Rename from *sibcall_intern.

View File

@ -1805,10 +1805,14 @@ move2add_use_add2_insn (rtx reg, rtx sym, rtx off, rtx insn)
gen_rtx_STRICT_LOW_PART (VOIDmode,
narrow_reg),
narrow_src);
changed = validate_change (insn, &PATTERN (insn),
new_set, 0);
if (changed)
break;
get_full_set_rtx_cost (new_set, &newcst);
if (costs_lt_p (&newcst, &oldcst, speed))
{
changed = validate_change (insn, &PATTERN (insn),
new_set, 0);
if (changed)
break;
}
}
}
}

View File

@ -1,3 +1,8 @@
2014-06-18 Andreas Schwab <schwab@suse.de>
PR rtl-optimization/54555
* gcc.target/m68k/pr54555.c: New test.
2014-06-18 Olivier Hainque <hainque@adacore.com>
* gnat.dg/blocklocs.adb: New test.

View File

@ -0,0 +1,13 @@
/* PR rtl-optimization/54555
Test that postreload does not shorten the load of small constants to
use move.b instead of moveq. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not "move\\.?b" } } */
void foo (void);
void bar (int a)
{
if (a == 16 || a == 23) foo ();
if (a == -110 || a == -128) foo ();
}