Home/Instructions/VWMACC-VV
VWMACC.VV

RISC-V VWMACC.VV Instruction Details

Instruction ManualR-type

VWMACC.VV reads old 2*SEW vd as an accumulator and adds each active element's 2*SEW widening product.

Instruction Syntax

vwmacc.vv vd, vs1, vs2, vm
Operand Breakdown
vd: destination vector register group.
vs2/vs1 or scalar source: selected by suffixes such as .vv, .vx, .vi, or .vf.
vm: when present, vm=0 uses v0 as the execution mask and vm=1 is unmasked.
VVector OperationsInteger Arithmetic

Instruction Behavior

VWMACC.VV is a RISC-V V extension signed widening vector multiply-accumulate instruction. Each active element reads old 2*SEW vd[i], interprets the SEW-width multiply inputs as signed vs1[i] and signed vs2[i], adds the 2*SEW product, and writes the accumulated result back to vd[i]. With vm=0, only body elements whose v0.t bit is 1 update; masked-off and tail elements follow the current vtype policies.

VWMACC.VV Decode And Execute Animation

Starts from OP-V encoding fields, then shows how VWMACC reads old 2*SEW vd as the accumulator, forms a signed-by-signed product, and writes the accumulated result.

Instruction input
vwmacc.vv
OP-V encodingvwmacc.vv
funct6
111101
vm
0
vs2
01000
vs1
01100
funct3
010
vd
00100
opcode
1010111
lane
0
1
2
3
4
5
6
7
old v4
0xffffffdf
0x00000131
0x00000162
0x00000193
0xffffffcb
0x000001f5
0x00000226
0x00000257
v8
0xfff0
0x0032
0x0043
0xffed
0x0065
0x0076
0xffea
0x0098
acc+w*
acc+w*
acc+w*
acc+w*
acc+w*
acc+w*
acc+w*
acc+w*
v12
0x0005
0xfff7
0x0017
0xfff5
0x0029
0xfff3
0x003b
0xfff1
v0.t
1
0
1
1
1
0
1
1
v4
...
-
...
...
...
-
...
...
Current step

Show OP-V 32-bit encoding fields

vwmacc.vv uses OP-V encoding. The animation places fixed fields, register fields, vm, and the vs1 field in one encoding strip.

This animation shows only ISA-visible relationships from the official V extension: OP-V field decode, active-element reads, 2*SEW widening integer signed widening multiply-accumulate, old vd accumulator, and vd writeback. It does not model pipelines, caches, or timing.

Quick Understanding & Search Notes

VWMACC.VV is a destructive widening multiply-accumulate: vd is first read as a 2*SEW accumulator, then the 2*SEW product from signed vs1[i] and signed vs2[i] is added and written back to vd.

VWMACC.VV uses OP-V multiply/multiply-accumulate class encoding; the vv form is selected by funct3=010.
Each active element performs vd[i] = vd[i] + sign_extend(vs1[i]) * sign_extend(vs2[i]); the result remains 2*SEW wide and is written back to the same vd accumulator.
For the .vv form, both multiply inputs come from SEW-width vector elements, while old vd is the 2*SEW-wide accumulator.
vd is the destructive destination accumulator: the old 2*SEW-wide vd value is read and overwritten. Destination EMUL is twice the source EMUL, and register-group choices must still satisfy the V extension legality rules for widening destinations and overlaps.
Only body elements within current vl are processed; vm=0 uses the v0.t mask, and masked-off plus tail elements follow current vtype policies.

Vector Execution Context

When reading VWMACC.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

Vectorized Loops

Understand this scenario with real code like «vwmacc.vv v8, v4, v12, v0.t # signed widening multiply-accumulate».

Integer Multiply

Understand this scenario with real code like «vwmacc.vv v8, v4, v12, v0.t # signed widening multiply-accumulate».

Multi-Precision Accumulation

Understand this scenario with real code like «vwmacc.vv v8, v4, v12, v0.t # signed widening multiply-accumulate».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • 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

vd is a 2*SEW-wide accumulator; this instruction reads old vd and writes the accumulated result, unlike product-only VWMUL*.
Official .vv syntax is vd, vs1, vs2, vm; the multiply-source order differs from ordinary VWMUL* pages.
The signedness is signed vs1[i] and signed vs2[i]; do not confuse it with other VWMACC/VWMACCU/VWMACCSU/VWMACCUS forms.
With vm=0, masked-off destination elements follow the current mask policy; do not assume fixed zeroing or preserving.

FAQ

How does VWMACC.VV differ from VWMUL*?

VWMACC.VV reads old vd as a 2*SEW accumulator and writes the accumulated result. VWMUL* writes only the full 2*SEW product and does not accumulate old vd.

Does VWMACC.VV always process the whole vector register?

No. V instructions use vl, vtype, vstart, and the optional v0.t mask to determine active elements; inactive elements follow the current tail/mask policy.