x86 code generation question
Robert Dewar
dewar@gnat.com
Fri Apr 30 13:50:00 GMT 2004
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.
More information about the Gcc
mailing list