Subject: RE: Using ARM's half-word data-handling instructions.

From: Dan Jakubiec <[email-masked]>
Date: Tue, 14 Sep 1999 13:44:57 -0700

Some FYI:

So I think I may have confused my terminology a bit.  In any case, what I am
trying to do was recompile the Linux kernel to use the THUMB instruction
subset (ARM v4T), since the ARM website boasts a potential for 30% reduction
in code size.  I thought this was what you meant by "half-word data-handling
instructions", but I think I was mistaken here.

So, using my gcc compiler (which was compiled using the
--with-cpu=strongarm110 option) with the following flag combinations, I came
up with these code sizes:

-mcpu=arm7                   : 712,016
-mcpu=arm7     -march=armv3  : 712,016
-mcpu=arm7tdmi -march=armv4t : 703,824 (1.15% savings, 8192 bytes)

So I don't see the 30% savings here.  Is it possible that I need to
recompile my GCC with different settings (does the strongarm110 option not
do THUMB)?  Or do you think the 1.15% savings is all I'm going to get out of
it?

Thanks again!

-- Dan

> >Unfortunately, I didn't have the presense of mind to record 
> the exact size
> >of the original kernel, so I'll need to estimate.  I believe I saved
> >approximately 5K-15K on my "arch/arm/boot/Image" file, which 
> is currently
> >712,016 bytes.  I guess I expected more significant savings.
> 
> Sounds about right to me.
> 
> >Does gcc have a compile-time option to tell it not to use 
> the Thumb (ARM v4)
> >instructions?  Maybe that way I could get you some more 
> accurate numbers
> >(without rebuilding my compiler again).
> 
> Yup, you can use -march=armv3 to control this.  This isn't very well 
> documented but I think "gcc --help" does mention it.
> 
> (Incidentally, LDRH isn't actually a Thumb instruction; 
> StrongARM supports 
> halfword operations, which are in v4 but not Thumb, which is 
> v3T or v4T.)
> 
> p.
> 

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Tue, 14 Sep 1999 22:16:13 +0100

>in code size. 

You currently need a completely separate compiler to generate Thumb code 
rather than ARM code - you must configure as `thumb-linux' or something 
similar.  I don't think it will currently work to just compile the kernel as 
Thumb code, though I would be happy to help you if you want to try to get it 
going.

>do THUMB)?  Or do you think the 1.15% savings is all I'm going to get out of

The ARM architecture manual contains details of what each level of the 
architecture includes, which might help to clear up the confusion.  Briefly, 
ARMv3 is what you might call the "base" instruction set.  ARMv4 adds long 
multiply, signed byte and halfword load and store instructions.  Thumb is 
pretty much orthogonal to this and you can add it to either a v3 or v4 
implementation, giving you v3T or v4T.  There are a bunch of other extensions 
to ARMv3 as well (eg the D, M and I from ARM7TDMI).

The StrongARM-1 core is a v4 implementation.  So no, the strongarm110 option 
doesn't turn Thumb on; it just enables the v4 instructions such as LDRH.  
1.15% saving sounds about right for that, in fact it's slightly higher than 
I'd have expected.

p.