x86 code generation question

Bernd Jendrissek berndj@prism.co.za
Fri Apr 30 12:33:00 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Apr 29, 2004 at 05:03:19PM -0400, Paul Koning wrote:
> That isn't straight line code.  The reason is that the x86 doesn't
> have instructions that turn comparisons into the integers 0 and 1.  So

Oh but it does!  And it doesn't even need anything beyond bog-standard
8086 code.

	cmp ax,bx
	sbb dx,dx
	; dx is now 0 if ax >= bx, -1 if ax < bx
	neg dx

Have you used superopt?  It finds some pretty surprising sequences to do
some nifty stuff.  AFAIK some of GCC's sequences are inspired by
superopt, which, in fact, (and again, IIRC) was written precisely to
find such beyond-humanly clever sequences for GCC.

- -- 
http://voyager.abite.co.za/~berndj/ (up again for now - yay!)
bernd's stupid blog: http://voyager.abite.co.za/~berndj/blog.php
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAkfNU/FmLrNfLpjMRAuE6AJoD/+tL6TYkcxmzYHT9nzZQiFrRfQCfXAH5
4dd5yda+xICXHdXmPpXJs7U=
=TifR
-----END PGP SIGNATURE-----



More information about the Gcc mailing list