Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 1996 07:51:28 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, julian@freefall.freebsd.org
Subject:   Re: cvs commit:  src/sys/i386/boot/biosboot Makefile boot.c boot2.S
Message-ID:  <199609042151.HAA19084@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
I wrote:
>In the old generated code, howto is kept in a register and flags are
>ORed directly to memory.  This takes only 3 bytes per OR for flags
><= 0x80 (using an 8 bit constant).  It should take only 3 bytes for
    0xffu
>all (single) flags (using an 8 bit constant at an offset), but gcc
>generates poor code for this case (it generates a 32 but constant
>and 6 bytes per OR).  ...

The new code copies loadflags to a local varable, so the new generated
code is probably about as mediocre as the old generated code.  It can
be better iff the local variable can be allocated in %eax and most of
the constants are < 0x100u.  Then the ORing code can take 2 bytes:

	orb	$const,%al		// 2 bytes

For other registers it will be just as large as the indirect method:

	orb	$const,%dl		// 3 bytes
	orb	$const,0(%anyreg)	// 3 bytes

For large constants, best code is larger with a register than indirectly:

	orw	$bigconst,%ax		// 4 bytes (16 bit constant)
	orw	$bigconst,%dx		// 5 bytes (16 bit constant)
	orl	$bigconst,%eax		// 5 bytes (> 16-bit constant)
	orl	$bigconst,%edx		// 6 bytes (> 16-bit constant)
	orb	$bigconst>>8,1(%anyreg)	// 3 bytes
					// (0x100u <= bigconst < 0x10000u)

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609042151.HAA19084>