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 ?


On Thu, Apr 29, 2004 at 10:02:38AM -0500, Grant Edwards wrote:

> short foo(void)
> {
>   return s.s;
>    0:	6a 08 00 00 	6a 08 00 00       mov.b	@0x0:16,r0l
>    4:	f0 00       	f0 00             mov.b	#0x0,r0h
>    6:	6a 0a 00 00 	6a 0a 00 00       mov.b	@0x0:16,r2l
>    a:	14 a0       	14 a0             or.b	r2l,r0h
> }
>    c:	54 70       	54 70             rts

That's some ugly looking code.  One would expect it to be two
mov.b instructions (the converse of the code in bar()).
Something like this:

  return s.s;
   0:	6a 08 00 00 	6a 08 00 00       mov.b	@0x0:16,r0l
   4:	6a 0a 00 00 	6a 0a 00 00       mov.b	@0x0:16,r0h

}
   8:	54 70       	54 70             rts


> void bar(short v)
> {
>   s.s = v;
>    e:	6a 80 00 00 	6a 80 00 00       mov.b	r0h,@0x0:16
>   12:	6a 88 00 00 	6a 88 00 00       mov.b	r0l,@0x0:16
> }
>   16:	54 70       	54 70             rts

-- 
Grant Edwards
grante@visi.com

------
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]