You copied the Doc URL to your clipboard.

__sxtab16 intrinsic

This intrinsic inserts an SXTAB16 instruction into the instruction stream generated by the compiler. It enables you to extract two 8-bit values from the second operand (at bit positions [7:0] and [23:16]), sign-extend them to 16-bits each, and add the results to the first operand.

unsigned int __sxtab16(unsigned int val1, unsigned int val2)



holds the values that the extracted and sign-extended values are added to


holds the two 8-bit values to be extracted and sign-extended.

The __sxtab16 intrinsic returns the addition of val1 and val2, where the 8-bit values in val2[7:0] and val2[23:16] have been extracted and sign-extended prior to the addition.


unsigned int extract_sign_extend_and_add(unsigned int val1, unsigned int val2)
  unsigned int res;

    res = __sxtab16(val1,val2); /* res[15:0] 
                                    = val1[15:0] + SignExtended(val2[7:0])

                                    = val1[31:16] + SignExtended(val2[23:16])
    return res;

See also