From owner-cvs-sys Wed Sep 4 15:00:41 1996 Return-Path: owner-cvs-sys Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA04961 for cvs-sys-outgoing; Wed, 4 Sep 1996 15:00:41 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id PAA04954; Wed, 4 Sep 1996 15:00:35 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id HAA19084; Thu, 5 Sep 1996 07:51:28 +1000 Date: Thu, 5 Sep 1996 07:51:28 +1000 From: Bruce Evans Message-Id: <199609042151.HAA19084@godzilla.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 Sender: owner-cvs-sys@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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