Signed 16bit Multiply 32bit Add/Subtract InstructionsΒΆ

__STATIC_FORCEINLINE long __RV_KMABB(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMABT(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMATT(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMADA(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMAXDA(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMADS(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMADRS(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMAXDS(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMDA(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMXDA(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMSDA(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_KMSXDA(long t, unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMBB16(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMBT16(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMTT16(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMDS(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMDRS(unsigned long a, unsigned long b)

__STATIC_FORCEINLINE long __RV_SMXDS(unsigned long a, unsigned long b)

group
NMSIS_Core_DSP_Intrinsic_SIGNED_16B_MULT_32B_ADDSUB
Signed 16bit Multiply 32bit Add/Subtract Instructions.
there are 18 Signed 16bit Multiply 32bit Add/Subtract Instructions
Functions

__STATIC_FORCEINLINE long __RV_KMABB(long t, unsigned long a, unsigned long b)
KMABB (SIMD Saturating Signed Multiply Bottom Halfs & Add)
Type: SIMD
Syntax:
KMABB Rd, Rs1, Rs2 KMABT Rd, Rs1, Rs2 KMATT Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of 32bit elements in a register with the 16bit content of 32bit elements in another register and add the result to the content of 32bit elements in the third register. The addition result may be saturated and is written to the third register.
KMABB: rd.W[x] + bottom*bottom (per 32bit element)
KMABT rd.W[x] + bottom*top (per 32bit element)
KMATT rd.W[x] + top*top (per 32bit element)
Description:
For the
KMABB
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. For theKMABT
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMATT
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. The multiplication result is added to the content of 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set toThe results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMABB res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[1]); // KMABT res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMATT if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMABT(long t, unsigned long a, unsigned long b)
KMABT (SIMD Saturating Signed Multiply Bottom & Top Halfs & Add)
Type: SIMD
Syntax:
KMABB Rd, Rs1, Rs2 KMABT Rd, Rs1, Rs2 KMATT Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of 32bit elements in a register with the 16bit content of 32bit elements in another register and add the result to the content of 32bit elements in the third register. The addition result may be saturated and is written to the third register.
KMABB: rd.W[x] + bottom*bottom (per 32bit element)
KMABT rd.W[x] + bottom*top (per 32bit element)
KMATT rd.W[x] + top*top (per 32bit element)
Description:
For the
KMABB
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. For theKMABT
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMATT
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. The multiplication result is added to the content of 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set toThe results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMABB res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[1]); // KMABT res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMATT if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMATT(long t, unsigned long a, unsigned long b)
KMATT (SIMD Saturating Signed Multiply Top Halfs & Add)
Type: SIMD
Syntax:
KMABB Rd, Rs1, Rs2 KMABT Rd, Rs1, Rs2 KMATT Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of 32bit elements in a register with the 16bit content of 32bit elements in another register and add the result to the content of 32bit elements in the third register. The addition result may be saturated and is written to the third register.
KMABB: rd.W[x] + bottom*bottom (per 32bit element)
KMABT rd.W[x] + bottom*top (per 32bit element)
KMATT rd.W[x] + top*top (per 32bit element)
Description:
For the
KMABB
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. For theKMABT
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMATT
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. The multiplication result is added to the content of 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set toThe results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMABB res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[1]); // KMABT res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMATT if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMADA(long t, unsigned long a, unsigned long b)
KMADA (SIMD Saturating Signed Multiply Two Halfs and Two Adds)
Type: SIMD
Syntax:
KMADA Rd, Rs1, Rs2 KMAXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from 32bit elements in two registers; and then adds the two 32bit results and 32bit elements in a third register together. The addition result may be saturated.
KMADA: rd.W[x] + top*top + bottom*bottom (per 32bit element)
KMAXDA: rd.W[x] + top*bottom + bottom*top (per 32bit element)
Description:
For the `KMADA instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then adds the result to the result of multiplying the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For the
KMAXDA
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then adds the result to the result of multiplying the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. The result is added to the content of 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The 32bit results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
// KMADA res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1]) + (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMAXDA res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[0]) + (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMAXDA(long t, unsigned long a, unsigned long b)
KMAXDA (SIMD Saturating Signed Crossed Multiply Two Halfs and Two Adds)
Type: SIMD
Syntax:
KMADA Rd, Rs1, Rs2 KMAXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from 32bit elements in two registers; and then adds the two 32bit results and 32bit elements in a third register together. The addition result may be saturated.
KMADA: rd.W[x] + top*top + bottom*bottom (per 32bit element)
KMAXDA: rd.W[x] + top*bottom + bottom*top (per 32bit element)
Description:
For the `KMADA instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then adds the result to the result of multiplying the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For the
KMAXDA
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then adds the result to the result of multiplying the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. The result is added to the content of 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The 32bit results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
// KMADA res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1]) + (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMAXDA res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[0]) + (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMADS(long t, unsigned long a, unsigned long b)
KMADS (SIMD Saturating Signed Multiply Two Halfs & Subtract & Add)
Type: SIMD
Syntax:
KMADS Rd, Rs1, Rs2 KMADRS Rd, Rs1, Rs2 KMAXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from 32bit elements in two registers; and then perform a subtraction operation between the two 32bit results. Then add the subtraction result to the corresponding 32bit elements in a third register. The addition result may be saturated.
KMADS: rd.W[x] + (top*top  bottom*bottom) (per 32bit element)
KMADRS: rd.W[x] + (bottom*bottom  top*top) (per 32bit element)
KMAXDS: rd.W[x] + (top*bottom  bottom*top) (per 32bit element)
Description:
For the
KMADS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMADRS
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32 bit elements in Rs2. For theKMAXDS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. The subtraction result is then added to the content of the corresponding 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The 32bit results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
// KMADS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMADRS res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMAXDS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMADRS(long t, unsigned long a, unsigned long b)
KMADRS (SIMD Saturating Signed Multiply Two Halfs & Reverse Subtract & Add)
Type: SIMD
Syntax:
KMADS Rd, Rs1, Rs2 KMADRS Rd, Rs1, Rs2 KMAXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from 32bit elements in two registers; and then perform a subtraction operation between the two 32bit results. Then add the subtraction result to the corresponding 32bit elements in a third register. The addition result may be saturated.
KMADS: rd.W[x] + (top*top  bottom*bottom) (per 32bit element)
KMADRS: rd.W[x] + (bottom*bottom  top*top) (per 32bit element)
KMAXDS: rd.W[x] + (top*bottom  bottom*top) (per 32bit element)
Description:
For the
KMADS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMADRS
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32 bit elements in Rs2. For theKMAXDS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. The subtraction result is then added to the content of the corresponding 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The 32bit results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
// KMADS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMADRS res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMAXDS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMAXDS(long t, unsigned long a, unsigned long b)
KMAXDS (SIMD Saturating Signed Crossed Multiply Two Halfs & Subtract & Add)
Type: SIMD
Syntax:
KMADS Rd, Rs1, Rs2 KMADRS Rd, Rs1, Rs2 KMAXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from 32bit elements in two registers; and then perform a subtraction operation between the two 32bit results. Then add the subtraction result to the corresponding 32bit elements in a third register. The addition result may be saturated.
KMADS: rd.W[x] + (top*top  bottom*bottom) (per 32bit element)
KMADRS: rd.W[x] + (bottom*bottom  top*top) (per 32bit element)
KMAXDS: rd.W[x] + (top*bottom  bottom*top) (per 32bit element)
Description:
For the
KMADS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2. For theKMADRS
instruction, it multiplies the top 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32 bit elements in Rs2. For theKMAXDS
instruction, it multiplies the bottom 16bit content of 32bit elements in Rs1 with the top 16bit content of 32bit elements in Rs2 and then subtracts the result from the result of multiplying the top 16bit content of 32bit elements in Rs1 with the bottom 16bit content of 32bit elements in Rs2. The subtraction result is then added to the content of the corresponding 32bit elements in Rd. If the addition result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The 32bit results after saturation are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
// KMADS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMADRS res[x] = Rd.W[x] + (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); // KMAXDS res[x] = Rd.W[x] + (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMDA(unsigned long a, unsigned long b)
KMDA (SIMD Signed Multiply Two Halfs and Add)
Type: SIMD
Syntax:
KMDA Rd, Rs1, Rs2 KMXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then adds the two 32bit results together. The addition result may be saturated.
KMDA: top*top + bottom*bottom (per 32bit element)
KMXDA: top*bottom + bottom*top (per 32bit element)
Description:
For the
KMDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and then adds the result to the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32 bit elements of Rs2. For theKMXDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then adds the result to the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The addition result is checked for saturation. If saturation happens, the result is saturated to 2^311. The final results are written to Rd. The 16bit contents are treated as signed integers.Operations:
if Rs1.W[x] != 0x80008000) or (Rs2.W[x] != 0x80008000 { // KMDA Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[1]) + (Rs1.W[x].H[0] * Rs2.W[x].H[0]; // KMXDA Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[0]) + (Rs1.W[x].H[0] * Rs2.W[x].H[1]; } else { Rd.W[x] = 0x7fffffff; OV = 1; } for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMXDA(unsigned long a, unsigned long b)
KMXDA (SIMD Signed Crossed Multiply Two Halfs and Add)
Type: SIMD
Syntax:
KMDA Rd, Rs1, Rs2 KMXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then adds the two 32bit results together. The addition result may be saturated.
KMDA: top*top + bottom*bottom (per 32bit element)
KMXDA: top*bottom + bottom*top (per 32bit element)
Description:
For the
KMDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and then adds the result to the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32 bit elements of Rs2. For theKMXDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then adds the result to the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The addition result is checked for saturation. If saturation happens, the result is saturated to 2^311. The final results are written to Rd. The 16bit contents are treated as signed integers.Operations:
if Rs1.W[x] != 0x80008000) or (Rs2.W[x] != 0x80008000 { // KMDA Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[1]) + (Rs1.W[x].H[0] * Rs2.W[x].H[0]; // KMXDA Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[0]) + (Rs1.W[x].H[0] * Rs2.W[x].H[1]; } else { Rd.W[x] = 0x7fffffff; OV = 1; } for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMSDA(long t, unsigned long a, unsigned long b)
KMSDA (SIMD Saturating Signed Multiply Two Halfs & Add & Subtract)
Type: SIMD
Syntax:
KMSDA Rd, Rs1, Rs2 KMSXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then subtracts the two 32bit results from the corresponding 32bit elements of a third register. The subtraction result may be saturated.
KMSDA: rd.W[x]  top*top  bottom*bottom (per 32bit element)
KMSXDA: rd.W[x]  top*bottom  bottom*top (per 32bit element)
Description:
For the
KMSDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theKMSXDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and multiplies the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The two 32bit multiplication results are then subtracted from the content of the corresponding 32 bit elements of Rd. If the subtraction result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The results after saturation are written to Rd. The 16bit contents are treated as signed integers.Operations:
// KMSDA res[x] = Rd.W[x]  (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMSXDA res[x] = Rd.W[x]  (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_KMSXDA(long t, unsigned long a, unsigned long b)
KMSXDA (SIMD Saturating Signed Crossed Multiply Two Halfs & Add & Subtract)
Type: SIMD
Syntax:
KMSDA Rd, Rs1, Rs2 KMSXDA Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then subtracts the two 32bit results from the corresponding 32bit elements of a third register. The subtraction result may be saturated.
KMSDA: rd.W[x]  top*top  bottom*bottom (per 32bit element)
KMSXDA: rd.W[x]  top*bottom  bottom*top (per 32bit element)
Description:
For the
KMSDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theKMSXDA
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and multiplies the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The two 32bit multiplication results are then subtracted from the content of the corresponding 32 bit elements of Rd. If the subtraction result is beyond the Q31 number range (2^31 <= Q31 <= 2^311), it is saturated to the range and the OV bit is set to 1. The results after saturation are written to Rd. The 16bit contents are treated as signed integers.Operations:
// KMSDA res[x] = Rd.W[x]  (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); // KMSXDA res[x] = Rd.W[x]  (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]); if (res[x] > (2^31)1) { res[x] = (2^31)1; OV = 1; } else if (res[x] < 2^31) { res[x] = 2^31; OV = 1; } Rd.W[x] = res[x]; for RV32: x=0 for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] t
: long type of value stored in t[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMBB16(unsigned long a, unsigned long b)
SMBB16 (SIMD Signed Multiply Bottom Half & Bottom Half)
Type: SIMD
Syntax:
SMBB16 Rd, Rs1, Rs2 SMBT16 Rd, Rs1, Rs2 SMTT16 Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of the 32bit elements of a register with the signed 16 bit content of the 32bit elements of another register and write the result to a third register.
SMBB16: W[x].bottom*W[x].bottom
SMBT16: W[x].bottom *W[x].top
SMTT16: W[x].top * W[x].top
Description:
For the
SMBB16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMBT16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMTT16
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. The multiplication results are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[0]; // SMBB16 Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[1]; // SMBT16 Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[1]; // SMTT16 for RV32: x=0, for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMBT16(unsigned long a, unsigned long b)
SMBT16 (SIMD Signed Multiply Bottom Half & Top Half)
Type: SIMD
Syntax:
SMBB16 Rd, Rs1, Rs2 SMBT16 Rd, Rs1, Rs2 SMTT16 Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of the 32bit elements of a register with the signed 16 bit content of the 32bit elements of another register and write the result to a third register.
SMBB16: W[x].bottom*W[x].bottom
SMBT16: W[x].bottom *W[x].top
SMTT16: W[x].top * W[x].top
Description:
For the
SMBB16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMBT16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMTT16
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. The multiplication results are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[0]; // SMBB16 Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[1]; // SMBT16 Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[1]; // SMTT16 for RV32: x=0, for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMTT16(unsigned long a, unsigned long b)
SMTT16 (SIMD Signed Multiply Top Half & Top Half)
Type: SIMD
Syntax:
SMBB16 Rd, Rs1, Rs2 SMBT16 Rd, Rs1, Rs2 SMTT16 Rd, Rs1, Rs2
Purpose:
Multiply the signed 16bit content of the 32bit elements of a register with the signed 16 bit content of the 32bit elements of another register and write the result to a third register.
SMBB16: W[x].bottom*W[x].bottom
SMBT16: W[x].bottom *W[x].top
SMTT16: W[x].top * W[x].top
Description:
For the
SMBB16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMBT16
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMTT16
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. The multiplication results are written to Rd. The 16bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[0]; // SMBB16 Rd.W[x] = Rs1.W[x].H[0] * Rs2.W[x].H[1]; // SMBT16 Rd.W[x] = Rs1.W[x].H[1] * Rs2.W[x].H[1]; // SMTT16 for RV32: x=0, for RV64: x=1...0
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMDS(unsigned long a, unsigned long b)
SMDS (SIMD Signed Multiply Two Halfs and Subtract)
Type: SIMD
Syntax:
SMDS Rd, Rs1, Rs2 SMDRS Rd, Rs1, Rs2 SMXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then perform a subtraction operation between the two 32bit results.
SMDS: top*top  bottom*bottom (per 32bit element)
SMDRS: bottom*bottom  top*top (per 32bit element)
SMXDS: top*bottom  bottom*top (per 32bit element)
Description:
For the
SMDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMDRS
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMXDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The subtraction result is written to the corresponding 32bit element of Rd. The 16bit contents of multiplication are treated as signed integers.Operations:
* SMDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); * SMDRS: Rd.W[x] = (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); * SMXDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]);
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMDRS(unsigned long a, unsigned long b)
SMDRS (SIMD Signed Multiply Two Halfs and Reverse Subtract)
Type: SIMD
Syntax:
SMDS Rd, Rs1, Rs2 SMDRS Rd, Rs1, Rs2 SMXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then perform a subtraction operation between the two 32bit results.
SMDS: top*top  bottom*bottom (per 32bit element)
SMDRS: bottom*bottom  top*top (per 32bit element)
SMXDS: top*bottom  bottom*top (per 32bit element)
Description:
For the
SMDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMDRS
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMXDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The subtraction result is written to the corresponding 32bit element of Rd. The 16bit contents of multiplication are treated as signed integers.Operations:
* SMDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); * SMDRS: Rd.W[x] = (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); * SMXDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]);
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b

__STATIC_FORCEINLINE long __RV_SMXDS(unsigned long a, unsigned long b)
SMXDS (SIMD Signed Crossed Multiply Two Halfs and Subtract)
Type: SIMD
Syntax:
SMDS Rd, Rs1, Rs2 SMDRS Rd, Rs1, Rs2 SMXDS Rd, Rs1, Rs2
Purpose:
Do two signed 16bit multiplications from the 32bit elements of two registers; and then perform a subtraction operation between the two 32bit results.
SMDS: top*top  bottom*bottom (per 32bit element)
SMDRS: bottom*bottom  top*top (per 32bit element)
SMXDS: top*bottom  bottom*top (per 32bit element)
Description:
For the
SMDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2. For theSMDRS
instruction, it multiplies the top 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the bottom 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. For theSMXDS
instruction, it multiplies the bottom 16bit content of the 32bit elements of Rs1 with the top 16bit content of the 32bit elements of Rs2 and then subtracts the result from the result of multiplying the top 16bit content of the 32bit elements of Rs1 with the bottom 16bit content of the 32bit elements of Rs2. The subtraction result is written to the corresponding 32bit element of Rd. The 16bit contents of multiplication are treated as signed integers.Operations:
* SMDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[1])  (Rs1.W[x].H[0] * Rs2.W[x].H[0]); * SMDRS: Rd.W[x] = (Rs1.W[x].H[0] * Rs2.W[x].H[0])  (Rs1.W[x].H[1] * Rs2.W[x].H[1]); * SMXDS: Rd.W[x] = (Rs1.W[x].H[1] * Rs2.W[x].H[0])  (Rs1.W[x].H[0] * Rs2.W[x].H[1]);
 Return
value stored in long type
 Parameters
[in] a
: unsigned long type of value stored in a[in] b
: unsigned long type of value stored in b
