VMSNE.VV

RISC-V VMSNE.VV Instruction Details

Instruction ManualOPIVV

VMSNE.VV performs element-wise not-equal comparison and writes active-element Boolean results to the destination mask.

Instruction Syntax

vmsne.vv vd, vs2, vs1, vm
Operand Breakdown
vd: mask destination register, with one Boolean result bit per element.
vs2/vs1 or scalar source: compared at the current SEW.
vm: vm=0 uses v0 to restrict participating elements, and vm=1 is unmasked.
VVector IntegerCompare

Instruction Behavior

VMSNE.VV is a RISC-V V-extension vector-vector integer predicate-generation instruction. Within the current vl body elements, it compares vs2[i] with vs1[i]; vm=1 lets all body elements participate, while vm=0 processes only elements selected by v0.t. The result is written to vd in mask-register layout, one bit per element index; integer compares do not set floating-point exception flags.

VMSNE.VV Decode And Execute Animation

Starts from OP-V encoding, then shows how integer not equal comparison reads active elements and produces a one-bit-per-element predicate mask.

Instruction input
vmsne.vv
V-format integer compare encoding
31..26
funct6
011001
25
vm
1
24..20
vs2
v8
19..15
vs1
v12
14..12
funct3
000
11..7
vd
v0
6..0
opcode
1010111
lane
0
1
2
3
4
5
6
7
v8
3
2
7
7
0
12
5
9
!=
!=
!=
!=
!=
!=
!=
!=
!=
v12
3
4
6
7
1
8
5
10
active
1
1
1
1
1
1
1
1
v0
-
-
-
-
-
-
-
-

This animation shows only the ISA-visible comparison, execution-mask, and destination-mask writeback relationship; inactive and tail elements are not simulated as fixed data values here.

Quick Understanding & Search Notes

VMSNE.VV does not write an ordinary integer vector; it writes each active element's not-equal comparison result as one bit of the destination mask. The animation starts from OP-V encoding fields, decodes the vector-vector operands, then shows per-lane comparison and vd.mask writeback.

The core semantic relation is vd.mask[i] = (vs2[i] != vs1[i]); only active body elements generate new destination mask bits.
funct3 selects the OPIVV operand form, funct6 selects the not-equal relation, and opcode=1010111 is OP-V.
vs2 and vs1 are interpreted at the current SEW; the comparison result is still a one-bit-per-element mask.
vm=0 uses v0.t to select active elements and vm=1 is unmasked; tail and mask-off elements are not forced to concrete values in the animation.

Vector Execution Context

When reading VMSNE.VV, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. .vv: two vector sources participate element by element.

Check vl first

The current vl determines the number of body elements. Typical code executes vsetvli, vsetivli, or vsetvl before this instruction.

Then check vtype

The current vtype supplies SEW, LMUL, tail policy, and mask policy; these affect element width, register-group size, and inactive/tail destination elements.

Then check vm/v0

For ordinary vector instructions with vm, vm=0 uses v0 as the execution mask and vm=1 is unmasked. A few forms such as VMERGE use v0 as data-selection input.

Official source: RISC-V V Standard Extension for Vector Operations

Common Usage Scenarios

Predicate Generation

Understand this scenario with real code like «vmsne.vv v0, v8, v12 # generate mask bits for a[i] != b[i]».

Conditional Execution

Understand this scenario with real code like «vmsne.vv v0, v8, v12 # generate mask bits for a[i] != b[i]».

Range Check

Understand this scenario with real code like «vmsne.vv v0, v8, v12 # generate mask bits for a[i] != b[i]».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is OPIVV.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

VMSNE.VV writes vd in mask-register layout, producing one predicate bit per element rather than SEW-wide integer results.
vs2 and vs1 are interpreted at the current SEW; signed/unsigned affects only ordering comparisons, not the width of mask results.
With vm=0, only body elements selected by v0.t generate new results; mask-off and tail elements should not be taught as definitely writing zero.

FAQ

What format does VMSNE.VV produce?

The result is written in mask-register layout, one predicate bit per active element, not ordinary SEW-wide vector elements such as 0/1 or 0/-1.

How do vs1 and vs2 participate in the compare?

Each active element reads vs2[i] and vs1[i], then generates one mask bit using this instruction’s signed, unsigned, equality, or inequality relation.

Does vm or v0.t change the comparison relation?

No. vm only selects which body elements are active; active elements still use this instruction-specific comparison relation to generate mask bits.