VMULH.VX

RISC-V VMULH.VX Instruction Details

Instruction ManualV-type

VMULH.VX forms each active element's 2*SEW integer product and writes the product's high SEW bits.

Instruction Syntax

vmulh.vx vd, vs2, rs1[, v0.t]
Operand Breakdown
Syntax: vmulh.vx vd, vs2, rs1[, v0.t]. 32-bit OP-V: opcode=1010111, funct3=110, funct6=100111.
vd receives SEW-bit integer vector elements, not comparison-mask bits; vs2 supplies SEW-bit vector elements. rs1 selects an integer x register: use low SEW bits when XLEN>SEW, or sign-extend when XLEN<SEW; x0 supplies zero.
Treat both sources as signed; write the high SEW bits of the 2×SEW product. This is not multiply-accumulate, and does not round under vxrm or saturate.
Active elements satisfy vstart≤i<vl and either vm=1 or v0.mask[i]=1. Prestart is preserved; vma/vta govern inactive/tail preservation or permitted all-ones values. vstart≥vl (including vl=0) updates no destination elements.
Same-width source/destination overlap is legal. EEW=SEW and EMUL=LMUL; EMUL=2/4/8 groups align to their size. An ordinary masked vd cannot include v0, and v0 cannot supply both an EEW=1 mask and SEW data. Require the extension, valid supported vtype, and non-Off mstatus.VS; with H and virtualization V=1, vsstatus.VS must also be non-Off. The animation fixes LMUL=m1, VLEN=4096 and vstart=0, showing body elements only; steps are not processor cycles.
VVector IntegerMultiply

Instruction Behavior

VMULH.VX is a RISC-V V extension single-width integer vector-scalar multiply instruction. Each active element reads vs2 and the second source from integer scalar register rs1, forms a 2*SEW product, and writes the high SEW bits to vd. Both source operands are interpreted as signed; with vm=0, only body elements whose v0.t bit is 1 are processed, while masked-off and tail elements follow the current vtype policies.

VMULH.VX Decode And Execute Animation

Starts from OP-V encoding fields, then shows how VMULH forms a 2*SEW product and writes the signed-by-signed high SEW bits to vd.

Instruction input
vmulh.vx

Require valid vtype, enabled VS, and supported SEW; VL=0 updates nothing, including tails. An ordinary masked vd cannot be v0; v0 cannot supply both mask and SEW data. Same-width source/destination overlap is legal. Steps are teaching stages, not processor cycles.

Execution Context

The teaching model fixes LMUL=m1 and vstart=0 and shows only body elements in the selected VL. It fixes VLEN=4096, VLMAX=4096/16=256, and assumes support for the selected SEW; equal vector sources require equal elements. In ordinary masked forms, inactive and tail elements follow vtype.vma/vta and the result row does not invent a definite value; VADC/VMADC/VSBC/VMSBC execute every body element, with v0 bits used only as carry/borrow-in.

OP-V encodingvmulh.vx
funct6
100111
vm
0
vs2
01000
rs1
01011
funct3
110
vd
00100
opcode
1010111
lane
0
1
2
3
4
5
6
7
v8
0xfff0
0x0032
0x0043
0xffed
0x0065
0x0076
0xffea
0x0098
*
*
*
*
*
*
*
*
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

vmulh.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, the high half of a 2*SEW product integer signed high-half multiplication, mask control, and vd writeback. It does not model pipelines, caches, or timing.

Quick Understanding & Search Notes

VMULH.VX does not write a full widening product. It forms a 2*SEW product for active elements within the current vl and writes only the high SEW bits to vd; the second source comes from integer scalar register rs1, and both source operands are interpreted as signed.

VMULH.VX uses OP-V multiply-class encoding; the .vx form is selected by funct3=110, and funct6=100111 selects VMULH.
Each active element first forms a 2*SEW product and then writes the high SEW bits; vd remains an SEW-width ordinary vector destination, not a 2*SEW widening destination.
rs1 selects an integer x register: use its low SEW bits when XLEN>SEW; sign-extend to SEW when XLEN<SEW. x0/zero always supplies zero.
Both source operands are interpreted as signed.
Active elements satisfy vstart ≤ i < vl and either vm=1 or v0.mask[i]=1. Prestart elements are unchanged; vma/vta govern inactive/tail preservation or permitted all-ones values. If vstart≥vl (including vl=0), no destination elements change.
32-bit OP-V (opcode=1010111); vd, vs2 and .vv vs1 use EEW=SEW and EMUL=LMUL. Same-width source/destination overlap is legal; EMUL=2/4/8 groups align to their size. A masked destination cannot include v0, and v0 cannot supply both the EEW=1 mask and SEW data.
Require the extension, supported SEW/LMUL, vill=0, and enabled mstatus.VS; with H and virtualization V=1, vsstatus.VS must also be non-Off.
This is not multiply-accumulate or rounding/saturating multiplication. VMULH* does not round under vxrm, add scaling, or saturate.

Vector Execution Context

Syntax: vmulh.vx vd, vs2, rs1[, v0.t]. 32-bit OP-V: opcode=1010111, funct3=110, funct6=100111.

vd receives SEW-bit integer vector elements, not comparison-mask bits; vs2 supplies SEW-bit vector elements. rs1 selects an integer x register: use low SEW bits when XLEN>SEW, or sign-extend when XLEN<SEW; x0 supplies zero.

Treat both sources as signed; write the high SEW bits of the 2×SEW product. This is not multiply-accumulate, and does not round under vxrm or saturate.

Active elements satisfy vstart≤i<vl and either vm=1 or v0.mask[i]=1. Prestart is preserved; vma/vta govern inactive/tail preservation or permitted all-ones values. vstart≥vl (including vl=0) updates no destination elements.

Same-width source/destination overlap is legal. EEW=SEW and EMUL=LMUL; EMUL=2/4/8 groups align to their size. An ordinary masked vd cannot include v0, and v0 cannot supply both an EEW=1 mask and SEW data. Require the extension, valid supported vtype, and non-Off mstatus.VS; with H and virtualization V=1, vsstatus.VS must also be non-Off. The animation fixes LMUL=m1, VLEN=4096 and vstart=0, showing body elements only; steps are not processor cycles.

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

Common Usage Scenarios

Fixed-Point

Assume enabled V/VS, valid e8,m1, VLEN≥128, vl=4, vstart=0, ta/ma and initialized sources; the example uses v0.t. v8=[0xff,2,0x80,7], x11=3, v0.mask[0..3]=[1,0,1,1] → v4=[0xff,policy,0xfe,0x00]. Both sources are signed and the high 8 bits are written. policy retains the old value or writes all ones; tails are not guaranteed zero.

Fractional

Assume enabled V/VS, valid e8,m1, VLEN≥128, vl=4, vstart=0, ta/ma and initialized sources; the example uses v0.t. v8=[0xff,2,0x80,7], x11=3, v0.mask[0..3]=[1,0,1,1] → v4=[0xff,policy,0xfe,0x00]. Both sources are signed and the high 8 bits are written. policy retains the old value or writes all ones; tails are not guaranteed zero.

Pre-Use Checklist

Syntax Check
  • Syntax: vmulh.vx vd, vs2, rs1[, v0.t]. 32-bit OP-V: opcode=1010111, funct3=110, funct6=100111.
  • vd receives SEW-bit integer vector elements, not comparison-mask bits; vs2 supplies SEW-bit vector elements. rs1 selects an integer x register: use low SEW bits when XLEN>SEW, or sign-extend when XLEN<SEW; x0 supplies zero.
Semantic Check
  • Treat both sources as signed; write the high SEW bits of the 2×SEW product. This is not multiply-accumulate, and does not round under vxrm or saturate.
  • Active elements satisfy vstart≤i<vl and either vm=1 or v0.mask[i]=1. Prestart is preserved; vma/vta govern inactive/tail preservation or permitted all-ones values. vstart≥vl (including vl=0) updates no destination elements.
  • Same-width source/destination overlap is legal. EEW=SEW and EMUL=LMUL; EMUL=2/4/8 groups align to their size. An ordinary masked vd cannot include v0, and v0 cannot supply both an EEW=1 mask and SEW data. Require the extension, valid supported vtype, and non-Off mstatus.VS; with H and virtualization V=1, vsstatus.VS must also be non-Off. The animation fixes LMUL=m1, VLEN=4096 and vstart=0, showing body elements only; steps are not processor cycles.

Pitfalls / Common Confusions

VMULH.VX writes the high SEW bits, not the low half; use VMUL for low-half multiplication.
both source operands are interpreted as signed; do not mix up the signedness combinations of VMULH, VMULHU, and VMULHSU.
With vm=0, v0.t is the execution mask; the destination value for masked-off elements is controlled by the current vtype.vma policy.
These instructions are not multiply-accumulate operations and do not read old vd as an accumulator; use VMACC/VWMACC-family instructions for accumulation.

FAQ

How does VMULH.VX differ from VWMUL*?

VMULH.VX writes only the high SEW bits to an SEW-width vd. VWMUL* writes the full 2*SEW widening product.

Does VMULH.VX read old vd for accumulation?

No. This instruction writes only the selected high SEW bits from the current multiply; use VMACC/VWMACC-family multiply-accumulate instructions when accumulation is required.