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: x86 code generation question


Bernd Jendrissek wrote:

	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.

I certainly agree that superopt is nice, but this fundamental use of sbb is not exactly in the category of beyond-humanly clever :-)

In fact the Realia COBOL generates this all over the place to
avoid jumps (e.g. you can easily do a max or min with this
trick without jumps), and indeed I regard this idiom with
sbb to be in the standard aresenal of asm coding on this
machine.



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