NMSIS-Core  Version 1.2.0
NMSIS-Core support for Nuclei processor-based devices
(RV64 Only) SIMD 32-bit Miscellaneous Instructions

(RV64 Only) SIMD 32-bit Miscellaneous Instructions More...

Functions

__STATIC_FORCEINLINE unsigned long __RV_KABS32 (unsigned long a)
 KABS32 (Scalar 32-bit Absolute Value with Saturation) More...
 
__STATIC_FORCEINLINE unsigned long __RV_SMAX32 (unsigned long a, unsigned long b)
 SMAX32 (SIMD 32-bit Signed Maximum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_SMIN32 (unsigned long a, unsigned long b)
 SMIN32 (SIMD 32-bit Signed Minimum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_UMAX32 (unsigned long a, unsigned long b)
 UMAX32 (SIMD 32-bit Unsigned Maximum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_UMIN32 (unsigned long a, unsigned long b)
 UMIN32 (SIMD 32-bit Unsigned Minimum) More...
 

Detailed Description

(RV64 Only) SIMD 32-bit Miscellaneous Instructions

there are 5 (RV64 Only) SIMD 32-bit Miscellaneous Instructions

Function Documentation

◆ __RV_KABS32()

__STATIC_FORCEINLINE unsigned long __RV_KABS32 ( unsigned long  a)

KABS32 (Scalar 32-bit Absolute Value with Saturation)

Type: DSP (RV64 Only) 24 20 19 15 14 12 11 7 KABS32 10010 Rs1 000 Rd 6 0 GE80B 1111111

Syntax:

KABS32 Rd, Rs1

Purpose:
Get the absolute value of signed 32-bit integer elements in a general register.

Description:
This instruction calculates the absolute value of signed 32-bit integer elements stored in Rs1. The results are written to Rd. This instruction with the minimum negative integer input of 0x80000000 will produce a saturated output of maximum positive integer of 0x7fffffff and the OV flag will be set to 1.

Operations:

if (Rs1.W[x] >= 0) {
res[x] = Rs1.W[x];
} else {
If (Rs1.W[x] == 0x80000000) {
res[x] = 0x7fffffff;
OV = 1;
} else {
res[x] = -Rs1.W[x];
}
}
Rd.W[x] = res[x];
for RV64: x=1...0
Parameters
[in]aunsigned long type of value stored in a
Returns
value stored in unsigned long type

Definition at line 13954 of file core_feature_dsp.h.

13955 {
13956  unsigned long result;
13957  __ASM volatile("kabs32 %0, %1" : "=r"(result) : "r"(a));
13958  return result;
13959 }

References __ASM.

◆ __RV_SMAX32()

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

SMAX32 (SIMD 32-bit Signed Maximum)

Type: SIMD (RV64 Only)

Syntax:

SMAX32 Rd, Rs1, Rs2

Purpose:
Do 32-bit signed integer elements finding maximum operations simultaneously.

Description:
This instruction compares the 32-bit signed integer elements in Rs1 with the 32-bit signed integer elements in Rs2 and selects the numbers that is greater than the other one. The selected results are written to Rd.

Operations:

Rd.W[x] = (Rs1.W[x] > Rs2.W[x])? Rs1.W[x] : Rs2.W[x];
for RV64: x=1...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in unsigned long type

Definition at line 16290 of file core_feature_dsp.h.

16291 {
16292  unsigned long result;
16293  __ASM volatile("smax32 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
16294  return result;
16295 }

References __ASM.

◆ __RV_SMIN32()

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

SMIN32 (SIMD 32-bit Signed Minimum)

Type: SIMD (RV64 Only)

Syntax:

SMIN32 Rd, Rs1, Rs2

Purpose:
Do 32-bit signed integer elements finding minimum operations simultaneously.

Description:
This instruction compares the 32-bit signed integer elements in Rs1 with the 32-bit signed integer elements in Rs2 and selects the numbers that is less than the other one. The selected results are written to Rd.

Operations:

Rd.W[x] = (Rs1.W[x] < Rs2.W[x])? Rs1.W[x] : Rs2.W[x];
for RV64: x=1...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in unsigned long type

Definition at line 16634 of file core_feature_dsp.h.

16635 {
16636  unsigned long result;
16637  __ASM volatile("smin32 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
16638  return result;
16639 }

References __ASM.

◆ __RV_UMAX32()

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

UMAX32 (SIMD 32-bit Unsigned Maximum)

Type: SIMD (RV64 Only)

Syntax:

UMAX32 Rd, Rs1, Rs2

Purpose:
Do 32-bit unsigned integer elements finding maximum operations simultaneously.

Description:
This instruction compares the 32-bit unsigned integer elements in Rs1 with the 32-bit unsigned integer elements in Rs2 and selects the numbers that is greater than the other one. The selected results are written to Rd.

Operations:

Rd.W[x] = (Rs1.W[x] u> Rs2.W[x])? Rs1.W[x] : Rs2.W[x];
for RV64: x=1...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in unsigned long type

Definition at line 17565 of file core_feature_dsp.h.

17566 {
17567  unsigned long result;
17568  __ASM volatile("umax32 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
17569  return result;
17570 }

References __ASM.

◆ __RV_UMIN32()

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

UMIN32 (SIMD 32-bit Unsigned Minimum)

Type: SIMD (RV64 Only)

Syntax:

UMIN32 Rd, Rs1, Rs2

Purpose:
Do 32-bit unsigned integer elements finding minimum operations simultaneously.

Description:
This instruction compares the 32-bit unsigned integer elements in Rs1 with the 32-bit unsigned integer elements in Rs2 and selects the numbers that is less than the other one. The selected results are written to Rd.

Operations:

Rd.W[x] = (Rs1.W[x] <u Rs2.W[x])? Rs1.W[x] : Rs2.W[x];
for RV64: x=1...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned long type of value stored in b
Returns
value stored in unsigned long type

Definition at line 17603 of file core_feature_dsp.h.

17604 {
17605  unsigned long result;
17606  __ASM volatile("umin32 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
17607  return result;
17608 }

References __ASM.

__ASM
#define __ASM
Pass information from the compiler to the assembler.
Definition: nmsis_gcc.h:55