On Tue, Jan 14, 2020 at 08:44:29AM -0700, Ian Lepore wrote:
> On Tue, 2020-01-14 at 08:22 +0000, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Tue Jan 14 08:22:28 2020
> > New Revision: 356725
> > URL: https://svnweb.freebsd.org/changeset/base/356725
> > 
> > Log:
> >   When system calls indicate an error they return -1, not some
> > arbitrary
> >   value < 0.  errno is only updated in this case.
> >   
> 
> What's the point of these changes, other than almost certainly leading
> to worse code generation?
> 
> In most instruction sets, you can test for a value < 0 without using
> any instructions, you only need to examine the condition flags after
> loading the value.  To compare equal to -1 typically requires at least
> 1 extra instruction, and on risc architectures typically at least two
> extra (load -1 to a register then compare).
> 
our diff has forked from the OpenBSD one. The goal of those patches is to keep
in sync code that is still close to the original OpenBSD one as much as
possible.

Best regards,
Bapt

Attachment: signature.asc
Description: PGP signature

Reply via email to