(RV64 Only) 32-bit Parallel Multiply & Add Instructions
- __STATIC_FORCEINLINE long __RV_KMADA32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMAXDA32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMDA32 (unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMXDA32 (unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMADS32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMADRS32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMAXDS32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMSDA32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_KMSXDA32 (long t, unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_SMDS32 (unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_SMDRS32 (unsigned long a, unsigned long b)
- __STATIC_FORCEINLINE long __RV_SMXDS32 (unsigned long a, unsigned long b)
- group NMSIS_Core_DSP_Intrinsic_RV64_32B_PARALLEL_MAC
(RV64 Only) 32-bit Parallel Multiply & Add Instructions
there are 12 (RV64 Only) 32-bit Parallel Multiply & Add Instructions
Functions
- __STATIC_FORCEINLINE long __RV_KMADA32 (long t, unsigned long a, unsigned long b)
KMADA32 (Saturating Signed Multiply Two Words and Two Adds)
Type: DSP (RV64 Only)
Syntax:
KMADA32 Rd, Rs1, Rs2 KMAXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from 32-bit data in two registers; and then adds the two 64-bit results and 64-bit data in a third register together. The addition result may be saturated.
KMADA32: rd + top*top + bottom*bottom
KMAXDA32: rd + top*bottom + bottom*top
Description
:
For the
KMADA32
instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32- bit element in Rs2 and then adds the result to the result of multiplying the top 32-bit element in Rs1 with the top 32-bit element in Rs2. It is actually an alias of theKMAR64
instruction. For theKMAXDA32
instruction, it multiplies the top 32-bit element in Rs1 with the bottom 32-bit element in Rs2 and then adds the result to the result of multiplying the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2. The result is added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The 64-bit result is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
res = Rd + (Rs1.W[1] * Rs2.w[1]) + (Rs1.W[0] * Rs2.W[0]); // KMADA32 res = Rd + (Rs1.W[1] * Rs2.W[0]) + (Rs1.W[0] * Rs2.W[1]); // KMAXDA32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMAXDA32 (long t, unsigned long a, unsigned long b)
KMAXDA32 (Saturating Signed Crossed Multiply Two Words and Two Adds)
Type: DSP (RV64 Only)
Syntax:
KMADA32 Rd, Rs1, Rs2 KMAXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from 32-bit data in two registers; and then adds the two 64-bit results and 64-bit data in a third register together. The addition result may be saturated.
KMADA32: rd + top*top + bottom*bottom
KMAXDA32: rd + top*bottom + bottom*top
Description
:
For the
KMADA32
instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32- bit element in Rs2 and then adds the result to the result of multiplying the top 32-bit element in Rs1 with the top 32-bit element in Rs2. It is actually an alias of theKMAR64
instruction. For theKMAXDA32
instruction, it multiplies the top 32-bit element in Rs1 with the bottom 32-bit element in Rs2 and then adds the result to the result of multiplying the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2. The result is added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The 64-bit result is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
res = Rd + (Rs1.W[1] * Rs2.w[1]) + (Rs1.W[0] * Rs2.W[0]); // KMADA32 res = Rd + (Rs1.W[1] * Rs2.W[0]) + (Rs1.W[0] * Rs2.W[1]); // KMAXDA32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMDA32 (unsigned long a, unsigned long b)
KMDA32 (Signed Multiply Two Words and Add)
Type: DSP (RV64 Only)
Syntax:
KMDA32 Rd, Rs1, Rs2 KMXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the 32-bit element of two registers; and then adds the two 64-bit results together. The addition result may be saturated.
KMDA32: top*top + bottom*bottom
KMXDA32: top*bottom + bottom*top
Description
:
For the
KMDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and then adds the result to the result of multiplying the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theKMXDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and then adds the result to the result of multiplying the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The addition result is checked for saturation. If saturation happens, the result is saturated to 2^63-1. The final result is written to Rd. The 32-bit contents are treated as signed integers.Operations:
if ((Rs1 != 0x8000000080000000) or (Rs2 != 0x8000000080000000)) { Rd = (Rs1.W[1] * Rs2.W[1]) + (Rs1.W[0] * Rs2.W[0]); // KMDA32 Rd = (Rs1.W[1] * Rs2.W[0]) + (Rs1.W[0] * Rs2.W[1]); // KMXDA32 } else { Rd = 0x7fffffffffffffff; OV = 1; }
- Parameters
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMXDA32 (unsigned long a, unsigned long b)
KMXDA32 (Signed Crossed Multiply Two Words and Add)
Type: DSP (RV64 Only)
Syntax:
KMDA32 Rd, Rs1, Rs2 KMXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the 32-bit element of two registers; and then adds the two 64-bit results together. The addition result may be saturated.
KMDA32: top*top + bottom*bottom
KMXDA32: top*bottom + bottom*top
Description
:
For the
KMDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and then adds the result to the result of multiplying the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theKMXDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and then adds the result to the result of multiplying the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The addition result is checked for saturation. If saturation happens, the result is saturated to 2^63-1. The final result is written to Rd. The 32-bit contents are treated as signed integers.Operations:
if ((Rs1 != 0x8000000080000000) or (Rs2 != 0x8000000080000000)) { Rd = (Rs1.W[1] * Rs2.W[1]) + (Rs1.W[0] * Rs2.W[0]); // KMDA32 Rd = (Rs1.W[1] * Rs2.W[0]) + (Rs1.W[0] * Rs2.W[1]); // KMXDA32 } else { Rd = 0x7fffffffffffffff; OV = 1; }
- Parameters
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMADS32 (long t, unsigned long a, unsigned long b)
KMADS32 (Saturating Signed Multiply Two Words & Subtract & Add)
Type: DSP (RV64 Only)
Syntax:
KMADS32 Rd, Rs1, Rs2 KMADRS32 Rd, Rs1, Rs2 KMAXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from 32-bit elements in two registers; and then perform a subtraction operation between the two 64-bit results. Then add the subtraction result to 64-bit data in a third register. The addition result may be saturated.
KMADS32: rd + (top*top - bottom*bottom)
KMADRS32: rd + (bottom*bottom - top*top)
KMAXDS32: rd + (top*bottom - bottom*top)
Description
:
For the
KMADS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the top 32-bit element in Rs2. For theKMADRS32
instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For theKMAXDS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the bottom 32-bit element in Rs2. The subtraction result is then added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set toThe 64-bit result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res = Rd + (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // KMADS32 res = Rd + (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // KMADRS32 res = Rd + (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // KMAXDS32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMADRS32 (long t, unsigned long a, unsigned long b)
KMADRS32 (Saturating Signed Multiply Two Words & Reverse Subtract & Add)
Type: DSP (RV64 Only)
Syntax:
KMADS32 Rd, Rs1, Rs2 KMADRS32 Rd, Rs1, Rs2 KMAXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from 32-bit elements in two registers; and then perform a subtraction operation between the two 64-bit results. Then add the subtraction result to 64-bit data in a third register. The addition result may be saturated.
KMADS32: rd + (top*top - bottom*bottom)
KMADRS32: rd + (bottom*bottom - top*top)
KMAXDS32: rd + (top*bottom - bottom*top)
Description
:
For the
KMADS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the top 32-bit element in Rs2. For theKMADRS32
instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For theKMAXDS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the bottom 32-bit element in Rs2. The subtraction result is then added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set toThe 64-bit result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res = Rd + (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // KMADS32 res = Rd + (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // KMADRS32 res = Rd + (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // KMAXDS32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMAXDS32 (long t, unsigned long a, unsigned long b)
KMAXDS32 (Saturating Signed Crossed Multiply Two Words & Subtract & Add)
Type: DSP (RV64 Only)
Syntax:
KMADS32 Rd, Rs1, Rs2 KMADRS32 Rd, Rs1, Rs2 KMAXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from 32-bit elements in two registers; and then perform a subtraction operation between the two 64-bit results. Then add the subtraction result to 64-bit data in a third register. The addition result may be saturated.
KMADS32: rd + (top*top - bottom*bottom)
KMADRS32: rd + (bottom*bottom - top*top)
KMAXDS32: rd + (top*bottom - bottom*top)
Description
:
For the
KMADS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the top 32-bit element in Rs2. For theKMADRS32
instruction, it multiplies the top 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element in Rs1 with the bottom 32-bit element in Rs2. For theKMAXDS32
instruction, it multiplies the bottom 32-bit element in Rs1 with the top 32-bit element in Rs2 and then subtracts the result from the result of multiplying the top 32-bit element in Rs1 with the bottom 32-bit element in Rs2. The subtraction result is then added to the content of 64-bit data in Rd. If the addition result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set toThe 64-bit result after saturation is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.
Operations:
res = Rd + (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // KMADS32 res = Rd + (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // KMADRS32 res = Rd + (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // KMAXDS32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMSDA32 (long t, unsigned long a, unsigned long b)
KMSDA32 (Saturating Signed Multiply Two Words & Add & Subtract)
Type: DSP (RV64 Only)
Syntax:
KMSDA32 Rd, Rs1, Rs2 KMSXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the 32-bit element of two registers; and then subtracts the two 64-bit results from a third register. The subtraction result may be saturated.
KMSDA: rd - top*top - bottom*bottom
KMSXDA: rd - top*bottom - bottom*top
Description
:
For the
KMSDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and multiplies the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theKMSXDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and multiplies the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The two 64-bit multiplication results are then subtracted from the content of Rd. If the subtraction result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The result after saturation is written to Rd. The 32-bit contents are treated as signed integers.Operations:
res = Rd - (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // KMSDA32 res = Rd - (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // KMSXDA32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_KMSXDA32 (long t, unsigned long a, unsigned long b)
KMSXDA32 (Saturating Signed Crossed Multiply Two Words & Add & Subtract)
Type: DSP (RV64 Only)
Syntax:
KMSDA32 Rd, Rs1, Rs2 KMSXDA32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the 32-bit element of two registers; and then subtracts the two 64-bit results from a third register. The subtraction result may be saturated.
KMSDA: rd - top*top - bottom*bottom
KMSXDA: rd - top*bottom - bottom*top
Description
:
For the
KMSDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and multiplies the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theKMSXDA32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and multiplies the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The two 64-bit multiplication results are then subtracted from the content of Rd. If the subtraction result is beyond the Q63 number range (-2^63 <= Q63 <= 2^63-1), it is saturated to the range and the OV bit is set to 1. The result after saturation is written to Rd. The 32-bit contents are treated as signed integers.Operations:
res = Rd - (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // KMSDA32 res = Rd - (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // KMSXDA32 if (res > (2^63)-1) { res = (2^63)-1; OV = 1; } else if (res < -2^63) { res = -2^63; OV = 1; } Rd = res;
- Parameters
t – [in] long type of value stored in t
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_SMDS32 (unsigned long a, unsigned long b)
SMDS32 (Signed Multiply Two Words and Subtract)
Type: DSP (RV64 Only)
Syntax:
SMDS32 Rd, Rs1, Rs2 SMDRS32 Rd, Rs1, Rs2 SMXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the l 32-bit element of two registers; and then perform a subtraction operation between the two 64-bit results.
SMDS32: top*top - bottom*bottom
SMDRS32: bottom*bottom - top*top
SMXDS32: top*bottom - bottom*top
Description
:
For the
SMDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theSMDRS32
instruction, it multiplies the top 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2. For theSMXDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The subtraction result is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rt = (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // SMDS32 Rt = (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // SMDRS32 Rt = (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // SMXDS32
- Parameters
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_SMDRS32 (unsigned long a, unsigned long b)
SMDRS32 (Signed Multiply Two Words and Reverse Subtract)
Type: DSP (RV64 Only)
Syntax:
SMDS32 Rd, Rs1, Rs2 SMDRS32 Rd, Rs1, Rs2 SMXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the l 32-bit element of two registers; and then perform a subtraction operation between the two 64-bit results.
SMDS32: top*top - bottom*bottom
SMDRS32: bottom*bottom - top*top
SMXDS32: top*bottom - bottom*top
Description
:
For the
SMDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theSMDRS32
instruction, it multiplies the top 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2. For theSMXDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The subtraction result is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rt = (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // SMDS32 Rt = (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // SMDRS32 Rt = (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // SMXDS32
- Parameters
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type
- __STATIC_FORCEINLINE long __RV_SMXDS32 (unsigned long a, unsigned long b)
SMXDS32 (Signed Crossed Multiply Two Words and Subtract)
Type: DSP (RV64 Only)
Syntax:
SMDS32 Rd, Rs1, Rs2 SMDRS32 Rd, Rs1, Rs2 SMXDS32 Rd, Rs1, Rs2
Purpose
:
Do two signed 32-bit multiplications from the l 32-bit element of two registers; and then perform a subtraction operation between the two 64-bit results.
SMDS32: top*top - bottom*bottom
SMDRS32: bottom*bottom - top*top
SMXDS32: top*bottom - bottom*top
Description
:
For the
SMDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the top 32-bit element of Rs2. For theSMDRS32
instruction, it multiplies the top 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the bottom 32-bit element of Rs1 with the bottom 32-bit element of Rs2. For theSMXDS32
instruction, it multiplies the bottom 32-bit element of Rs1 with the top 32-bit element of Rs2 and then subtracts the result from the result of multiplying the top 32-bit element of Rs1 with the bottom 32-bit element of Rs2. The subtraction result is written to Rd. The 32-bit contents of Rs1 and Rs2 are treated as signed integers.Operations:
Rt = (Rs1.W[1] * Rs2.W[1]) - (Rs1.W[0] * Rs2.W[0]); // SMDS32 Rt = (Rs1.W[0] * Rs2.W[0]) - (Rs1.W[1] * Rs2.W[1]); // SMDRS32 Rt = (Rs1.W[1] * Rs2.W[0]) - (Rs1.W[0] * Rs2.W[1]); // SMXDS32
- Parameters
a – [in] unsigned long type of value stored in a
b – [in] unsigned long type of value stored in b
- Returns
value stored in long type