This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC-generated code and i386 condition codes behavior



My question: does GCC-generated code ever actually depend on this aspect
of the x86 architecture - i.e., on instructions that architecturally
change some but not all condition codes _not_ changing those bits that
they're not supposed to change?

No.

An interesting anecdote from decades ago. When we were working on the Realia COBOL compiler, and distributing it for the PC, we got a mysterious message from IBM saying that they had a problem but could not tell us what it was unless we signed a NDA. We signed, and it turned out that the CMOS chip (from Harris?) 80C88 used in the ancient IBM convertible machine had a bug, CVD destroyed the carry flag, and Realia COBOL was the ONLY software that was affected. We made a change to the compiler, told no one (a requirement of the NDA), and everyone was happy :-) although the generated code was (and probably still is) less efficient :-)

I must say I am a bit surprised that gcc never takes advantage
of the fact that inc and dec do not destroy the carry flag, this
is quite significant for some loops.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]