Home/Instructions/VWMACC-VX
VWMACC.VX

RISC-V VWMACC.VX Instruction Details

Instruction ManualR-type

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

Instruction Syntax

vwmacc.vx vd, rs1, 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.VX is a RISC-V V extension signed widening scalar-vector multiply-accumulate instruction. Each active element reads old 2*SEW vd[i], interprets the SEW-width multiply inputs as signed x[rs1] 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.VX 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.vx
OP-V encodingvwmacc.vx
funct6
111101
vm
0
vs2
01000
rs1
01011
funct3
110
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*
x11
0x0013
0x0013
0x0013
0x0013
0x0013
0x0013
0x0013
0x0013
v0.t
1
0
1
1
1
0
1
1
v4
...
-
...
...
...
-
...
...
Current step

Show OP-V 32-bit encoding fields

vwmacc.vx uses OP-V encoding. The animation places fixed fields, register fields, vm, and the rs1 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.VX is a destructive widening multiply-accumulate: vd is first read as a 2*SEW accumulator, then the 2*SEW product from signed x[rs1] and signed vs2[i] is added and written back to vd.

VWMACC.VX uses OP-V multiply/multiply-accumulate class encoding; the vx form is selected by funct3=110.
Each active element performs vd[i] = vd[i] + sign_extend(sew_scalar(x[rs1])) * sign_extend(vs2[i]); the result remains 2*SEW wide and is written back to the same vd accumulator.
For the .vx form, x[rs1] is first converted to a SEW-width element by the official .vx scalar rule: if XLEN>SEW, use the low SEW bits; if XLEN<SEW, sign-extend to SEW.
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.VX, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. .vx: one vector source and one integer scalar source participate.

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.vx v8, x5, v12, v0.t # signed scalar widening multiply-accumulate».

Integer Multiply

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

Multi-Precision Accumulation

Understand this scenario with real code like «vwmacc.vx v8, x5, v12, v0.t # signed scalar 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 .vx syntax is vd, rs1, vs2, vm; rs1 appears before vs2.
The signedness is signed x[rs1] 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.VX differ from VWMUL*?

VWMACC.VX 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.VX 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.