Sender: root AT delorie DOT com Message-ID: <39046544.ADB90632@inti.gov.ar> Date: Mon, 24 Apr 2000 12:16:21 -0300 From: salvador Organization: INTI X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.38 i686) X-Accept-Language: es-AR, en, es MIME-Version: 1.0 To: Dieter Buerssner , djgpp AT delorie DOT com Subject: Re: [long] gcc performance and possible bug Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hi Dieter: > On 09 Mrz 2000, you wrote in comp.os.msdos.djgpp: > > >Send me a copy, I don't have it here. > > Salvador, my mail provider was not functioning for some days. > So this is a bit late. I append the article. > > Celeron and Pentinum Pro do not show the problem. Eli has > found a 1:3 performance hit with P166, I have found 1:10 > with AMD K6-2 266. I think, your suspect about an AMD bug > was correct :-( I found the problem, when you make the value a constant it is stored in the code segment, too close to the code that is executed. It looks like that's close enough to be inside the pipeline (probably because the CPU is fetching groups of aligned bytes, not just code). Looks like K6 does some pipeline flush when you read/write data that is inside the pipeline (or perhaps a pre-fetch buffer is a better name for it). If you put zseed inside the text segment and close to the function things gets even worst. I got 1:7 and 1:16 for the second case. But if you move both variables quite far (inside of the .text segment) you'll get the same times that when using the variables in .data. BTW: If you use const *and* compile it as C++ you'll get faster code because C++ allows the compiler to use consts as C uses #define macros if the compiler considers that's favorable. 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