From: djaggar@armltd.uucp (Dave Jaggar)
Newsgroups: comp.sys.acorn
Subject: Porting to a 32 bit ARM (Was: Oh no .....)
Date: 5 Oct 92 10:40:09 GMT
Organization: Advanced RISC Machines Ltd

kortink@cs.utwente.nl (John Kortink) writes:
>Gavin.Flower@comp.vuw.ac.nz (Gavin Flower) writes :
>>if restricted to ARM and Risc-OS.  Once a compiler is available that
>>has support for the new processor built in, *all* programs written in
>>that language, can be recompiled to make use of its architectural
>>innovations (where relevant).  However, every single assembler program
>>would have to have varying degrees of work required - just look at
>>what is involved in going to make use of the 32 bit mode, in the
>>ARM6xy!!

>Well, tell us all. These major changes and things-to-be-made-use-of in
>the new processors. My guess is that most improvements are speed-wise,
>i.e. not requiring any code-level changes at all. Moving from a 26-bit
>model to 32-bit would not entail any effort at all for rewriting ARM
>code sources. New instructions ? Why use them unless for even further
>optimization of an already mega-fast application ?

A few facts:

1) Moving a program from the 26 bit model to the 32 bit model will
require re-writing if that program relies on any one of several things
	a) TEQP, TSTP doing useful things
	b) condition code flags preserved across BL
	c) flags and mode in reg 15/ reg 14
	d) all state saved by saving registers 0-15
	e) others more specific things
	
(a) is fairly easy to find with an editor, and replace by hand.  (b)
looks easy, but watch out for MOV lr,pc ; LDR pc .....  (c) is a pain to
find (people test the C flag with all manner of machinery) (d) is hard
but usually only found in low level code (e) I haven't seen all ARM
assembly ever written :-)
	
2) Moving low level code (i.e trap handlers/swi handlers) is not a
trivial task, as they must do at least all the things in (1)

3) None of this to be confused with running 26 bit code on an
ARM6/60/6x0, which needs to be done once for all apps i.e. the OS
switches processor mode to runs 26 bit mode apps (more or less)
	
4) The ARM6/6x/6x0 compiler was available well before real silicon was.

5) The ARM7/7x/7x0 compiler was/will be available before real silicon
was/is (sorry, no hints about ARM7xy availability).

6) In the forseeable future, new flag-ship processors will, in general,
run existing code faster than old processors do (what else do you expect)

>What other platforms ? What major native Archimedes program would ever need
>to be ported to a PC or Amiga ? The portability of C is not at all relevant
>to native programs, it's only relevant to big lumpy chunks of straight in
>straight out code.

Well how about the ARM C compiler itself ? Hosted on RISCOS, Sun, PC,
Mac (get the RISCOS one from Acorn, get the rest from VLSI or GEC
Plessey). The front end of course runs on many other hosts. Not to
mention our assembler, linker, debugger, simulators, design tools etc.

>John Kortink

Code in whatever language turns you on/is required/your boss codes in. 
(My boss codes in C, only French turns me on, and neither is required :-)

Follow-ups to c.s.a.tech

Dave
--------------------------------------------------------------------------
Dave Jaggar					Advanced RISC Machines Ltd
djaggar@armltd.co.uk				Swaffham Bulbeck
Phone: +44 223 813 000 Ext 210			Cambridge CB5 0NA
Fax: +44 223 812 800				England
--------------------------------------------------------------------------