[tremor] Support for ARM ASM with non GNU based tools
Chris Gilbert
chris at dokein.co.uk
Tue Sep 10 17:02:43 PDT 2002
It's to do with inlining the code, if you notice the functions are inlined
it allows the compiler to not have to branch to them (saves a pipeline
flush, and stacking r0-r3 on calling and unstacking on exit) but it also
allows the compiler to use any registers it has spare.
Not sure what needs explaining, but I'll attempt to:
// we need some temporary variables to get as outputs from the asm so we
declare them
int lo,hi;
// the actual asm we want to perform
asm volatile("smull %0,%1,%2,%3;\n"
// result variables
: "=&r"(lo),"=&r"(hi)
// input variables (note that I'm not sure what %r is needed for?
: "%r"(x),"r"(y));
all the variables are numbered in order of output then input variables from
0 upwards. If you need to have a variable that's both input and output
you'd use something like:
: "=&r"(inout)
: "0"(inout)
where the number is the matching output variable.
Note that if you actually update memory you should include a 3rd : with the
param "memory", if you update status flags you should also include "cc", eg:
asm volatile(" some asm"
: "=&r"(out)
: "r"(arg0), "r"(arg1)
: "memory", "cc" );
There are other issues relating to the platform you're running on, eg if you
did use real .S files there are issues for making function calls, prologue,
calling conventions etc etc. eg I could happily write asm that meets the
NetBSD ARM ABI, but may not work with linux's ABI. Using asm hides all
this.
Chris
----- Original Message -----
From: "marc dukette" <dukette at adelphia.net>
To: <tremor at xiph.org>
Sent: Wednesday, September 11, 2002 12:13 AM
Subject: Re: [tremor] Support for ARM ASM with non GNU based tools
<p>> I take it no one has any interest in getting the ARM assembly to work on
> Microsoft compiler, guess I will have to bone up on my GCC specific
> assembly. It would be nice if someone would at least explain why you are
> using GCC specific assembly syntax for the ARM assembly. Is there some
> benefeit to be gained, that can not be done with seperate ASM files, or
> other compilers? Is it even possbile to port this code?
>
> ----- Original Message -----
> From: "marc dukette" <dukette at adelphia.net>
> To: <tremor at xiph.org>
> Sent: Saturday, September 07, 2002 12:58 PM
> Subject: [tremor] Support for ARM ASM with non GNU based tools
>
>
> > Hi,
> > I am looking at using Tremor on a PocketPC device, and actually I have
it
> > working, however the Microsoft ARM compiler does not support embedded
ASM
> > for the ARM platform. What are the chances that as Tremor goes forward
> > someone could move the Assembly based routines into seperate .asm files
> > rather than using embedded asm. I can and have been able to convert
even
> > GCC based ASM files for use with Microsoft ARM compiler, but have never
> > successfully been able to convert GCC based inline ASM. There appears
to
> be
> > some proprietary syntax used. Does this buy you something over using
> > seperate standard ASM. I have had similar issues with the MAD MP3
decoder
> > and the original Fixed Point(Nicolas Pitre) version of this library.
> Sorry
> > if this is a stupid question, but I have only limited experience with
the
> > GNU toolset, and am by no means an expert in ARM assembly.
> >
> > BTW
> >
> > ARM assembly aside(since I am not using it with either version), I must
> > agree with Nicolas Pitre that his Fixed Point version is significantly
> > faster on ARM and xscale than the current Tremor release. I have also
not
> > found a single stream that his library has any problems playing.
Granted,
> > on PocketPCs it is much harder to hear distortions than on PC systems.
> >
> > --- >8 ----
> > List archives: http://www.xiph.org/archives/
> > Ogg project homepage: http://www.xiph.org/ogg/
> > To unsubscribe from this list, send a message to
'tremor-request at xiph.org'
> > containing only the word 'unsubscribe' in the body. No subject is
needed.
> > Unsubscribe messages sent to the list will be ignored/filtered.
>
> --- >8 ----
> List archives: http://www.xiph.org/archives/
> Ogg project homepage: http://www.xiph.org/ogg/
> To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
> containing only the word 'unsubscribe' in the body. No subject is needed.
> Unsubscribe messages sent to the list will be ignored/filtered.
>
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Tremor
mailing list