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.

CCS 3.xx How to avoid unwanted casts?

 CCS 3.3.81.6, Code generation tools 4.1.0 DSP 320C5416

 unsigned long Sum32(short a,short b)
{
register unsigned long z;
z=(unsigned long)(a*b);
return (z);
}

Get asm:

_Sum32:
FRAME #-2
NOP
STL A,*SP(0)
LD *SP(4),T
SSBX SXM
MPY *SP(0),A ; |114|
  LD *(AL),A ; |114|     WHAT is THIS ???? i'm need a 32 bit result! 
FRAME #2 ; |116|
NOP
NOP
FRET ; |116|

 unsigned long SSum32(short a,short b)
{
register unsigned long z;
z=(unsigned long)(a*a);
z+=(unsigned long)(b*b);
return (z);
}

 

get asm code:

 _SSum32:
FRAME #-2
NOP
STL A,*SP(0)
SSBX SXM
SQUR *SP(0),A ; |113|
SQUR *SP(4),B ; |114|
  LD *(AL),A ; |113|  WHAT is THIS ???? i'm need a 32 bit result!  
  LD *(BL),B ; |114| WHAT is THIS ???? i'm need a 32 bit result!  
ADD B,A ; |114|
FRAME #2 ; |115|
.dwcfa 0x0e, 2
NOP
NOP
FRET ; |115|


How to avoid unwanted casts?