This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
to satisfy our static analysis tool, I am including the intrinsic definitions in our code.
This works with most of them, but not all:
- CLA C intrinsic extern void __mswapf(float a , float b ):
error #149: declaration is incompatible with builtin "void __mswapf(float &, float &)
Changing intrinsic declaration to "extern void __mswapf(float *a , float *b )" does not help - still incompatible.
Changing intrinsic declaration to "extern void __mswapf(float & , float & )" does not help either - "error #18: expected a ")"
- Same problem for __f32_max_idx, __f32_min_idx
So how can I define these intrinsics correctly?
- The __fmax and __fmin definitions are not
float __fmax( float x, float y ) as in spru514e.pdf, but
double __fmax( double x, double y )
Is this a compiler or documentation error?
StephanS said:So how can I define these intrinsics correctly?
I recommend ...
#ifndef __TMS320C2000__ // line 1
extern void __mswapf(float a , float b ); // line 2
#endif // line 3
Lines 1 and 3 mean line 2 will not be seen by the TI C2000 compiler. Only your static analysis tool will see it. The symbol __TMS320C2000__ is predefined by the C2000 compiler.
The problem is the semantics (what it actually does) of the __mswapf intrinsic cannot be represented in C. It borrows the reference concept from C++. For example, "float &" is a reference to a float variable. This intrinsic swaps the contents of a and b without using any pointers. You cannot represent that in C.
StephanS said:Same problem for __f32_max_idx, __f32_min_idx
Yes, it is. Though these are not CLA intrinsics, but regular compiler intrinsics.
StephanS said:- The __fmax and __fmin definitions are not
float __fmax( float x, float y ) as in spru514e.pdf, but
double __fmax( double x, double y )
Is this a compiler or documentation error?
These intrinsics also use references, which means these declarations must also not be seen by the C2000 compiler. Since float and double are both 32-bits, you can define them however you like.
Thanks and regards,
-George
Okay, understood, thanks for your explanation.
So I won't try to make the intrinsics visible to the compiler, only to the static analysis tool.