[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem with VIA C3 chip and libcrypto

On Sat, Nov 02, 2002 at 12:06:22AM +0100, David Goodenough wrote:
> > So if the VIA C3 chip does not support the cmov instruction, the chip does
> > IMHO not implement the i686 instruction set, and should be treated as i586.
OK, I stand corrected...

> According to Alan Cox this is actually a gcc bug.  cmov is apparently an
> optional 686 instruction,
...because this is correct. Conditional moves are optional instructions,
just like MMX, 3D now!, SSE, fxsr, syscall or sysenter. So it is true that
gcc should *not* generate them for i686. On the other hand, using cmov
instructions could definitely improve performance in some applications
because they avoid mispredicted jumps. I don't know whether openssl can
take profit of these instructions, but It seems likely. Is there any way to
select libraries based on 'instruction set' instead of architecture, so
the VIA C3 could get code 'without cmov', the PII 'with cmov and MMX',
the PIII 'with cmov, MMX and SSE' and an Athlon processor 'with cmov, MMX
and 3D now!', although they all are 'family: 6'.

This does *not* mean we should provide ssl libraries for all those different
processor subtypes, but it could be a good thing to provide for those
extensions, that result in a performance gain of more than 10%.

> and the problem would go away.  I am not sure which level of gcc fixes
> the problem, I hope this does not require 3.2 as that opens a whole can
> of worms (which I know are being digested as I type).

Looking at the info pages of gcc 3.2 I don't see any option for enabling
or disabling the use of cmov, and strings on /usr/lib/gcc-lib/3.2.1/cc1
does not reveal any one either. So I fear, even gcc 3.2 still uses cmov.
I will test it.

> David

Reply to: