# SIMD 16-bit Compare Instructions

__STATIC_FORCEINLINE unsigned long __RV_CMPEQ16 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_SCMPLE16 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_SCMPLT16 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_UCMPLE16 (unsigned long a, unsigned long b)
__STATIC_FORCEINLINE unsigned long __RV_UCMPLT16 (unsigned long a, unsigned long b)
group NMSIS_Core_DSP_Intrinsic_SIMD_16B_CMP

SIMD 16-bit Compare Instructions.

there are 5 SIMD 16-bit Compare instructions.

Functions

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

CMPEQ16 (SIMD 16-bit Integer Compare Equal)

Type: SIMD

Syntax:

```CMPEQ16 Rd, Rs1, Rs2
```

Purpose

:

Do 16-bit integer elements equal comparisons simultaneously.

Description

:

This instruction compares the 16-bit integer elements in Rs1 with the 16-bit integer elements in Rs2 to see if they are equal. If they are equal, the result is 0xFFFF; otherwise, the result is 0x0. The 16-bit element comparison results are written to Rt.

Note

:

This instruction can be used for either signed or unsigned numbers.

Operations:

```Rd.H[x] = (Rs1.H[x] == Rs2.H[x])? 0xffff : 0x0;
for RV32: x=1...0,
for RV64: x=3...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_SCMPLE16 (unsigned long a, unsigned long b)

SCMPLE16 (SIMD 16-bit Signed Compare Less Than & Equal)

Type: SIMD

Syntax:

```SCMPLE16 Rd, Rs1, Rs2
```

Purpose

:

Do 16-bit signed integer elements less than & equal comparisons simultaneously.

Description

:

This instruction compares the 16-bit signed integer elements in Rs1 with the 16-bit signed integer elements in Rs2 to see if the one in Rs1 is less than or equal to the one in Rs2. If it is true, the result is 0xFFFF; otherwise, the result is 0x0. The element comparison results are written to Rd.

Operations:

```Rd.H[x] = (Rs1.H[x] {le} Rs2.H[x])? 0xffff : 0x0;
for RV32: x=1...0,
for RV64: x=3...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_SCMPLT16 (unsigned long a, unsigned long b)

SCMPLT16 (SIMD 16-bit Signed Compare Less Than)

Type: SIMD

Syntax:

```SCMPLT16 Rd, Rs1, Rs2
```

Purpose

:

Do 16-bit signed integer elements less than comparisons simultaneously.

Description

:

This instruction compares the 16-bit signed integer elements in Rs1 with the two 16- bit signed integer elements in Rs2 to see if the one in Rs1 is less than the one in Rs2. If it is true, the result is 0xFFFF; otherwise, the result is 0x0. The element comparison results are written to Rd.

Operations:

```Rd.H[x] = (Rs1.H[x] < Rs2.H[x])? 0xffff : 0x0;
for RV32: x=1...0,
for RV64: x=3...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_UCMPLE16 (unsigned long a, unsigned long b)

UCMPLE16 (SIMD 16-bit Unsigned Compare Less Than & Equal)

Type: SIMD

Syntax:

```UCMPLE16 Rd, Rs1, Rs2
```

Purpose

:

Do 16-bit unsigned integer elements less than & equal comparisons simultaneously.

Description

:

This instruction compares the 16-bit unsigned integer elements in Rs1 with the 16-bit unsigned integer elements in Rs2 to see if the one in Rs1 is less than or equal to the one in Rs2. If it is true, the result is 0xFFFF; otherwise, the result is 0x0. The element comparison results are written to Rd.

Operations:

```Rd.H[x] = (Rs1.H[x] <=u Rs2.H[x])? 0xffff : 0x0;
for RV32: x=1...0,
for RV64: x=3...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_UCMPLT16 (unsigned long a, unsigned long b)

UCMPLT16 (SIMD 16-bit Unsigned Compare Less Than)

Type: SIMD

Syntax:

```UCMPLT16 Rd, Rs1, Rs2
```

Purpose

:

Do 16-bit unsigned integer elements less than comparisons simultaneously.

Description

:

This instruction compares the 16-bit unsigned integer elements in Rs1 with the 16-bit unsigned integer elements in Rs2 to see if the one in Rs1 is less than the one in Rs2. If it is true, the result is 0xFFFF; otherwise, the result is 0x0. The element comparison results are written to Rd.

Operations:

```Rd.H[x] = (Rs1.H[x] <u Rs2.H[x])? 0xffff : 0x0;
for RV32: x=1...0,
for RV64: x=3...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