This file describes the Cortex-M4 SIMD instructions supported by CMSIS.
Version: 1.00 - 25. November 2010
Information in this file, the accompany manuals, and software is
Copyright © ARM Ltd.
All rights reserved.
CMSIS provides for the Cortex-M4 a set of functions supporting Cortex-M4 SIMD instructions.
CMSIS supports the following functions for Cortex-M4 instructions:
Name | Mnemonic | Description |
---|---|---|
__SADD8 | SADD8 | GE setting quad 8-bit signed addition |
__QADD8 | QADD8 | Q setting quad 8-bit saturating addition |
__SHADD8 | SHADD8 | Quad 8-bit signed addition with halved results |
__UADD8 | UADD8 | GE setting quad 8-bit unsigned addition |
__UQADD8 | UQADD8 | Quad 8-bit unsigned saturating addition |
__UHADD8 | UHADD8 | Quad 8-bit unsigned addition with halved results |
__SSUB8 | SSUB8 | GE setting quad 8-bit signed subtraction |
__QSUB8 | QSUB8 | Q setting quad 8-bit saturating subtract |
__SHSUB8 | SHSUB8 | Quad 8-bit signed subtraction with halved results |
__USUB8 | USUB8 | GE setting quad 8-bit unsigned subtract |
__UQSUB8 | UQSUB8 | Quad 8-bit unsigned saturating subtraction |
__UHSUB8 | UHSUB8 | Quad 8-bit unsigned subtraction with halved results |
__SADD16 | SADD16 | GE setting dual 16-bit signed addition |
__QADD16 | QADD16 | Q setting dual 16-bit saturating addition |
__SHADD16 | SHADD16 | Dual 16-bit signed addition with halved results |
__UADD16 | UADD16 | GE setting dual 16-bit unsigned addition |
__UQADD16 | UQADD16 | Dual 16-bit unsigned saturating addition |
__UHADD16 | UHADD16 | Dual 16-bit unsigned addition with halved results |
__SSUB16 | SSUB16 | GE setting dual 16-bit signed subtraction |
__QSUB16 | QSUB16 | Q setting dual 16-bit saturating subtract |
__SHSUB16 | SHSUB16 | Dual 16-bit signed subtraction with halved results |
__USUB16 | USUB16 | GE setting dual 16-bit unsigned subtract |
__UQSUB16 | UQSUB16 | Dual 16-bit unsigned saturating subtraction |
__UHSUB16 | UHSUB16 | Dual 16-bit unsigned subtraction with halved results |
__SASX | SASX | GE setting dual 16-bit addition and subtraction with exchange |
__QASX | QASX | Q setting dual 16-bit add and subtract with exchange |
__SHASX | SHASX | Dual 16-bit signed addition and subtraction with halved results |
__UASX | UASX | GE setting dual 16-bit unsigned addition and subtraction with exchange |
__UQASX | UQASX | Dual 16-bit unsigned saturating addition and subtraction with exchange |
__UHASX | UHASX | Dual 16-bit unsigned addition and subtraction with halved results and exchange |
__SSAX | SSAX | GE setting dual 16-bit signed subtraction and addition with exchange |
__QSAX | QSAX | Q setting dual 16-bit subtract and add with exchange |
__SHSAX | SHSAX | Dual 16-bit signed subtraction and addition with halved results |
__USAX | USAX | GE setting dual 16-bit unsigned subtract and add with exchange |
__UQSAX | UQSAX | Dual 16-bit unsigned saturating subtraction and addition with exchange |
__UHSAX | UHSAX | Dual 16-bit unsigned subtraction and addition with halved results and exchange |
__USAD8 | USAD8 | Unsigned sum of quad 8-bit unsigned absolute difference |
__USADA8 | USADA8 | Unsigned sum of quad 8-bit unsigned absolute difference with 32-bit accumulate |
__SSAT16 | SSAT16 | Q setting dual 16-bit saturate |
__USAT16 | USAT16 | Q setting dual 16-bit unsigned saturate |
__UXTB16 | UXTB16 | Dual extract 8-bits and zero-extend to 16-bits |
__UXTAB16 | UXTAB16 | Extracted 16-bit to 32-bit unsigned addition |
__SXTB16 | SXTB16 | Dual extract 8-bits and sign extend each to 16-bits |
__SXTAB16 | SXTAB16 | Dual extracted 8-bit to 16-bit signed addition |
__SMUAD | SMUAD | Q setting sum of dual 16-bit signed multiply |
__SMUADX | SMUADX | Q setting sum of dual 16-bit signed multiply with exchange |
__SMLAD | SMLAD | Q setting dual 16-bit signed multiply with single 32-bit accumulator |
__SMLADX | SMLADX | Q setting pre-exchanged dual 16-bit signed multiply with single 32-bit accumulator |
__SMLALD | SMLALD | Dual 16-bit signed multiply with single 64-bit accumulator |
__SMLALDX | SMLALDX | Dual 16-bit signed multiply with exchange with single 64-bit accumulator |
__SMUSD | SMUSD | Dual 16-bit signed multiply returning difference |
__SMUSDX | SMUSDX | Dual 16-bit signed multiply with exchange returning difference |
__SMLSD | SMLSD | Q setting dual 16-bit signed multiply subtract with 32-bit accumulate |
__SMLSDX | SMLSDX | Q setting dual 16-bit signed multiply with exchange subtract with 32-bit accumulate |
__SMLSLD | SMLSLD | Q setting dual 16-bit signed multiply subtract with 64-bit accumulate |
__SMLSLDX | SMLSLDX | Q setting dual 16-bit signed multiply with exchange subtract with 64-bit accumulate |
__SEL | SEL | Select bytes based on GE bits |
__QADD | QADD | Q setting saturating add |
__QSUB | QSUB/td> | Q setting saturating subtract |
Summary |
uint32_t __SADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four 8-bit signed integer additions. The GE bits in the APSR are set according to the results of the additions. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[7:0] = val1[7:0] + val2[7:0] res[15:8] = val1[15:8] + val2[15:8] res[23:16] = val1[23:16] + val2[23:16] res[31:24] = val1[31:24] + val2[31:24] |
Summary |
uint32_t __QADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four 8-bit integer additions, saturating the results to the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 16-bit signed integer range -27 ≤ x ≤ 27 - 1. |
Operation |
res[7:0] = val1[7:0] + val2[7:0] res[15:8] = val1[15:8] + val2[15:8] res[23:16] = val1[23:16] + val2[23:16] res[31:24] = val1[31:24] + val2[31:24] |
Summary |
uint32_t __SHADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four signed 8-bit integer additions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[7:0] = (val1[7:0] + val2[7:0]) >> 1 res[15:8] = (val1[15:8] + val2[15:8]) >> 1 res[23:16] = (val1[23:16] + val2[23:16]) >> 1 res[31:24] = (val1[31:24] + val2[31:24]) >> 1 |
Summary |
uint32_t __UADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit integer additions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[7:0] = val1[7:0] + val2[7:0] res[15:8] = val1[15:8] + val2[15:8] res[23:16] = val1[23:16] + val2[23:16] res[31:24] = val1[31:24] + val2[31:24] |
Summary |
uint32_t __UQADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit integer additions, saturating the results to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. |
Operation |
res[7:0] = val1[7:0] + val2[7:0] res[15:8] = val1[15:8] + val2[15:8] res[23:16] = val1[23:16] + val2[23:16] res[31:24] = val1[31:24] + val2[31:24] |
Summary |
uint32_t __UHADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit integer additions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[7:0] = (val1[7:0] + val2[7:0]) >> 1 res[15:8] = (val1[15:8] + val2[15:8]) >> 1 res[23:16] = (val1[23:16] + val2[23:16]) >> 1 res[31:24] = (val1[31:24] + val2[31:24]) >> 1 |
Summary |
uint32_t __SSUB8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four 8-bit signed integer subtractions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on the results of the operation. If res is the return value, then:
|
Operation |
res[7:0] = val1[7:0] - val2[7:0] res[15:8] = val1[15:8] - val2[15:8] res[23:16] = val1[23:16] - val2[23:16] res[31:24] = val1[31:24] - val2[31:24] |
Summary |
uint32_t __QADD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four 8-bit integer subtractions, saturating the results to the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 8-bit signed integer range -27 ≤ x ≤ 27 - 1. |
Operation |
res[7:0] = val1[7:0] - val2[7:0] res[15:8] = val1[15:8] - val2[15:8] res[23:16] = val1[23:16] - val2[23:16] res[31:24] = val1[31:24] - val2[31:24] |
Summary |
uint32_t __SHSUB8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four signed 8-bit integer subtractions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[7:0] = (val1[7:0] - val2[7:0]) >> 1 res[15:8] = (val1[15:8] - val2[15:8]) >> 1 res[23:16] = (val1[23:16] - val2[23:16] >> 1 res[31:24] = (val1[31:24] - val2[31:24] >> 1 |
Summary |
uint32_t __USUB8(uint32_t val1, uint32_t val2); |
Description | This function It enables you to perform four 8-bit unsigned integer subtractions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[7:0] = val1[7:0] - val2[7:0] res[15:8] = val1[15:8] - val2[15:8] res[23:16] = val1[23:16] - val2[23:16] res[31:24] = val1[31:24] - val2[31:24] |
Summary |
uint32_t __UQSUB8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit integer subtractions, saturating the results to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 8-bit unsigned integer range 0 ≤ x ≤ 28 - 1. |
Operation |
res[7:0] = val1[7:0] - val2[7:0] res[15:8] = val1[15:8] - val2[15:8] res[23:16] = val1[23:16] - val2[23:16] res[31:24] = val1[31:24] - val2[31:24] |
Summary |
uint32_t __UHSUB8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit integer subtractions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[7:0] = (val1[7:0] - val2[7:0]) >> 1 res[15:8] = (val1[15:8] - val2[15:8]) >> 1 res[23:16] = (val1[23:16] - val2[23:16]) >> 1 res[31:24] = (val1[31:24] - val2[31:24]) >> 1 |
Summary |
uint32_t __SADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit signed integer additions. The GE bits in the APSR are set according to the results of the additions. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] + val2[15:0] res[31:16] = val1[31:16] + val2[31:16] |
Summary |
uint32_t __QADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit integer arithmetic additions in parallel, saturating the results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1 |
Operation |
res[15:0] = val1[15:0] + val2[15:0] res[16:31] = val1[31:16] + val2[31:16] |
Summary |
uint32_t __SHADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two signed 16-bit integer additions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] + val2[15:0]) >> 1 res[31:16] = (val1[31:16] + val2[31:16]) >> 1 |
Summary |
uint32_t __UADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit unsigned integer additions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] + val2[15:0] res[31:16] = val1[31:16] + val2[31:16] |
Summary |
uint32_t __UQADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two unsigned 16-bit integer additions, saturating the results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Operation |
res[15:0] = val1[15:0] + val2[15:0] res[31:16] = val1[31:16] + val2[31:16] |
Summary |
uint32_t __UHADD16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two unsigned 16-bit integer additions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] + val2[15:0]) >> 1 res[31:16] = (val1[31:16] + val2[31:16]) >> 1 |
Summary |
uint32_t __SSUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit signed integer subtractions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] - val2[15:0] res[31:16] = val1[31:16] - val2[31:16] |
Summary |
uint32_t __QSUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit integer subtractions, saturating the results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Operation |
res[15:0] = val1[15:0] - val2[15:0] res[31:16] = val1[31:16] - val2[31:16] |
Summary |
uint32_t __SHSUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two signed 16-bit integer subtractions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] - val2[15:0]) >> 1 res[31:16] = (val1[31:16] - val2[31:16]) >> 1 |
Summary |
uint32_t __USUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit unsigned integer subtractions. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] - val2[15:0] res[31:16] = val1[31:16] - val2[31:16] |
Summary |
uint32_t __UQSUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two unsigned 16-bit integer subtractions, saturating the results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Operation |
res[15:0] = val1[15:0] - val2[15:0] res[31:16] = val1[31:16] - val2[31:16] |
Summary |
uint32_t __UHSUB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two unsigned 16-bit integer subtractions, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] - val2[15:0]) >> 1 res[31:16] = (val1[31:16] - val2[31:16]) >> 1 |
Summary |
uint32_t __SASX(uint32_t val1, uint32_t val2); |
Description | This function inserts an SASX instruction into the instruction stream generated by the
compiler. It enables you to exchange the halfwords of the second operand, add the high
halfwords and subtract the low halfwords. The GE bits in the APRS are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] - val2[31:16] res[31:16] = val1[31:16] + val2[15:0] |
Summary |
uint32_t __QASX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the one operand, then add the high halfwords and subtract the low halfwords, saturating the results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Operation |
res[15:0] = val1[15:0] - val2[31:16] res[31:16] = val1[31:16] + val2[15:0] |
Summary |
uint32_t __SHASX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the two halfwords of one operand, perform one signed 16-bit integer addition and one signed 16-bit subtraction, and halve the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] - val2[31:16]) >> 1 res[31:16] = (val1[31:16] - val2[15:0]) >> 1 |
Summary |
uint32_t __UASX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the two halfwords of the second operand, add the
high halfwords and subtract the low halfwords. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] - val2[31:16] res[31:16] = val1[31:16] + val2[15:0] |
Summary |
uint32_t __UQASX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the second operand and perform one unsigned 16-bit integer addition and one unsigned 16-bit subtraction, saturating the results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Operation |
res[15:0] = val1[15:0] - val2[31:16] res[31:16] = val1[31:16] + val2[15:0] |
Summary |
uint32_t __UHASX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the second operand, add the high halfwords and subtract the low halfwords, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] - val2[31:16]) >> 1 res[31:16] = (val1[31:16] + val2[15:0]) >> 1 |
Summary |
uint32_t __SSAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the two halfwords of one operand and perform one
16-bit integer subtraction and one 16-bit addition. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] + val2[31:16] res[31:16] = val1[31:16] - val2[15:0] |
Summary |
uint32_t __QSAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of one operand, then subtract the high halfwords and add the low halfwords, saturating the results to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Parameter |
|
Return Value |
The function returns:
The returned results are saturated to the 16-bit signed integer range -215 ≤ x ≤ 215 - 1. |
Operation |
res[15:0] = val1[15:0] + val2[31:16] res[31:16] = val1[31:16] - val2[15:0] |
Summary |
uint32_t __SHSAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the two halfwords of one operand, perform one signed 16-bit integer subtraction and one signed 16-bit addition, and halve the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] + val2[31:16]) >> 1 res[31:16] = (val1[31:16] - val2[15:0]) >> 1 |
Summary |
uint32_t __USAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the second operand, subtract the
high halfwords and add the low halfwords. The GE bits in the APSR are set according to the results. |
Parameter |
|
Return Value |
The function returns:
Each bit in APSR.GE is set or cleared for each byte in the return value, depending on
the results of the operation.
|
Operation |
res[15:0] = val1[15:0] + val2[31:16] res[31:16] = val1[31:16] - val2[15:0] |
Summary |
uint32_t __UQSAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the second operand and perform one unsigned 16-bit integer subtraction and one unsigned 16-bit addition, saturating the results to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Parameter |
|
Return Value |
The function returns:
The results are saturated to the 16-bit unsigned integer range 0 ≤ x ≤ 216 - 1. |
Operation |
res[15:0] = val1[15:0] + val2[31:16] res[31:16] = val1[31:16] - val2[15:0] |
Summary |
uint32_t __UHSAX(uint32_t val1, uint32_t val2); |
Description | This function enables you to exchange the halfwords of the second operand, subtract the high halfwords and add the low halfwords, halving the results. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
res[15:0] = (val1[15:0] + val2[31:16]) >> 1 res[31:16] = (val1[31:16] - val2[15:0]) >> 1 |
Summary |
uint32_t __USAD8(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform four unsigned 8-bit subtractions, and add the absolute values of the differences together, returning the result as a single unsigned integer. |
Parameter |
|
Return Value |
The function returns the sum of the absolute differences of:
The sum is returned as a single unsigned integer. |
Operation |
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] res[31:0] = absdiff1 + absdiff2 + absdiff3 + absdiff4 |
Summary |
uint32_t __USADA8(uint32_t val1, uint32_t val2, uint32_t val3); |
Description | This function enables you to perform four unsigned 8-bit subtractions, and add the absolute values of the differences to a 32-bit accumulate operand. |
Parameter |
|
Return Value |
The function returns the sum of the absolute differences of the following bytes, added to the accumulation value:
|
Operation |
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] |
Summary |
uint32_t __SSAT16(uint32_t val1, const uint32_t val2); |
Description | This function enables you to saturate two signed 16-bit values to a selected signed range. The Q bit is set if either operation saturates. |
Parameter |
|
Return Value |
The function returns:
|
Operation |
Saturate halfwords in val1 to the signed range specified by the bit position in val2 |
Summary |
uint32_t __USAT16(uint32_t val1, const uint32_t val2); |
Description | This function enables you to saturate two signed 16-bit values to a selected unsigned
range. The Q bit is set if either operation saturates. |
Parameter |
|
Return Value |
The function returns the saturation of the two signed 16-bit values, as non-negative values.
|
Operation |
Saturate halfwords in val1 to the unsigned range specified by the bit position in val2 |
Summary |
uint32_t __UXTB16(uint32_t val); |
Description | This function enables you to extract two 8-bit values from an operand and zero-extend them to 16 bits each. |
Parameter |
|
Return Value |
The function returns the 8-bit values zero-extended to 16-bit values.
|
Operation |
res[15:0] = ZeroExtended(val[7:0] ) res[31:16] = ZeroExtended(val[23:16]) |
Summary |
uint32_t __UXTAB16(uint32_t val1, uint32_t val2); |
Description | This function enables you to extract two 8-bit values from one operand, zero-extend them to 16 bits each, and add the results to two 16-bit values from another operand. |
Parameter |
|
Return Value |
The function returns the 8-bit values in val2, zero-extended to 16-bit values and added to val1. |
Operation |
res[15:0] = ZeroExt(val2[7:0] to 16 bits) + val1[15:0] res[31:16] = ZeroExt(val2[31:16] to 16 bits) + val1[31:16] |
Summary |
uint32_t __SXTB16(uint32_t val); |
Description | This function enables you to extract two 8-bit values from an operand and sign-extend them to 16 bits each. |
Parameter |
|
Return Value |
The function returns the 8-bit values sign-extended to 16-bit values.
|
Operation |
res[15:0] = SignExtended(val[7:0] res[31:16] = SignExtended(val[23:16] |
Summary |
uint32_t __SXTAB16(uint32_t val1, uint32_t val2); |
Description | This function 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. |
Parameter |
|
Return Value |
The function 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. |
Operation |
res[15:0] = val1[15:0] + SignExtended(val2[7:0]) res[31:16] = val1[31:16] + SignExtended(val2[23:16]) |
Summary |
uint32_t __SMUAD(uint32_t val1, uint32_t val2); |
Description | This function It enables you to perform two 16-bit signed multiplications, adding the
products together. The Q bit is set if the addition overflows. |
Parameter |
|
Return Value |
The function returns the sum of the products of the two 16-bit signed multiplications. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] res[31:0] = p1 + p2 |
Summary |
uint32_t __SMUADX(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit signed multiplications with exchanged
halfwords of the second operand, adding the products together. The Q bit is set if the addition overflows. |
Parameter |
|
Return Value |
The function returns the sum of the products of the two 16-bit signed multiplications with exchanged halfwords of the second operand. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] res[31:0] = p1 + p2 |
Summary |
uint32_t __SMLAD(uint32_t val1, uint32_t val2, uint32_t val3); |
Description | This function enables you to perform two signed 16-bit multiplications, adding both
results to a 32-bit accumulate operand. The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications. |
Parameter |
|
Return Value |
The function returns the product of each multiplication added to the accumulate value, as a 32-bit integer. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] res[31:0] = p1 + p2 + val3[31:0] |
Summary |
uint32_t __SMLADX(uint32_t val1, uint32_t val2, uint32_t val3); |
Description | This function enables you to perform two signed 16-bit multiplications with exchanged
halfwords of the second operand, adding both results to a 32-bit accumulate operand. The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications. |
Parameter |
|
Return Value |
The function returns the product of each multiplication with exchanged halfwords of the second operand added to the accumulate value, as a 32-bit integer. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] res[31:0] = p1 + p2 + val3[31:0] |
Summary |
uint64_t __SMLALD(uint32_t val1, uint32_t val2, uint64_t val3); |
Description | This function enables you to perform two signed 16-bit multiplications, adding both results to a 64-bit accumulate operand. Overflow is only possible as a result of the 64-bit addition. This overflow is not detected if it occurs. Instead, the result wraps around modulo264. |
Parameter |
|
Return Value |
The function returns the product of each multiplication added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] sum = p1 + p2 + val3[63:32][31:0] res[63:32] = sum[63:32] res[31:0] = sum[31:0] |
Summary |
unsigned long long __SMLALDX(uint32_t val1, uint32_t val2, unsigned long long val3); |
Description | This function enables you to exchange the halfwords of the second operand, and perform two signed 16-bit multiplications, adding both results to a 64-bit accumulate operand. Overflow is only possible as a result of the 64-bit addition. This overflow is not detected if it occurs. Instead, the result wraps around modulo264. |
Parameter |
|
Return Value |
The function returns the product of each multiplication added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] sum = p1 + p2 + val3[63:32][31:0] res[63:32] = sum[63:32] res[31:0] = sum[31:0] |
Summary |
uint32_t __SMUSD(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit signed multiplications, taking the difference of the products by subtracting the high halfword product from the low halfword product. |
Parameter |
|
Return Value |
The function returns the difference of the products of the two 16-bit signed multiplications. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] res[31:0] = p1 - p2 |
Summary |
uint32_t __SMUSDX(uint32_t val1, uint32_t val2); |
Description | This function enables you to perform two 16-bit signed multiplications, subtracting one of the products from the other. The halfwords of the second operand are exchanged before performing the arithmetic. This produces top * bottom and bottom * top multiplication. |
Parameter |
|
Return Value |
The function returns the difference of the products of the two 16-bit signed multiplications. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] res[31:0] = p1 - p2 |
Summary |
uint32_t __SMLSD(uint32_t val1, uint32_t val2, uint32_t val3); |
Description | This function enables you to perform two 16-bit signed multiplications, take the
difference of the products, subtracting the high halfword product from the low halfword
product, and add the difference to a 32-bit accumulate operand. The Q bit is set if the accumulation overflows. Overflow cannot occur during the multiplications or the subtraction. |
Parameter |
|
Return Value |
The function returns the difference of the product of each multiplication, added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] res[31:0] = p1 - p2 + val3[31:0] |
Summary |
uint32_t __SMLSDX(uint32_t val1, uint32_t val2, uint32_t val3); |
Description | This function enables you to exchange the halfwords in the second operand, then perform
two 16-bit signed multiplications. The difference of the products is added to a 32-bit
accumulate operand. The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications or the subtraction. |
Parameter |
|
Return Value |
The function returns the difference of the product of each multiplication, added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] res[31:0] = p1 - p2 + val3[31:0] |
Summary |
uint64_t __SMLSLD(uint32_t val1, uint32_t val2, uint64_t val3); |
Description | This function It enables you to perform two 16-bit signed multiplications, take the difference of the products, subtracting the high halfword product from the low halfword product, and add the difference to a 64-bit accumulate operand. Overflow cannot occur during the multiplications or the subtraction. Overflow can occur as a result of the 64-bit addition, and this overflow is not detected. Instead, the result wraps round to modulo264. |
Parameter |
|
Return Value |
The function returns the difference of the product of each multiplication, added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[15:0] p2 = val1[31:16] * val2[31:16] res[63:0] = p1 - p2 + val3[63:0] |
Summary |
unsigned long long __SMLSLDX(uint32_t val1, uint32_t val2, unsigned long long val3); |
Description | This function enables you to exchange the halfwords of the second operand, perform two 16-bit multiplications, adding the difference of the products to a 64-bit accumulate operand. Overflow cannot occur during the multiplications or the subtraction. Overflow can occur as a result of the 64-bit addition, and this overflow is not detected. Instead, the result wraps round to modulo264. |
Parameter |
|
Return Value |
The function returns the difference of the product of each multiplication, added to the accumulate value. |
Operation |
p1 = val1[15:0] * val2[31:16] p2 = val1[31:16] * val2[15:0] res[63:0] = p1 - p2 + val3[63:0] |
Summary |
uint32_t __SEL(uint32_t val1, uint32_t val2); |
Description | This function inserts a SEL instruction into the instruction stream generated by the compiler. It enables you to select bytes from the input parameters, whereby the bytes that are selected depend upon the results of previous SIMD instruction function. The results of previous SIMD instruction function are represented by the Greater than or Equal flags in the Application Program Status Register (APSR). The __SEL function works equally well on both halfword and byte operand function results. This is because halfword operand operations set two (duplicate) GE bits per value. |
Parameter |
|
Return Value |
The function selects bytes from the input parameters and returns them in the return value, res, according to the following criteria:
|
Summary |
uint32_t __QADD(uint32_t val1, uint32_t val2); |
Description | This function enables you to obtain the saturating add of two integers. The Q bit is set if the operation saturates. |
Parameter |
|
Return Value |
The function returns the saturating addition of val1 and val2. |
Operation |
res[31:0] = SAT(val1 + SAT(val2 * 2)) |
Summary |
uint32_t __QSUB(uint32_t val1, uint32_t val2); |
Description | This function enables you to obtain the saturating subtraction of two integers. The Q bit is set if the operation saturates. |
Parameter |
|
Return Value |
The function returns the saturating subtraction of val1 and val2. |
Operation |
res[31:0] = SAT(val1 - SAT(val2 * 2)) |
Following are some coding examples using the SIMD functions:
Name | Description |
---|---|
Addition | Add two values using SIMD function |
Subtraction | Subtract two values using SIMD function |
Multiplication | Performing a multiplication using SIMD function |
Example |
uint32_t add_halfwords(uint32_t val1, uint32_t val2) { uint32_t res; res = __SADD16(val1, val2); return res; } |
Example |
uint32_t sub_halfwords(uint32_t val1, uint32_t val2) { uint32_t res; res = __SSUB16(val1, val2); return res; } |
Example |
uint32_t dual_mul_add_products(uint32_t val1, uint32_t val2) { uint32_t res; res = __SMUAD(val1, val2); return res; } |