This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: ARM compiler misbehaves ?


> The only thing guaranteed to work is to declare everything as
> an array of unsigned chars and bash bytes around manually.

That is certainly the way I have always done things.

I was fascinated by the packed structure example, partly because
I am currently hacking on some H8 assembler and it looks to me
that the generated code is broken. It seems to always access location
zero (the unsigned char).

The 3.0.2 H8 compiler I use here generates good code. That is,
good in that it works, the performance would be horrible.

short foo(void)
{
  return s.s;
}

Compiles to:

	.global _foo
_foo:
	mov.b	@_s+1,r2l
	mov.b	r2l,r2h
	sub.b	r2l,r2l
	mov.b	@_s+2,r0l
	mov.b	#0,r0h
	or	r2l,r0l
	or	r2h,r0h; r2 or2
	rts

When a simple:
_foo:
	mov.b	@_s+1,r0h
	mov.b	@_s+2,r0l
	rts

would do. Do any of the later compiler versions do better than this?

Compiler command line was:
	h8300-coff-gcc -O2 -fomit-frame-pointer -S check.c

 - Richard Hodson

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]