http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60496
Bug ID: 60496 Summary: ffreep instruction shouldn't be generated when using i386 instruction set Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: mikulas at artax dot karlin.mff.cuni.cz Host: x86_64-linux-gnux32 Target: x86_64-linux-gnux32 Build: x86_64-linux-gnux32 The ffreep instruction isn't supported on all i386-class processors - it is not supported on the NexGen processor - see this http://www.pagetable.com/?p=16 Consequently - when generating code with -march=i386, ffreep shouldn't be generated. ffreep should only be generated when generating for i486 or better instruction set. This small piece of code shows incorrect ffreep generation when using i386 instruction set and when optimizing for AMD Athlon. Compile this function with "-m32 -O2 -march=i386 -mtune=athlon" double f(double a, double b) { double c = a + b; return c != 1 ? c : 0; } The resulting assembler: f: .LFB0: .cfi_startproc fldl 12(%esp) faddl 4(%esp) fld1 fxch %st(1) fucom %st(1) fnstsw %ax fstp %st(1) andb $69, %ah xorb $64, %ah je .L5 rep ret .p2align 4,,7 .p2align 3 .L5: ffreep %st(0) fldz ret .cfi_endproc .LFE0: .size f, .-f