AnsweredAssumed Answered

asm construct clarification

Question asked by Gasha on Jul 18, 2013
Latest reply on Aug 9, 2013 by Gasha

Hi,

 

First, I want to say that description of asm construct in the Sharc C/C++ manual  is the worst piece of documenration Analog Devices ever produced. I read it many times and I still do not know haw to properly write it. I tried several versions and compiler gives me an error every single time.

 

What I want  to have is min and max macro that uses MIN amd MAX assemble instructions.

I would prefere to have

out_a = MIN (in_b, in_c),

but it looks like that this is not possible (is it?). So I would be happy with

MIN(out_a, in_b, in_c)

that translate into one assembler instruction

Fx = MIN(Fy, Fz).

 

I tried:

#define MIN(var0,var1,var2) \

        asm("%0 = MIN(%1,%2);\

             :"=F"(var0):"0"(var0),"F"(var1),"F"(var2))

 

I get following error:

".\Control.c", line 139: cc0018:  error: expected a ")"

     MIN(Fdr, Fdr,Frot[Num_Lm-1]);

 

 

Assuming that the construct can be written properly, can I use the same C variable for var0 and var1: MIN(x,x,y) ?

 

Thank you.

 

Gasha

Outcomes