This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Multiplications on Pentium 4

On Fri, Sep 07, 2001 at 08:04:03PM +0200, Frank Klemm wrote:
> The Pentim 4 is so different from all other CPUs so I must write a special
> Code Choice Generator. Some Examples:
> 	imul:		14 Clocks Latency
> 	shl:		 4 Clocks Latency
> 	lea (,,1)	 0.5 Clocks  Latency
> 	lea (,,2)	 4 Clocks  Latency
> 	lea (,,4)	 4 Clocks  Latency
> 	lea (,,8)	 4 Clocks  Latency
> 	add, sub, neg:	 0.5 Clocks Latency
> 	mov		 0...0.5 Clocks Latency
> This generates fully different Code compared with i386...Pentium-III,
> K5...Athlon.

As a historical trivia, I believe a similar situation occurred with with the
486, which had a huge penalty for imul (according to the gcc sources, 15 clocks
+ 1 clock for every bit set).  I recall that in some cases replacing a divide
of a constant by a 32x32->64 bit multiply of a large constant, actually took
more cycles to do it as a multiple than a divide.

Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:		phone: +1 978-486-9304
Non-work:	fax:   +1 978-692-4482

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]