CodeWarrior v5.6.1 for MCF5271 - Intrinsic Functions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior v5.6.1 for MCF5271 - Intrinsic Functions

2,477 Views
theJoel
Contributor III

Is there a listing of intrinsic functions available for CodeWarrior (specifically v5.6.1)?

I have seen reference to __labs(), __fabs(), an intrinsic __memcpy() and some rotate functions throughout the documentation, but never a complete list.

I am building for a ColdFire architecture (MCF5271).

--
Alban Edit: please include target and CW version in message subject

Message Edited by Alban on 2007-03-28 08:38 PM

Labels (1)
0 Kudos
4 Replies

393 Views
CrasyCat
Specialist III
Hello
 
The functions you are referring to here are all ANSI C functions.
 
They are documented in following manual  MSL_C_Reference.pdf.
They are also specified (documented) in any good ANSI C reference manual.
 
I hope it helps.
 
CrasyCat
0 Kudos

393 Views
theJoel
Contributor III
Thanks for the response..

I'm not talking about the ANSI standard C lib functions. From the MetroWerks Stanadard Lib C Reference (MSL_C_Reference.pdf , version 10):


Intrinsic functions generate in-line assembly code to perform the library routine. Generally these exist to allow direct access to machine functions which are not easily expressed directly in C. In some cases these map to single assembler instructions.

Some examples of intrinsics are as follows:
    long __labs(long);
    double __fabs(double);
and
    void *__memcpy(void *, const void *, size_t);

where __memcpy() provides access to the block move in the code generator to do the block move inline.


The text implies these are only a few examples. I am looking for an exhaustive list for the ColdFire Family.

Thanks,
Joel.
0 Kudos

393 Views
CompilerGuru
NXP Employee
NXP Employee
Well, first, I might be a guru, but I don't know the CF compiler that well.
So I can only read the manual as you did. The snippet you copied is out of the msl library pdf, a document describing MSL in general and not specifically for the CF compiler. So I would take those functions as hint what intrinsics are used for, and not even those as granted for the CF compiler. Maybe he supports them, maybe not, I don't know.

However the Targeting_ColdFire.pdf manual also contains something about intrinsics, see below. So for CF looks like at least strcpy (I hope strcopy is a typo in the manual) and strlen are real intrinsics, for all others: I don't know.
Anyway, I also noted that E68K_Support\msl\MSL_C\MSL_E68k\Include contains a few inline assembly functions, technically those are not intrinsics though, but they don't have the call overhead either.
I wonder why you are asking for a list, in the end its up to the compiler to replace the intrinsics he wants, and to generate normal function calls for anything else.


Daniel


inline_intrinsics
Controls support for inline intrinsic optimizations strcopy and strlen.
#pragma inline_intrinsics [ on | off | reset ]
Remarks
In the strcopy optimization, the system copies the string via a set of moveimmediate
commands to the source address. The system applies this optimization
if the source is a string constant of fewer than 64 characters, and optimizing is set
for speed.
In the strlen optimization, a move immediate of the length of the string to the
result replaces the function call. The system applies this optimization if the source
is a string constant.
The default value is ON.
0 Kudos

393 Views
theJoel
Contributor III
Thanks Daniel,

I guess in the end the compiler magic happens seamlessly and the intrinsic functions the compiler knows about will be inserted where appropriate.

For our application we are trying to squeeze the maximum possible performance.. having a list of 'optimized' functions for our CF instruction set could guide us to choose certain lib functions over others.

However, running a CF V2 core I don't think there are many instructions that special intrinsic functions could take advantage of (ie. no block move opcode..) but I was wondering if there was a documented list for the MSL target architectures that indicated where intrinsic or otherwise optimized functions had been applied.

Looking at the header files and source for the MSL libs is somewhat fruitless and quite painful [for me], whereas having consolidated documents for all target architecture / os combinations would be painful for someone else. :smileyhappy:
0 Kudos