Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!mendell From: mendell@utcsrgv.UUCP (Mark Mendell) Newsgroups: net.wanted,net.micro.pc,net.micro Subject: Help needed with 8086 code [Re-posting] Message-ID: <3479@utcsrgv.UUCP> Date: Thu, 8-Mar-84 10:25:38 EST Article-I.D.: utcsrgv.3479 Posted: Thu Mar 8 10:25:38 1984 Date-Received: Thu, 8-Mar-84 11:23:46 EST Organization: CSRG, University of Toronto Lines: 47 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, division, and modulus (remainder)? 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