Home/Instructions/VSM3ME.VV
VSM3ME.VV

RISC-V VSM3ME.VV Instruction Details

Instruction ManualV-type (OP-VE / OPMVV)

Vector SM3 message expansion: generate the next eight message words from the previous sixteen.

Instruction Syntax

vsm3me.vv vd, vs2, vs1

Syntax: vsm3me.vv vd, vs2, vs1; v0–v31 are vector registers; no immediate. Fixed vm=1; no v0.t masking.

32-bit OP-VE: funct6=100000[31:26], vm=1[25], vs2[24:20], vs1[19:15], OPMVV=010[14:12], vd[11:7], opcode=1110111[6:0].

Zvksh depends on Zve32x with SEW=32 only. vs1=W[7:0], vs2=W[15:8]. Byte-swap inputs, use P1, rotates and XORs to generate W[23:16], then byte-swap back into vd; old vd is not an input. Braces run from highest to lowest element index.

EGS=8, EGW=256. vl/vstart not divisible by EGS or unsupported SEW are reserved; LMUL*VLEN<EGW raises illegal-instruction even at vl=0. vd must not overlap vs2. vd=vs1 is allowed. Groups follow LMUL alignment; .vs scalar groups use EMUL=ceil(EGW/VLEN).

Enable vector state with legal supported vtype. Process only active groups with vstart/EGS≤i<vl/EGS; prestart is undisturbed and tails follow vta. vstart≥vl (including vl=0) changes no destination elements. Success resets vstart; nonzero vstart assumes implementation support. Execution latency must be data-independent.

ZvkshVector CryptoSM3

Instruction Behavior

Byte-swap W[7:0] from vs1 and W[15:8] from vs2; expand and byte-swap W[23:16] into vd. SEW=32, EGW=256, EGS=8.

VSM3ME.VV Decode & Execute Animation

This bounded model shows official ISA-visible data flow for one element group; it does not model a cryptographic protocol or microarchitecture.

vsm3me.vv

Fixed vm=1, OP-VE, OPMVV; EGS=8, EGW=256.

Lists below run from low to high element index; only the active group is shown and tu preserves tails. vs1[0..7]=[0,1,2,3,4,5,6,7]; vs2[0..7]=[8,9,10,11,12,13,14,15]. The instruction byte-swaps each input/output word.

funct6=100000vm=1vs2=01000vs1=01100OPMVV=010vd=00100OP-VE=1110111
Execution data path

OP-VE -> funct6 100000 -> vsm3me.vv

result pending

Quick Understanding & Search Notes

VSM3ME.VV is an SM3 vector crypto instruction executed over element groups, not an ordinary independent per-element integer operation.

SM3 uses 256-bit element groups; SM4 uses 128-bit element groups.
The official syntax has no vm operand, so v0.t masking is not added.

Vector Execution Context

Syntax: vsm3me.vv vd, vs2, vs1; v0–v31 are vector registers; no immediate. Fixed vm=1; no v0.t masking.

32-bit OP-VE: funct6=100000[31:26], vm=1[25], vs2[24:20], vs1[19:15], OPMVV=010[14:12], vd[11:7], opcode=1110111[6:0].

Zvksh depends on Zve32x with SEW=32 only. vs1=W[7:0], vs2=W[15:8]. Byte-swap inputs, use P1, rotates and XORs to generate W[23:16], then byte-swap back into vd; old vd is not an input. Braces run from highest to lowest element index.

EGS=8, EGW=256. vl/vstart not divisible by EGS or unsupported SEW are reserved; LMUL*VLEN<EGW raises illegal-instruction even at vl=0. vd must not overlap vs2. vd=vs1 is allowed. Groups follow LMUL alignment; .vs scalar groups use EMUL=ceil(EGW/VLEN).

Enable vector state with legal supported vtype. Process only active groups with vstart/EGS≤i<vl/EGS; prestart is undisturbed and tails follow vta. vstart≥vl (including vl=0) changes no destination elements. Success resets vstart; nonzero vstart assumes implementation support. Execution latency must be data-independent.

The RISC-V Instruction Set Manual, Volume I: Unprivileged Architecture — Version 20260120, Chapter 33

Common Usage Scenarios

Crypto & Security

Enable the listed extension and vector state, with legal vtype, SEW=32, VLEN=256, LMUL=1, vl=8, vstart=0 and tu. Initialize the input groups named in the syntax. Follow the element-group data flow; the animation lists initial values and results. Success resets vstart=0.

Vector Acceleration

Enable the listed extension and vector state, with legal vtype, SEW=32, VLEN=256, LMUL=1, vl=8, vstart=0 and tu. Initialize the input groups named in the syntax. Follow the element-group data flow; the animation lists initial values and results. Success resets vstart=0.

Pre-Use Checklist

Syntax Check
  • Syntax: vsm3me.vv vd, vs2, vs1; v0–v31 are vector registers; no immediate. Fixed vm=1; no v0.t masking.
  • 32-bit OP-VE: funct6=100000[31:26], vm=1[25], vs2[24:20], vs1[19:15], OPMVV=010[14:12], vd[11:7], opcode=1110111[6:0].
Semantic Check
  • Zvksh depends on Zve32x with SEW=32 only. vs1=W[7:0], vs2=W[15:8]. Byte-swap inputs, use P1, rotates and XORs to generate W[23:16], then byte-swap back into vd; old vd is not an input. Braces run from highest to lowest element index.
  • EGS=8, EGW=256. vl/vstart not divisible by EGS or unsupported SEW are reserved; LMUL*VLEN<EGW raises illegal-instruction even at vl=0. vd must not overlap vs2. vd=vs1 is allowed. Groups follow LMUL alignment; .vs scalar groups use EMUL=ceil(EGW/VLEN).
  • Enable vector state with legal supported vtype. Process only active groups with vstart/EGS≤i<vl/EGS; prestart is undisturbed and tails follow vta. vstart≥vl (including vl=0) changes no destination elements. Success resets vstart; nonzero vstart assumes implementation support. Execution latency must be data-independent.

Pitfalls / Common Confusions

There is no vm operand; this element-group crypto instruction is unmasked.
SEW must be 32, and vl/vstart must be multiples of EGS=8.
vd writes W[23:16]; the reserved-overlap rule only prohibits vd overlapping the vs2 register group.

FAQ

Is VSM3ME.VV an element-wise masked operation?

No. It is an element-group crypto instruction and the official syntax has no vm.

What vtype restriction matters for VSM3ME.VV?

SEW must be 32 and LMUL*VLEN must cover a 256-bit element group.