On 04/30/2010 03:13 AM, Andrew Pinski wrote: > On Thu, Apr 29, 2010 at 5:32 PM, Bernd Schmidt wrote: >> The idea is to represent the sign-extension in the RTL call patterns, >> choosing extending variants in calls.c when we notice a suitable >> promotion. Then we let combine do its work; this needed another little >> tweak to make sure it recorded the extension of the return register. > > On PowerPC (and MIPS even with 4.3.3), this is already optimized > without a sign extend. > > (call_insn 5 4 6 3 t.c:4 (parallel [ > (set (reg:SI 3 3) > (call (mem:SI (symbol_ref:SI ("shortv2") [flags 0x41] > ) [0 S4 A8]) > (const_int 0 [0x0]))) > (use (const_int 0 [0x0])) > (clobber (reg:SI 65 lr)) > ]) -1 (nil) > (nil)) > > (insn 6 5 7 3 t.c:4 (set (reg:SI 121) > (reg:SI 3 3)) -1 (nil)) > > (insn 7 6 8 3 t.c:4 (set (reg:SI 119 [ D.2012+-2 ]) > (reg:SI 121)) -1 (nil)) > > (insn 8 7 9 3 t.c:4 (set (reg:SI 120 [+-2 ]) > (reg:SI 119 [ D.2012+-2 ])) -1 (nil)) > > --- CUT --- > > Maybe I am missing something but the arm RTL should look something > similar without a sign extension. I suspect that's due to a different definition of promote_prototypes and other hooks. However, I agree with Andrew that all the information should already be there (through the promote_function_mode hook), it's just that combine isn't trying hard enough. Maybe something based on the attached patch? Paolo