wozniak@utkux1.utk.edu (Bryon Lape) (10/21/89)
Excuse me for being a little sarcastic here, but is not the following true? For a 32bit integer (as someone writes about) use long int x; the variable x will then be 4bytes = 4bytes * 8bits/byte =32bits Someone asked about a C compiler that supported 32bit ints of 386 machine. They answer as I see it is yes, they all do. -bryon-
kevin@kosman.UUCP (Kevin O'Gorman) (10/21/89)
In article <1224@utkcs2.cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes: > > [ sarcasm and arithmetic deleted ] > >Someone asked about a C compiler that supported 32bit ints of 386 >machine. They answer as I see it is yes, they all do. I think you're missing an important distinction. It may be true that all compilers support *long* ints of that size, but not all of them use 32 bits for plain ints. K&R does not require this, after all. It may be that all compilers use 32 bits for ints, but I don't know and I don't try to keep all compilers running here.
madd@world.std.com (jim frost) (10/22/89)
In article <1224@utkcs2.cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes: |Someone asked about a C compiler that supported 32bit ints of 386 |machine. They answer as I see it is yes, they all do. I rather expect they meant "using the 386-specific 32-bit instructions." Very few non-UNIX compilers do this; certainly Turbo C and MSC do not. I've run across at least one MS-DOS compiler that would generate 386-specific code, but I've forgotten which. jim frost software tool & die madd@std.com
mcdonald@uxe.cso.uiuc.edu (10/23/89)
>I've run across at least one MS-DOS compiler that >would generate 386-specific code, but I've forgotten which. There are at LEAST two :Metaware and MicroWay, and probably also a third, Lahey. Doug MCDonald
davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (10/23/89)
In article <1224@utkcs2.cs.utk.edu>, wozniak@utkux1.utk.edu (Bryon Lape) writes: | | Excuse me for being a little sarcastic here, but is not the | following true? | | For a 32bit integer (as someone writes about) use | | long int x; The poster didn't ask about 32 bit longs, he asked about 32 bit ints. There is a book called _The C Programming Language_ which will explain the diference. Intel has several manuals which explain the diference in the way 32 bit ints work, as opposed to longs on a 286 compiler which are implemented as two 16 bit ints and about 300% overhead. To sum it up in beginners language: 286 compilers don't use 32 bit arithmetic for anything, they fake it with 16 bit arithmetic and run a lot slower. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon
afscian@violet.waterloo.edu (Anthony Scian) (10/23/89)
In article <110200021@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >>I've run across at least one MS-DOS compiler that >>would generate 386-specific code, but I've forgotten which. >There are at LEAST two :Metaware and MicroWay, and probably >also a third, Lahey. There is also WATCOM C7.0/386. Anthony //// Anthony Scian afscian@violet.uwaterloo.ca afscian@violet.waterloo.edu //// "I can't believe the news today, I can't close my eyes and make it go away" -U2
zech@leadsv.UUCP (Bill Zech) (10/24/89)
In article <1989Oct22.163723.2872@world.std.com>, madd@world.std.com (jim frost) writes: > In article <1224@utkcs2.cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes: > |Someone asked about a C compiler that supported 32bit ints of 386 > |machine. They answer as I see it is yes, they all do. > > I rather expect they meant "using the 386-specific 32-bit > instructions." Very few non-UNIX compilers do this; certainly Turbo C > and MSC do not. I've run across at least one MS-DOS compiler that > would generate 386-specific code, but I've forgotten which. > MetaWare of Santa Cruz, CA makes a C compiler called High C which will compile native 386 code. You will need a DOS extender to run it, though. Alternately, you could write some of your code in ASM and turn on the .386 switch on the assembly. Interestingly enough, the 386 will execute 80386 specific 32-bit opcodes even in real mode. So you can run programs written this way under normal DOS. The High C compiler assumes a protected mode environment with DS=ES=CS=SS, e.g., a flat address space. -Bill
davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (10/24/89)
I think a lot of people are missing the point of the whole question. On a 386 32 bit arithmetic is a LOT faster. You don't need protected mode or anything fancy, just use the 32 bit instructions. Here's an example program: #include <stdio.h> main() { long ary[2000], x = 4, y = 7; int ix, iy; for (ix = 0; ix < 2000; ix++) ary[ix] = ix+1200; for (iy = 4000; iy--; ) { for (ix = 0; ix < 2000; ix++) { ary[ix] = (ary[ix] + y) * x / y; } } } and the results. It was compiled using 386 and 286 instructions. 386 runtime: 36.50 sec 286 runtime: 121.66 sec Both times were on the same 25MHz machine, just using one set of instructions or the other. This is why I tell people not to buy a 286 any more, over the next few years there will be a lot of programs taking advantage of this 4:1 performance gain. I believe that the ZIP compressor does now. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon
madd@world.std.com (jim frost) (10/25/89)
In article <1415@crdos1.crd.ge.COM> davidsen@crdos1.UUCP (bill davidsen) writes: |On a 386 32 bit arithmetic is a LOT faster. You don't need protected | 386 runtime: 36.50 sec | 286 runtime: 121.66 sec |Both times were on the same 25MHz machine, just using one set of |instructions or the other. Hmm. Just about exactly what the theoretical difference should have been :-) jim frost madd@std.com
cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) (10/29/89)
In article <1224@utkcs2.cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes:
$ Excuse me for being a little sarcastic here, but is not the
$following true?
$ For a 32bit integer (as someone writes about) use
$ long int x;
$ the variable x will then be 4bytes = 4bytes * 8bits/byte =32bits
Yes, and just saying long x; will have the same effect.
But ...
$Someone asked about a C compiler that supported 32bit ints of 386
$machine. They answer as I see it is yes, they all do.
Yes, but I'm sure this person wants to harness at least some of the
32-bit power of the 386. If you take Turbo C 2.0, for example, and
try to do math with long ints, it will generate code for the 16-bit
8088/8086/80188/80186/80286 machines, depending on how you set the
processor type switch. Sure, it will get the job done, but if the
target machine(s) has/have 386s in them, you'd want to use the full
32 bit capabilities of the 386 and have the compiler generate code
to move these integers 32 bits at a time and perform math on them
32 bits at a time, rather than building it out of 16-bit operations.
A good analogy is the use of an 8087/80187/80287/80387 to do your
floating point math. Sure, you can do floating point math on a
machine equipped with one of the above chips by telling the compiler to
generate emulator code; however, since you have the hardware to do it
properly, why not?
--
Stephen M. Dunn cs4g6ag@maccs.dcss.mcmaster.ca
<std_disclaimer.h> = "\nI'm only an undergraduate!!!\n";
**************************************************************************
... but I'm too full to swallow my pride ...
CUMMINGS@S55.Prime.COM (11/16/89)
wozniak@utkux1.utk.edu wrote: > Excuse me for being a little sarcastic here, but is not the >following true? > > For a 32bit integer (as someone writes about) use > > long int x; > > the variable x will then be 4bytes = 4bytes * 8bits/byte =32bits > > >Someone asked about a C compiler that supported 32bit ints of 386 >machine. They answer as I see it is yes, they all do. > > >-bryon- Excuse me for being realistic, but what was being asked was is there a C compiler that will use the 386 32 bit registers to manipulte 32 bit data instead of doing it with multiple instructions using the 8088/80286 16 bit registers! Microsoft C allows you to select code for the 286 via the /G2 command line option, but /G3 does not (yet?) generate 386 instructions (at least as of 5.1). ============================================================================ Kevin J. Cummings Prime Computer Inc. 20 Briarwood Road 500 Old Connecticut Path Framingham, Mass. Framingham, Mass. InterNet: CUMMINGS@S55.Prime.COM CSNet: CUMMINGS%S55.Prime.COM@RELAY.CS.NET UUCP: {uunet, csnet-relay}!S55.Prime.COM!CUMMINGS Std. Disclaimer: "Mr. McKittrick, after careful consideration, I've come to the conclusion that your new defense system SUCKS..." ============================================================================