NMSIS-Core  Version 1.2.0
NMSIS-Core support for Nuclei processor-based devices

SIMD 8-bit Miscellaneous Instructions. More...

Macros

#define __RV_SCLIP8(a, b)
 SCLIP8 (SIMD 8-bit Signed Clip Value) More...
 
#define __RV_UCLIP8(a, b)
 UCLIP8 (SIMD 8-bit Unsigned Clip Value) More...
 

Functions

__STATIC_FORCEINLINE unsigned long __RV_CLRS8 (unsigned long a)
 CLRS8 (SIMD 8-bit Count Leading Redundant Sign) More...
 
__STATIC_FORCEINLINE unsigned long __RV_CLO8 (unsigned long a)
 CLO8 (SIMD 8-bit Count Leading One) More...
 
__STATIC_FORCEINLINE unsigned long __RV_CLZ8 (unsigned long a)
 CLZ8 (SIMD 8-bit Count Leading Zero) More...
 
__STATIC_FORCEINLINE unsigned long __RV_KABS8 (unsigned long a)
 KABS8 (SIMD 8-bit Saturating Absolute) More...
 
__STATIC_FORCEINLINE unsigned long __RV_SMAX8 (unsigned long a, unsigned long b)
 SMAX8 (SIMD 8-bit Signed Maximum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_SMIN8 (unsigned long a, unsigned long b)
 SMIN8 (SIMD 8-bit Signed Minimum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_UMAX8 (unsigned long a, unsigned long b)
 UMAX8 (SIMD 8-bit Unsigned Maximum) More...
 
__STATIC_FORCEINLINE unsigned long __RV_UMIN8 (unsigned long a, unsigned long b)
 UMIN8 (SIMD 8-bit Unsigned Minimum) More...
 

Detailed Description

SIMD 8-bit Miscellaneous Instructions.

there are 10 SIMD 8-bit Miscellaneous instructions.

Macro Definition Documentation

◆ __RV_SCLIP8

#define __RV_SCLIP8 (   a,
 
)

SCLIP8 (SIMD 8-bit Signed Clip Value)

Type: SIMD

Syntax:

SCLIP8 Rd, Rs1, imm3u[2:0]

Purpose:
Limit the 8-bit signed integer elements of a register into a signed range simultaneously.

Description:
This instruction limits the 8-bit signed integer elements stored in Rs1 into a signed integer range between 2^imm3u-1 and -2^imm3u, and writes the limited results to Rd. For example, if imm3u is 3, the 8-bit input values should be saturated between 7 and -8. If saturation is performed, set OV bit to 1.

Operations:

src = Rs1.B[x];
if (src > (2^imm3u)-1) {
src = (2^imm3u)-1;
OV = 1;
} else if (src < -2^imm3u) {
src = -2^imm3u;
OV = 1;
}
Rd.B[x] = src
for RV32: x=3...0,
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned int type of value stored in b
Returns
value stored in unsigned long type

Definition at line 6916 of file core_feature_dsp.h.

◆ __RV_UCLIP8

#define __RV_UCLIP8 (   a,
 
)

UCLIP8 (SIMD 8-bit Unsigned Clip Value)

Type: SIMD

Syntax:

UCLIP8 Rt, Ra, imm3u

Purpose:
Limit the 8-bit signed elements of a register into an unsigned range simultaneously.

Description:
This instruction limits the 8-bit signed elements stored in Rs1 into an unsigned integer range between 2^imm3u-1 and 0, and writes the limited results to Rd. For example, if imm3u is 3, the 8- bit input values should be saturated between 7 and 0. If saturation is performed, set OV bit to 1.

Operations:

src = Rs1.H[x];
if (src > (2^imm3u)-1) {
src = (2^imm3u)-1;
OV = 1;
} else if (src < 0) {
src = 0;
OV = 1;
}
Rd.H[x] = src;
for RV32: x=3...0,
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
[in]bunsigned int type of value stored in b
Returns
value stored in unsigned long type

Definition at line 11114 of file core_feature_dsp.h.

Function Documentation

◆ __RV_CLO8()

__STATIC_FORCEINLINE unsigned long __RV_CLO8 ( unsigned long  a)

CLO8 (SIMD 8-bit Count Leading One)

Type: SIMD

Syntax:

CLO8 Rd, Rs1

Purpose:
Count the number of leading one bits of the 8-bit elements of a general register.

Description:
Starting from the most significant bits of the 8-bit elements of Rs1, this instruction counts the number of leading one bits and writes the results to the corresponding 8-bit elements of Rd.

Operations:

snum[x] = Rs1.B[x];
cnt[x] = 0;
for (i = 7 to 0) {
if (snum[x](i) == 1) {
cnt[x] = cnt[x] + 1;
} else {
break;
}
}
Rd.B[x] = cnt[x];
for RV32: x=3...0
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
Returns
value stored in unsigned long type

Definition at line 917 of file core_feature_dsp.h.

918 {
919  unsigned long result;
920  __ASM volatile("clo8 %0, %1" : "=r"(result) : "r"(a));
921  return result;
922 }

References __ASM.

◆ __RV_CLRS8()

__STATIC_FORCEINLINE unsigned long __RV_CLRS8 ( unsigned long  a)

CLRS8 (SIMD 8-bit Count Leading Redundant Sign)

Type: SIMD

Syntax:

CLRS8 Rd, Rs1

Purpose:
Count the number of redundant sign bits of the 8-bit elements of a general register.

Description:
Starting from the bits next to the sign bits of the 8-bit elements of Rs1, this instruction counts the number of redundant sign bits and writes the result to the corresponding 8-bit elements of Rd.

Operations:

snum[x] = Rs1.B[x];
cnt[x] = 0;
for (i = 6 to 0) {
if (snum[x](i) == snum[x](7)) {
cnt[x] = cnt[x] + 1;
} else {
break;
}
}
Rd.B[x] = cnt[x];
for RV32: x=3...0
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
Returns
value stored in unsigned long type

Definition at line 776 of file core_feature_dsp.h.

777 {
778  unsigned long result;
779  __ASM volatile("clrs8 %0, %1" : "=r"(result) : "r"(a));
780  return result;
781 }

References __ASM.

◆ __RV_CLZ8()

__STATIC_FORCEINLINE unsigned long __RV_CLZ8 ( unsigned long  a)

CLZ8 (SIMD 8-bit Count Leading Zero)

Type: SIMD

Syntax:

CLZ8 Rd, Rs1

Purpose:
Count the number of leading zero bits of the 8-bit elements of a general register.

Description:
Starting from the most significant bits of the 8-bit elements of Rs1, this instruction counts the number of leading zero bits and writes the results to the corresponding 8-bit elements of Rd.

Operations:

snum[x] = Rs1.B[x];
cnt[x] = 0;
for (i = 7 to 0) {
if (snum[x](i) == 0) {
cnt[x] = cnt[x] + 1;
} else {
break;
}
}
Rd.B[x] = cnt[x];
for RV32: x=3...0
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
Returns
value stored in unsigned long type

Definition at line 1058 of file core_feature_dsp.h.

1059 {
1060  unsigned long result;
1061  __ASM volatile("clz8 %0, %1" : "=r"(result) : "r"(a));
1062  return result;
1063 }

References __ASM.

◆ __RV_KABS8()

__STATIC_FORCEINLINE unsigned long __RV_KABS8 ( unsigned long  a)

KABS8 (SIMD 8-bit Saturating Absolute)

Type: SIMD

Syntax:

KABS8 Rd, Rs1

Purpose:
Get the absolute value of 8-bit signed integer elements simultaneously.

Description:
This instruction calculates the absolute value of 8-bit signed integer elements stored in Rs1 and writes the element results to Rd. If the input number is 0x80, this instruction generates 0x7f as the output and sets the OV bit to 1.

Operations:

src = Rs1.B[x];
if (src == 0x80) {
src = 0x7f;
OV = 1;
} else if (src[7] == 1)
src = -src;
}
Rd.B[x] = src;
for RV32: x=3...0,
for RV64: x=7...0
Parameters
[in]aunsigned long type of value stored in a
Returns
value stored in unsigned long type

Definition at line 1414 of file core_feature_dsp.h.

1415 {
1416  unsigned long result;
1417  __ASM volatile("kabs8 %0, %1" : "=r"(result) : "r"(a));
1418  return result;
1419 }

References __ASM.

◆ __RV_SMAX8()

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

SMAX8 (SIMD 8-bit Signed Maximum)

Type: SIMD

Syntax:

SMAX8 Rd, Rs1, Rs2

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

Description:
This instruction compares the 8-bit signed integer elements in Rs1 with the 8-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.B[x] = (Rs1.B[x] > Rs2.B[x])? Rs1.B[x] : Rs2.B[x];
for RV32: x=3...0,
for RV64: x=7...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 8264 of file core_feature_dsp.h.

8265 {
8266  unsigned long result;
8267  __ASM volatile("smax8 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
8268  return result;
8269 }

References __ASM.

◆ __RV_SMIN8()

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

SMIN8 (SIMD 8-bit Signed Minimum)

Type: SIMD

Syntax:

SMIN8 Rd, Rs1, Rs2

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

Description:
This instruction compares the 8-bit signed integer elements in Rs1 with the 8-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.B[x] = (Rs1.B[x] < Rs2.B[x])? Rs1.B[x] : Rs2.B[x];
for RV32: x=3...0,
for RV64: x=7...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 8675 of file core_feature_dsp.h.

8676 {
8677  unsigned long result;
8678  __ASM volatile("smin8 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
8679  return result;
8680 }

References __ASM.

◆ __RV_UMAX8()

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

UMAX8 (SIMD 8-bit Unsigned Maximum)

Type: SIMD

Syntax:

UMAX8 Rd, Rs1, Rs2

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

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

Operations:

Rd.B[x] = (Rs1.B[x] >u Rs2.B[x])? Rs1.B[x] : Rs2.B[x];
for RV32: x=3...0,
for RV64: x=7...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 12339 of file core_feature_dsp.h.

12340 {
12341  unsigned long result;
12342  __ASM volatile("umax8 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
12343  return result;
12344 }

References __ASM.

◆ __RV_UMIN8()

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

UMIN8 (SIMD 8-bit Unsigned Minimum)

Type: SIMD

Syntax:

UMIN8 Rd, Rs1, Rs2

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

Description:
This instruction compares the 8-bit unsigned integer elements in Rs1 with the 8-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.B[x] = (Rs1.B[x] <u Rs2.B[x])? Rs1.B[x] : Rs2.B[x];
for RV32: x=3...0,
for RV64: x=7...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 12417 of file core_feature_dsp.h.

12418 {
12419  unsigned long result;
12420  __ASM volatile("umin8 %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
12421  return result;
12422 }

References __ASM.

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