Yuri Petriaev

assembly function embedded in C++ source file does not compile

Discussion created by Yuri Petriaev on Mar 15, 2007
Latest reply on Mar 16, 2007 by Yuri Petriaev
I have assembly function in C++ source. It compiles under DIAB, but does not compiles with CW for ColdFire. Could anyone tell what needs to be changes in the function in order for it to compile and work?
asm int tm_asm_checksum (register int loopCount,register tt32Bit dataPtr,register tt32Bit checksum)
%   reg loopCount; reg dataPtr; reg checksum; lab CHECKSUM_LOOP
;/* Set branch counter to number of times to iterate through loop */
   mtspr   9,loopCount
   addi    dataPtr,dataPtr,0xFFFC
;/* Clear the carry bit */
   addic   checksum,checksum,0
   lwzu    r6,4(dataPtr)
   adde    checksum,r6,checksum
   bdnz    CHECKSUM_LOOP
; * In case there was a carry due to the last addition, add the carry bit back
; * in to the sum ( checksum = checksum + 0 + XER[carry] ).
; */
   xor     r6,r6,r6
   adde    checksum,r6,checksum
   addi    r3,checksum,0