Sender: root AT delorie DOT com Message-ID: <377CB4A1.BB72A3EA@inti.gov.ar> Date: Fri, 02 Jul 1999 09:46:25 -0300 From: salvador Organization: INTI X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: es-AR, en, es MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: .align directives in libc.a References: <377BB217 DOT 2FFBAEA8 AT inti DOT gov DOT ar> <377C5986 DOT 1B33420B AT taniwha DOT org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Bill Currie wrote: > salvador wrote: > > Can we tell Gas to use "int 3" (or other trap) when pading between functions? > > (and any other place where the code should never be executed). > > so long as it's only for text areas that are never meant to be > executed. You wouldn't want loop padding to do a debug trap. 'Twould > kinda slow things down:) Of course. > > > Intel manuals seem to recommend 16-byte alignment, both for code and > > > for data. > > > > And that's normally the best. MSVC uses 16 and 32 (based on some strange > > criteria). > > Isn't 32 bytes the size of a cache line on 486+? Yes, most processors uses 32, but that's also a waste if you routine is around 32 bytes and you pad it with 60 bytes ;-) (30+30). 32 bytes is too much and you start losing from other things. I don't know how MSVC determines when 32 bytes is good idea or not, perhaps is related to the size of the functions. BTW MSVC also exploits "proximity" by moving functions closer to the caller (mostly small static ones, that's usually better than inlining if the function have more than a couple of lines). > > But looks like the most sensitive stuff is the entry point of functions, not the > > align of loops or jumps. > > Nope, any destination: functions, loops and jumps are all equally > important. Not for K6 and not for Pentium MMX, I tried it. In fact MSVC do *not* align jumps or loops. In K6 processors it could be even worst (if a loop is in a xxxxxC memory address works slowly), in Pentium MMX de difference is very small. I think aligning jumps and loops is only good idea for big functions, small functions could need more cache lines if you add bytes inside. Currently I think MSVC have better ideas than gcc because generates faster code. Take a look to my compila.html page. I think Gas should have conditional aligment instructions, like: "align it if all the references are at 64 or more bytes of distance" SET -- Salvador Eduardo Tropea (SET). (Electronics Engineer) Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org set AT ieee DOT org set-soft AT bigfoot DOT com Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013