# (RV64 Only) SIMD 32-bit Miscellaneous Instructions

__STATIC_FORCEINLINE unsigned long __RV_KABS32 (unsigned long a)
__STATIC_FORCEINLINE unsigned long __RV_SMAX32 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_SMIN32 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_UMAX32 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_UMIN32 (unsigned long a, unsigned long b)
group NMSIS_Core_DSP_Intrinsic_RV64_SIMD_32B_MISC

(RV64 Only) SIMD 32-bit Miscellaneous Instructions

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

Functions

__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

a[in] unsigned long type of value stored in a

Returns

value stored in unsigned long type

__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
• a[in] unsigned long type of value stored in a

• b[in] unsigned long type of value stored in b

Returns

value stored in unsigned long type

__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
• a[in] unsigned long type of value stored in a

• b[in] unsigned long type of value stored in b

Returns

value stored in unsigned long type

__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
• a[in] unsigned long type of value stored in a

• b[in] unsigned long type of value stored in b

Returns

value stored in unsigned long type

__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
• a[in] unsigned long type of value stored in a

• b[in] unsigned long type of value stored in b

Returns

value stored in unsigned long type