Sender: nate AT cartsys DOT com Message-ID: <35C355CA.40E48B1@cartsys.com> Date: Sat, 01 Aug 1998 10:52:10 -0700 From: Nate Eldredge MIME-Version: 1.0 To: "Salvador Eduardo Tropea (SET)" CC: lubaldo AT adinet DOT com DOT uy, djgpp AT delorie DOT com Subject: Re: -m and -march= switches and a 5x86... References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Salvador Eduardo Tropea (SET) wrote: > > lubaldo AT adinet DOT com DOT uy wrote: > > > I have GCC 2.8.1 installed. > > I have tryed the -m386, -m486, -mpentium and -mpentiumpro switches and > > they generate the exact same code... why is that? > > I tried -mpentiumpro and the code miserably(?) died with SIGILL because gcc > used the conditional assigment instruction (P6 core only). > Are you sure the assembler generated doesn't have even 1 line of difference? > What are you compiling? > > > I have tryed the -march=586 switch. It produces Pentium code that it is > > not compatible with earlyer CPU's, like 486, 386... but it works on my > > machine! > > Who said GCC produces code that doesn't run in 486 when you use 586? Is in > the manuals? I think gcc only changes the instruction order and aligment. > What P5 instruction is used? `-mcpu=CPU TYPE' Assume the defaults for the machine type CPU TYPE when scheduling instructions. The choices for CPU TYPE are: `i386', `i486', `i586' (`pentium'), `pentium', `i686' (`pentiumpro') and `pentiumpro'. While picking a specific CPU TYPE will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the i386 without the `-march=CPU TYPE' option being used. `-march=CPU TYPE' Generate instructions for the machine type CPU TYPE. The choices for CPU TYPE are: `i386', `i486', `pentium', and `pentiumpro'. Specifying `-march=CPU TYPE' implies `-mcpu=CPU TYPE'. So `-mcpu' changes ordering, alignment, etc; while `-march' changes the actual instructions used. > > I have an AMD 5x86 processor, to my knowledge, this is a 486DX > > compatible processor but it is not meant to be Pentium compatible... > > True. I haven't looked at a manual or opcode ref lately, but I can't think of anything at the application level a Pentium can do that a 486 can't (with the possible exception of the probably-useless CMPXCHG8B instruction). > > I have tryed also the -march=686 and that it doesn't work and thats > > Ok... And the code produced by GCC with the -march=586 directive is > > different from the one produced with the -march=486 directive... so: I > > don't understand why it works... someone knows something? > > I think is just reordered to exploit the P5 pipes, that's all. I suspect you are right. As a further red herring, note that `-march=686' has some bugs which can make it generate code that won't work even on a real PPro. (Apparently it doesn't handle the FICOMP instructions correctly.) -- Nate Eldredge nate AT cartsys DOT com