[PR/13274] Fold subregs that are produced by zero_extend

Bernardo Innocenti bernie@develer.com
Tue Jan 20 11:22:00 GMT 2004


Paolo Bonzini wrote:
> This bug is a pessimization in unsigned int * long long multiplication.  
> The upper half of the unsigned int need not be multiplied but gcc never 
> gets to see that it is zero.  The patch checks if the definition of a 
> narrowing subreg is the high part of a zero_extend, and folds it to 
> const0_rtx if so.

A similar problem affects 64/32 -> 64q+32r division, which gets promoted
to a full 64/64 -> 64q+64r operation.

For this reason, the Linux kernel resorts to an ugly and
unportable inline asm hack (see linux/include/asm/div64.h).

There has been a rather longish discussion on the LKML a few
months ago, where Linus expressed his... err... disappointment
for GCC's performance with 64bit operations:

  http://www.ussg.iu.edu/hypermail/linux/kernel/0307.0/0246.html
  http://www.ussg.iu.edu/hypermail/linux/kernel/0307.0/0247.html

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/




More information about the Gcc-patches mailing list