[gst-devel] [gst-cvs] gstreamer: micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers

Tim-Philipp Müller t.i.m at zen.co.uk
Mon Dec 20 10:39:44 CET 2010


On Fri, 2010-12-03 at 14:17 -0500, David Schleef wrote:
 
> >   I saw gcc asm where it was doing an expensive compare as opposed to a
> > fast != 0. So yes, needed. Worth it ? Well I did title it "micro-optim".
> 
> What is an expensive compare?  cmp $0, %eax and test %eax, %eax are
> both one cycle.  It is somewhat amusing that gcc-4.5 generates
> different code for these, when it should know they are identical.
> gcc-4.4 doesn't, so I consider that a regression, but certainly not
> an important one.

Edward, in light of David's comments (and your own), can we revert this
please?

(At the very least I'd like to see the not-quite-right parts like the
refcount checks where refcount is a signed int reverted and where it
used to warn on refcount <= 0, but now only warns on refcount == 0)

Cheers
 -Tim






More information about the gstreamer-devel mailing list