Non-Confidential | PDF version | ARM DUI0375F | ||

| ||||

Home > ARMv6 SIMD Instruction Intrinsics > __usada8 intrinsic |

This intrinsic inserts a `USADA8`

instruction into the instruction stream generated by the compiler.

It enables
you to perform four unsigned 8-bit subtractions, and add the absolute
values of the differences to a 32-bit accumulate operand.

```
unsigned int __usada8(unsigned int
````val1`

, unsigned int `val2`

, unsigned int `val3`

)

Where:

`val1`

- holds the first four 8-bit operands for the subtractions
`val2`

- holds the second four 8-bit operands for the subtractions
`val3`

- holds the accumulation value.

The

`__usada8`

intrinsic returns the sum
of the absolute differences of the following bytes, added to the
accumulation value:- The subtraction of the first byte in the second operand from the first byte in the first operand.
- The subtraction of the second byte in the second operand from the second byte in the first operand.
- The subtraction of the third byte in the second operand from the third byte in the first operand.
- The subtraction of the fourth byte in the second operand from the fourth byte in the first operand.

unsigned int subtract_add_diff_accumulate(unsigned int val1, unsigned int val2, unsigned int val3) { unsigned int res; res = __usada8(val1,val2,val3); /* absdiff1 = val1[7:0] - val2[7:0] absdiff2 = val1[15:8] - val2[15:8] absdiff3 = val1[23:16] - val2[23:16] absdiff4 = val1[31:24] - val2[31:24] sum = absdiff1 + absdiff2 + absdiff3 + absdiff4 res[31:0] = sum[31:0] + val3[31:0] */ return res; }