[PATCH] PR54555: Use strict_low_part for loading a constant only if it is cheaper

Jeff Law law@redhat.com
Tue Jun 17 18:23:00 GMT 2014


On 06/17/14 01:47, Andreas Schwab wrote:
> Postreload may transform (set (REGX) (CONST_INT A)) ... (set (REGX)
> (CONST_INT B)) to (set (REGX) (CONST_INT A)) ... (set (STRICT_LOW_PART
> (REGX)) (CONST_INT B)), but it should do that only if the latter is
> cheaper.  On m68k, a full word load of a small constant with moveq is
> cheaper than doing a byte load with move.b.
>
> Tested on m68k-suse-linux and x86_64-suse-linux.  In both cases the size
> of cc1* becomes smaller with this change.
>
> Andreas.
>
> 	PR rtl-optimization/54555
> 	* postreload.c (move2add_use_add2_insn): Only substitute
> 	STRICT_LOW_PART if it is cheaper.
Sadly, Kazu didn't add a testcase for the H8/300 cases which inspired 
his change, so we don't know if your patch hurts the H8/300 port or not.

Let's do better this time ;-)  Add a testcase for the m68k port which 
verifies we're getting the desired code.  I don't care if you test the 
assembly code or test the RTL dumps, just that we have a test for the 
case where STRICT_LOW_PART is not a win.

With a testcase, this is approved.

Thanks,

jeff



More information about the Gcc-patches mailing list