This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

assembler function inlining


Function inlining replaces a call to a function with the body of the function. This speeds up program execution by eliminating the call/return code, the code required to pass parameters, and the code required for return values.

But how to asign the __inline switch to my assembler function:

//*********************************************************************
// 32*32 bit signed/unsigned multiply in ARM Assembler
// Returns 64 bit result in R0,R1
//*********************************************************************
AREA ?C?bla, CODE, READONLY, ALIGN=2

PUBLIC S_MUL32x32?A
S_MUL32x32?A            PROC CODE32

                SMULL   R2,R0,R1,R0                     ; R0,R2 := R1*R0
                mov     R1,R2
                bx      lr
                ENDP

PUBLIC U_MUL32x32?A
U_MUL32x32?A            PROC CODE32

                UMULL   R2,R0,R1,R0                     ; R0,R2 := R1*R0
                mov     R1,R2
                bx      lr
                ENDP

                END
//*********************************************************************


In the following function declarations the "__inline" switch does not have an effect:

extern __inline unsigned long long U_MUL32x32(unsigned int,unsigned int);
extern __inline unsigned long long S_MUL32x32(unsigned int,unsigned int);

Parents
  • Sorry i must say Please read the manual to myself :-)


    Some restrictions apply to the __inline attribute. As such, function inlining is disabled for:

    functions that return a struct or union or have a parameter of the type struct or union.

    my union:

    //***************************************************************************
    union xyz
    {
            unsigned int i[2];
            unsigned long long l;
    };
    //***************************************************************************
    


    my function call:

                    union xyz zz;
                    zz.l=U_MUL32x32(0x88888888,0x11111111);
                    printf("%#.8X ",zz.i[0]);
                    printf("%#.8X\n",zz.i[1]);
    
                    zz.l=S_MUL32x32(0x88888888,0x11111111);
                    printf("%#.8X ",zz.i[0]);
                    printf("%#.8X\n",zz.i[1]);
    

Reply
  • Sorry i must say Please read the manual to myself :-)


    Some restrictions apply to the __inline attribute. As such, function inlining is disabled for:

    functions that return a struct or union or have a parameter of the type struct or union.

    my union:

    //***************************************************************************
    union xyz
    {
            unsigned int i[2];
            unsigned long long l;
    };
    //***************************************************************************
    


    my function call:

                    union xyz zz;
                    zz.l=U_MUL32x32(0x88888888,0x11111111);
                    printf("%#.8X ",zz.i[0]);
                    printf("%#.8X\n",zz.i[1]);
    
                    zz.l=S_MUL32x32(0x88888888,0x11111111);
                    printf("%#.8X ",zz.i[0]);
                    printf("%#.8X\n",zz.i[1]);
    

Children
No data