When compiling any C code with GCC 3.2 (and all other versions) Configure finds out that the VIA C3 processor is a i686 processor. That’s ok, but the VIA C3 processor doesn’t have the CMOV instruction. When GCC generates code for the i686 processor it includes the use of the CMOV instruction and therefore the code will result in an "illegal instruction" error when executed on a VIA C3 processor. The VIA C3 is indeed a 'model 6' processor. The Pentium Pro manual states that this cmov (conditional move) instruction is optional and you are supposed to check for its present before using it. This means that GCC should check for this before generation code including this instruction. If CMOV is not present, the code should be generated without using this instruction. Release: GCC 3.2 (and all earlier versions) Environment: Linux kernel 2.4.19 VIA C3 processor GCC Version 3.2 How-To-Repeat: Use GCC to compile any program (ex XFREE 4.2) on a Linux PC with compiler option "-march=i686 -mcpu=i686". Then run the compiled program an see the "illegal instruction" error.
Fix: Use GCC with "-march=i586 -mcpu=i586" but then the code is not optimal for the processor.
State-Changed-From-To: open->closed State-Changed-Why: Defined as "not a bug". When we say i686, we really do mean "pentiumpro". Checking for cmov is a waste of time; it'd be faster to not use it than to check. Use -march=i586 instead.
From: Pete Gontier <kokorozashi@gontier.org> To: <gcc-gnats@gcc.gnu.org>, <forsmark@odense.kollegienet.dk <gcc-bugs@gcc.gnu.org <nobody@gcc.gnu.org <gcc-prs@gcc.gnu.orgCc: Subject: Re: target/8243: GCC 3.2 does not check for CMOV instruction before generating code Date: Thu, 13 Feb 2003 11:54:39 -0800 I don't think I fully understand the closure of this bug. I understand if by i686 you really mean Pentium Pro. (I hope that's documented.) The claim that it would be dumb for GCC to generate code which checks for CMOV before using it also makes sense. However, if there were a way to tell GCC not to generate CMOV instructions in the first place, that would seem reasonable, too, assuming there are other i686 optimizations worth doing.
From: Pete Gontier <kokorozashi@gontier.org> To: <gcc-gnats@gcc.gnu.org>, <forsmark@odense.kollegienet.dk <gcc-bugs@gcc.gnu.org <nobody@gcc.gnu.org <gcc-prs@gcc.gnu.orgCc: Subject: Re: target/8243: GCC 3.2 does not check for CMOV instruction before generating code Date: Thu, 13 Feb 2003 12:34:28 -0800 circa 2/13/03 11:54 AM, Pete Gontier <kokorozashi@gontier.org> wrote: > I don't think I fully understand the closure of this bug. I understand if by > i686 you really mean Pentium Pro. (I hope that's documented.) The claim that > it would be dumb for GCC to generate code which checks for CMOV before using > it also makes sense. However, if there were a way to tell GCC not to generate > CMOV instructions in the first place, that would seem reasonable, too, > assuming there are other i686 optimizations worth doing. Hmmm. Perhaps this is already present in the form of -march=c3. And from what I hear, CMOV was the only significant optimization for i686. If this is all true, then feel free to ignore my previous message. (Well, OK, I would still appreciate an off-list note.) -- Pete Gontier <http://www.pete.gontier.org/>
(In reply to comment #4) > From: Pete Gontier <kokorozashi@gontier.org> > To: <gcc-gnats@gcc.gnu.org>, > <forsmark@odense.kollegienet.dk <gcc-bugs@gcc.gnu.org <nobody@gcc.gnu.org <gcc-prs@gcc.gnu.orgCc: > Subject: Re: target/8243: GCC 3.2 does not check for CMOV instruction > before generating code > Date: Thu, 13 Feb 2003 12:34:28 -0800 > > circa 2/13/03 11:54 AM, Pete Gontier <kokorozashi@gontier.org> wrote: > > > I don't think I fully understand the closure of this bug. I understand if by > > i686 you really mean Pentium Pro. (I hope that's documented.) The claim that > > it would be dumb for GCC to generate code which checks for CMOV before using > > it also makes sense. However, if there were a way to tell GCC not to generate > > CMOV instructions in the first place, that would seem reasonable, too, > > assuming there are other i686 optimizations worth doing. > > Hmmm. Perhaps this is already present in the form of -march=c3. And from > what I hear, CMOV was the only significant optimization for i686. This patch indicates that there -march=c3 is not the solution: http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02718.html There is another (german) report on patching gcc to create optimized code for the c3 http://epia.std-err.de/gcc.php Michael