i386/79091: [i386] [patch] Small optimization for i386/support.s

Bruce Evans brde at optusnet.com.au
Sat Jul 17 09:12:00 UTC 2010

On Fri, 16 Jul 2010, Andrey Simonenko wrote:

> On Wed, Jul 14, 2010 at 07:07:03AM +0000, remko at FreeBSD.org wrote:
>> Synopsis: [i386] [patch] Small optimization for i386/support.s

>> Hello, the code in question is using 'rcx' now instead of 'ecx'to restore
>> the registers. That might have solved your problem can you please have a look at that please and confirm whether it's still relevant?
> That PR was about optimization for suword() and similar functions for
> i386 and amd64 architectures.  %ecx is used for i386 and %rcx is used
> for amd64, but the idea is the same.  I do not understand why these
> lines are necessary for suword-like functions, all fuword-like functions
> do not reinitialize %ecx and %rcx registers after MOV instruction that
> potentially can generate some exception (eg. page fault).

Yes, parts of the patch still apply, and they now apply to amd64 too.

The I386C_CPU cases went away.

fusufault on i386 still needs to reload %ecx since it is now called
for faults from casuword* which does trash %ecx.  Perhaps casuword*
can use better register allocation to avoid trashing %ecx.  Call-used
registers are in short supply so this seems hard.  casuword* on amd64
already has better register allocation and doesn't trash %ecx, but it
has the same sillyness as the suword family -- it "restores" %ecx
without even a wrong comment that it is restoring a trashed register
(after not trashing the register).


More information about the freebsd-i386 mailing list