[net.wanted] Help Needed with 8086 code

mendell@utcsrgv.UUCP (Mark Mendell) (02/29/84)

    I am currently writing the 8086 code generator for Concurrent Euclid,
and I have been having trouble coming up with code sequences for long
(32-bit signed) comparisons.  The structure of the ConEuc compiler makes it
necessary to come up with a code sequence that compares 2 LongInts, and sets
the condition code properly, based on the comparison.  For example, I need a
code sequence that does the same as the following, but for 32-bit quantities.
	cmp   x,y
	bCC   label

    For 32-bit compares, the compiler cannot use the method that the portable
C compiler uses (we have a version of an 8086 compiler here).  What is needed
is a sequence of compares that will produce ONE place where a branch
instruction can be used.  This is necessary because the ConEuc compiler may
want to "reverse the sense" of the branch at any time.  If there is more than
branch that must be reversed, it will be too late because some code will
already have been emitted.

    Here is an example that works for = and not= in ConEuc:

	cmp	x.low,y.low
	bne	L
	cmp	x.high,y,high
    L:	bCC	label

    This code works because CC in this case will be either equal or not equal,
and the code will work for either condition.  The problem is to come up with
solutions that will work for:

    greater equal & less than			(reverse conditions)
    less equal & greater than			(reverse conditions)


    Alternate solutions to the problem:  Subtract y from x, and test the
result to 0, i.e. produce a condition code that represents a 32-bit quantity
>, <, or = to zero.


    While I am asking for help, does anyone have routines that will do 
32-bit (signed) multiplication and division, and 16-bit (unsigned) modulus?

    Please mail back any replies.  Thanks in advance for your help.
-- 
Mark Mendell
	    Computer Systems Research Group    University of Toronto
	    Usenet:	{linus, ihnp4, allegra, decvax, floyd}!utcsrgv!perelgut
	    CSNET:	mendell@Toronto
	    ARPA:	mendell%Toronto@CSNet-Relay