[unix-pc.general] cc -68010 option

dave@safari.UUCP (dave munroe) (01/28/88)

>someone awhile back said that the default cc compiles to the 68000 instruction
>set and that you need to specify -68010 to get that instruction set.

>However, i compiled a program both ways and the a.out was the same.

>So whats the story do i need to use -68010 ?????


The differences between the 68010 and 68000 are mainly in the areas of
systems programming:

	- support for virtual memory (by stacking the machine state during
	  a page fault and then continuing the instruction after the page
	  has been brought in)

	- support for a virtual machine concept by making MOVE to/from SR
	  privileged, plus MOVEC, MOVES, and MOVE from CCR.

	- additional registers for supervisor mode programming: the Vector
	  Base Register and alternate function code registers (SFC, DFC).

	- different exception handling (e.g. for bus [addressing] errors)

	- a two-word (4-byte) prefetch queue and a special "loop mode" of
	  operation.  Loop mode is transparent to the programmer and is
	  entered when certain common instructions are used with the DBcc
	  instruction, e.g. here

			loop:	move.w	(a0)+,(a1)+
				dbeq	d0,loop

	  the 68010 enters a loop mode.  Looping in this mode is efficient
	  since only operand fetches are performed until the exit condition
	  is met (opcode fetches are eliminated since the move.w is held
	  in the instruction decode register and the dbeq is held in the
	  prefetch queue).


So, for most programming situations, you are not likely to see any differences
by specifying cc -68010.  It would be nice if some compilers were smart enough
to optimize code so that the loop mode could be taken advantage of, but I
don't know of any that do.
						-dave

alex@umbc3.UMD.EDU (Alex S. Crain) (02/01/88)

In article <231@safari.UUCP> dave@safari.UUCP (dave munroe) writes:
>>someone awhile back said that the default cc compiles to the 68000 
>>instruction
>>set and that you need to specify -68010 to get that instruction set.
>>However, i compiled a program both ways and the a.out was the same.
>>So whats the story do i need to use -68010 ?????
>
>The differences between the 68010 and 68000 are mainly in the areas of
>systems programming:
	[diff -c 68000 68010 > /dev/null]

	A quick link of /bin/echo to /lib/ccom and /lib/optim (the peephole
optimizer) shows that if you specify -68000 or -68010, NOTHING HAPPENS!
the cc program simply eats the option and goes along its way. 

	Dave is correct in saying that the usable differences in the
instruction sets are small, basicly the dbxx and rtd instructions. The former
is a tight loop mode that requires significant reworking if the code structure
that must (must ?) be done BEFORE code generation, and therefore cannot be done
in a peephole optimizer. The second is an extended rts instruction that allows
faster returns from functions with a fixed # of arguments. Dave is also correct
is sating that /lib/ccom has never heard of these instructions. 

	SO, the answer to the first question (how to get 68010 code) is "you
can't" (partially true) or "get another compiler". There are compilers that 
know about tight loops and rtd, such as gcc, the Free Software Foundation 
compiler, which does a great deal of front end optimization (fix the code 
before we emit it). Unfortunatly, These compilers are either expensive, or in
the case of gcc, free but still under development.
-- 
					:alex.

nerwin!alex@umbc3.umd.edu
alex@umbc3.umd.edu

pjc@pcbox.UUCP (Paul J. Condie) (02/01/88)

In article <231@safari.UUCP> dave@safari.UUCP (dave munroe) writes:
>>someone awhile back said that the default cc compiles to the 68000 instruction
>>set and that you need to specify -68010 to get that instruction set.
>
>So, for most programming situations, you are not likely to see any differences
>by specifying cc -68010.  It would be nice if some compilers were smart enough
>to optimize code so that the loop mode could be taken advantage of, but I
>don't know of any that do.


that's nice but my question was does cc default to 68000 or 68010?