public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* H8300H Tiny
@ 2002-08-10 12:09 Torbjörn Lindh
  2002-08-12 15:12 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Torbjörn Lindh @ 2002-08-10 12:09 UTC (permalink / raw)
  To: gcc

Hitachi have generated a number of so called Tiny H8:s, for instance the 
H8/3664F. These have an h8300h cpu but are limited to a 64k address 
space.

The problem with gcc-3.1 (and as far as I can see, the current cvs version
too) is that if I use h8300 mode, I don't take advantage of the added
instructions, adressing modes etc of the h8300h cpu. But if I use the
h8300h mode the addressing gets far to long: 

	subs	#0x4,er7
	mov.l	er7,@-er7

should really be

	subs	#0x4,er7
	mov.w	r7,@er7

and a piece of code such as:

unsigned char a[5];

void f(void)
{
  unsigned char i;

  i = 0;
  while (i < 5) {
    if (a[i])
      whatever();
    i++;
  }
}

generates

	sub.b  r3l,r3l
l0	mov.b  r3l,r2l
	extu.w r2
	mov.w  r2,r0
	extu.l er0
	mov.l  er0,er1
	add.l  #0xfffbd8,er1
	mov.b  @er1,r2l
	beq    l1
	jsr    @whatever
l1	add.b  #0x1,r3l
	cmp.b  #0x5,r3l
	bls	l0

whereas I would prefer

        sub.b  r3l,r3l
l0      mov.b  r3l,r2l
        extu.w r2   
        mov.w  r2,r0
        mov.w  r0,r1
        add.w  #0xfbd8,r1	* Changed
        mov.b  @er1,r2l
        beq    l1   
        ...
l1      add.b  #0x1,r3l
        cmp.b  #0x5,r3l
        bls     l0

(or maybe even save a few register moves, but that is beyond this scope).

This might not seem like a big difference, but when you only have 32k for
your code, every wasted word is bad.

I have looked at the code, and one possible way seems to be to define a 
new target that differs slightly from the h8300h target.

Does anyone have alternative suggestions how I should go about this? 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: H8300H Tiny
  2002-08-10 12:09 H8300H Tiny Torbjörn Lindh
@ 2002-08-12 15:12 ` Jeff Law
  2002-08-13 12:29   ` Torbjörn Lindh
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2002-08-12 15:12 UTC (permalink / raw)
  To: TorbjXrn Lindh; +Cc: gcc

In message < Pine.LNX.3.91.1020810210836.7852B-100000@samuraj.c3l.tyreso.se >, To
rbjXrn Lindh writes:
 >Hitachi have generated a number of so called Tiny H8:s, for instance the 
 >H8/3664F. These have an h8300h cpu but are limited to a 64k address 
 >space.
 >
 >The problem with gcc-3.1 (and as far as I can see, the current cvs version
 >too) is that if I use h8300 mode, I don't take advantage of the added
 >instructions, adressing modes etc of the h8300h cpu. But if I use the
 >h8300h mode the addressing gets far to long: 
For the H8/300H and H8/S GCC only supports "Advanced Mode".  What you
want is referred to as "Normal Mode" in the H8 documentation.

At this time "Normal Mode" is not supported on the H8/300H or H8/S chips. 
There is no technical reason why "Normal Mode" couldn't be added -- however,
I'm not aware of anyone working to add support for "Normal Mode" to the
H8 port.

 >I have looked at the code, and one possible way seems to be to define a 
 >new target that differs slightly from the h8300h target.
You'd want to modify the existing H8 target.  You'd want to have smaller
pointers, then you'd have to audit all code which is conditional on
the H8/300H or H8/S and determine which are still appropriate in normal
mode.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: H8300H Tiny
  2002-08-12 15:12 ` Jeff Law
@ 2002-08-13 12:29   ` Torbjörn Lindh
  2002-08-14  8:05     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Torbjörn Lindh @ 2002-08-13 12:29 UTC (permalink / raw)
  To: law; +Cc: gcc

On Mon, 12 Aug 2002, Jeff Law wrote:

> For the H8/300H and H8/S GCC only supports "Advanced Mode".  What you
> want is referred to as "Normal Mode" in the H8 documentation.

Aye.

> At this time "Normal Mode" is not supported on the H8/300H or H8/S chips. 
> There is no technical reason why "Normal Mode" couldn't be added -- however,
> I'm not aware of anyone working to add support for "Normal Mode" to the
> H8 port.

But I do want it, so I have started.

I appreciate your input.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: H8300H Tiny
  2002-08-13 12:29   ` Torbjörn Lindh
@ 2002-08-14  8:05     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2002-08-14  8:05 UTC (permalink / raw)
  To: TorbjXrn Lindh; +Cc: gcc

In message < Pine.LNX.3.91.1020813210214.25883A-100000@samuraj.c3l.tyreso.se >, T
orbjXrn Lindh writes:
 >> At this time "Normal Mode" is not supported on the H8/300H or H8/S chips. 
 >> There is no technical reason why "Normal Mode" couldn't be added -- however
 >,
 >> I'm not aware of anyone working to add support for "Normal Mode" to the
 >> H8 port.
 >
 >But I do want it, so I have started.
Good luck.  Conceptually it shouldn't be too hard. 

jeff


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-14  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-10 12:09 H8300H Tiny Torbjörn Lindh
2002-08-12 15:12 ` Jeff Law
2002-08-13 12:29   ` Torbjörn Lindh
2002-08-14  8:05     ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).