Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #21691
| Date | 2013-04-16 12:46 -1000 |
|---|---|
| From | "Elizabeth D. Rather" <erather@forth.com> |
| Organization | FORTH, Inc. |
| Newsgroups | comp.lang.forth |
| Subject | Re: Portability |
| References | (9 earlier) <65f39492-54f0-463a-87fa-a77ddd58a693@e5g2000yqa.googlegroups.com> <2013Apr16.145300@mips.complang.tuwien.ac.at> <kkkfop$95r$1@dont-email.me> <TNGdncRZhpHfW_DMnZ2dnUVZ_sudnZ2d@supernews.com> <kkkhj9$nsd$1@dont-email.me> |
| Message-ID | <SdednbtkmbpTSfDMnZ2dnUVZ_t6dnZ2d@supernews.com> (permalink) |
On 4/16/13 12:00 PM, rickman wrote: > On 4/16/2013 5:44 PM, Elizabeth D. Rather wrote: >> On 4/16/13 11:29 AM, rickman wrote: >>> On 4/16/2013 8:53 AM, Anton Ertl wrote: >>>> Sieur de Bienville<morrimichael@gmail.com> writes: >>>>> I don't remember how the 68k CMP instruction works, but the IA-32 and >>>>> the AMD64 CMP instruction is a nondestructive version of the SUB >>>>> instruction. So on a PC it is in fact done by subtracting. >>>> >>>> CMP sets the flags, and the flags contain enough information to >>>> complete the comparison. E.g., if you do JL/SETL (L for less), you >>>> get a signed comparison and if you do JB/SETB (B for below), you get >>>> an unsigned comparison. You can even get a circular comparison with >>>> JS/SETS (S for sign). >>>> >>>> I guess you could use SUB instead of CMP, and it would still work; the >>>> point is that, indeed, the number result of a modulo subtraction does >>>> not contain enough information for a proper signed or unsigned >>>> comparison; the flags result of a CMP instruction does have that >>>> information. >>> >>> So, if I am understanding this correctly, there is no lower level Forth >>> primitives that can be used to implement an efficient < word. It >>> depends on coding this in the instruction set of the CPU used? In fact, >>> it *requires* the CPU to offer an overflow detection, right? >> >> I can't really imagine < not being a primitive, just as I can't imagine >> + not being one. >> >> Cheers, >> Elizabeth >> > > I don't follow the "comparison" at all (if I can risk a pun). I believe > several times in this thread the < word has been given as a Forth > definition. Whether it is implemented as a primitive or not is an > implementation issue. Whether it *must* be implemented as a primitive > says something about what the hardware requirements are for Forth. > > Interesting that I've never seen anything indicating just what the > hardware requirements for Forth are. In general Forth avoids the use of > flags, rather the only test is to compare the top of stack with zero. So > to require an overflow detection, which is pretty awkward to do without > a flag, is interesting to say the least. I was going to delete the > overflow detection from my CPU design, I guess I'll hold off on that. > You're right, it's an implementation issue. Still, from the POV of an implementer, I can't imagine adding the overhead of a call to what should be a very few instructions. Andrew correctly notes that Novix did it in high level, but calls were essentially free on that chip. It's a special case. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Portability kenney@cix.compulink.co.uk - 2013-04-06 04:12 -0500
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-06 11:31 +0000
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-06 10:34 -1000
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-09 09:56 +1000
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-09 01:30 +0000
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-09 07:21 +0000
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-08 22:18 -1000
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-09 12:41 +0000
Re: Portability Coos Haak <chforth@hccnet.nl> - 2013-04-09 17:21 +0200
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-09 08:06 -1000
Re: Portability Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-09 22:34 +0200
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-09 12:05 -1000
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-09 14:19 -1000
Re: Portability Chris <xrissmith@me.com> - 2013-04-09 20:45 -0700
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-10 14:02 +1000
Re: Portability Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-09 23:00 -0700
Re: Portability "WJ" <w_a_x_man@yahoo.com> - 2013-04-12 14:41 +0000
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-13 15:34 +1000
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-10 15:19 +0000
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-10 11:46 +0000
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-10 15:03 +0000
Re: Portability Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-09 18:28 -0700
Re: Portability Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-09 17:00 -0700
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-10 13:00 +1000
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-10 11:55 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-10 10:10 -0500
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-10 15:56 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-10 16:18 -0500
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-11 13:24 +0000
Re: Portability Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-11 20:50 -0700
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-12 04:17 -0500
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-12 13:43 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-12 11:08 -0500
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-12 18:50 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-13 03:57 -0500
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-13 11:59 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-13 14:47 -0500
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-12 10:44 -0400
Re: Portability Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-15 16:20 +0200
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-16 08:12 -1000
Re: Portability "A.K." <akk@nospam.org> - 2013-04-16 22:21 +0200
Re: Portability Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-16 22:33 +0200
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-19 15:04 +1000
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-15 15:46 +0000
Re: Portability Sieur de Bienville <morrimichael@gmail.com> - 2013-04-15 19:19 -0700
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-16 12:53 +0000
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-16 17:29 -0400
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-16 11:44 -1000
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-16 18:00 -0400
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-16 17:33 -0500
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-16 12:46 -1000
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 13:09 -0400
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-17 12:20 -0500
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-17 07:38 -1000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-17 16:43 -0500
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 20:03 -0400
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-18 16:53 -0500
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-18 18:02 -0400
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-19 03:30 -0500
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-19 15:31 -0400
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-22 09:59 +0000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-22 07:28 -0500
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-22 15:27 +0000
Re: Portability Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-22 18:16 -0700
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-17 10:23 +0000
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 13:46 -0400
Re: Portability anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-04-22 09:47 +0000
Re: Portability Brad Eckert <hwfwguy@gmail.com> - 2013-04-17 10:32 -0700
Re: Portability nobody@nowhere - 2013-04-17 17:36 +0000
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 14:21 -0400
Re: Portability Brad Eckert <hwfwguy@gmail.com> - 2013-04-17 15:03 -0700
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 18:22 -0400
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-17 18:24 -0400
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-18 00:51 -0400
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-18 17:19 -0400
Re: Portability Brad Eckert <hwfwguy@gmail.com> - 2013-04-19 12:37 -0700
Re: Portability rickman <gnuarm@gmail.com> - 2013-04-19 15:53 -0400
Re: Portability Lars Brinkhoff <lars.spam@nocrew.org> - 2013-04-17 19:26 +0200
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-10 18:50 +0000
Re: Portability Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-10 22:14 +0200
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-12 04:18 -0500
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-12 08:30 -1000
Re: Portability albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-04-12 18:58 +0000
Re: Portability "Elizabeth D. Rather" <erather@forth.com> - 2013-04-12 11:29 -1000
Re: Portability "Ed" <invalid@nospam.com> - 2013-04-13 14:57 +1000
Re: Portability Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-04-09 04:11 -0500
csiph-web