Couple Quick V13beta1 Questions / Comments

Technical questions regarding the XTC tools and programming with XMOS.
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Couple Quick V13beta1 Questions / Comments

Post by bearcat »

1 - XC inlining is not happening for me. Declare the routine like:

Code: Select all

extern inline void abc(int a);
at the beginning of an xc file. But the code is not inlined. I definately see stack pushes and pulls and a branch to the routine. It also appears you can't inline a local subprogram anymore. I need that speed in one routine. Also, small subprograms are not inlined, as I thought the release notes said it does at higher optimization levels. I'm using -O3. Ideas?

2 - Looks like the simple operator to a channel no longer works as before. If you want to send control tokens on that channel also, you will have problems. Looks like end control tokens are being inserted like crazy in the code (not for a streaming channel, though). Using the simple operator to a channel appears to be out. Didn't notice that in the release notes, but I could have missed it. Built-ins work fine. I did have to change a couple routines.

3 - Debug crashing (V12 also). Anyone have any suggestions? I am out of date still using Windows XP for now.

4 - Other question. Can I assume, per the XS1 abi, any .S program does not have to save or restore, and can change, the contents of r0, r1, r2, r3, and r11 (even if the routine has less than 4 parameters, or not)? That is also true for pass as reference?

Thanks.


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

bearcat wrote:1 - XC inlining is not happening for me. Declare the routine like:

Code: Select all

extern inline void abc(int a);
at the beginning of an xc file. But the code is not inlined. I definately see stack pushes and pulls and a branch to the routine.
Short answer: you probably want "static inline", and you
need to provide a definition as well in your translation unit.
Easiest is to put it in a header file.

Longer answer: try the short answer first :-)
It also appears you can't inline a local subprogram anymore. I need that speed in one routine. Also, small subprograms are not inlined, as I thought the release notes said it does at higher optimization levels. I'm using -O3. Ideas?
I'm not exactly sure what you mean; but did you declare
your functions "static"?
4 - Other question. Can I assume, per the XS1 abi, any .S program does not have to save or restore, and can change, the contents of r0, r1, r2, r3, and r11 (even if the routine has less than 4 parameters, or not)? That is also true for pass as reference?
Yes. r0..r3,r11 are caller-save.
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Post by bearcat »

Thanks for the help. I am not a c expert yet. Declaring static allowed for a local program to be inlined without a compiler error.

But it is still not inlined. Here's more exactly what I am using:

Code: Select all

static inline void adcDecode(int &samp1, int &samp2, int &samp3, int &samp4, unsigned matrix)
{...

...
adcDecode(in1, in2, in3, in4, matrix);
...
No compiler errors. Inlining had worked in 11.2.2 with this code.
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Presumably the compiler decided not inlining the function
would be cheaper. Do you call it from many places perhaps,
and is it a big function?

You can try adding

Code: Select all

__attribute__((always_inline))
at the end of the declaration (immediately before the "{").
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Post by bearcat »

It is probably 100 XS1 instructions, called 8 times. Will try the force.

Thanks
User avatar
Ross
XCore Expert
Posts: 968
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Make sure to compile with -O3 (or some level of optimisations turned on)
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Post by bearcat »

I have it set for -O3. But I will check to make sure that is being used.