Home/Instructions/VFWSUB-VF
VFWSUB.VF

RISC-V VFWSUB.VF Instruction Details

Instruction ManualOPFVF

Subtract floating-point scalar f[rs1] from narrow vector vs2 and write the 2*SEW result to vd.

Instruction Syntax

vfwsub.vf vd, vs2, rs1, vm
Operand Breakdown
32-bit OP-V: opcode=1010111, funct3=101, funct6=110010. vs2 is a SEW FP source; rs1 selects an SEW FP f register.
Widen narrow sources exactly, compute vs2[i]−f[rs1], then round to 2×SEW using dynamic frm. Destination EEW=2×SEW, EMUL=2×LMUL; EMUL=2/4/8 groups align to their size; EMUL>8 is reserved.
Equal-width destination/source overlap is legal. A narrow source with EMUL≥1 may overlap only the wide destination high end; legal different-EEW overlap forces agnostic policy. One register cannot be read with two source EEWs, including an EEW=1 mask. FLEN>SEW checks NaN-boxing and supplies canonical NaN for an invalid box; FLEN<SEW is reserved.
Omit v0.t for vm=1; include it for vm=0. Prestart stays unchanged; inactive/tail elements follow vma/vta. Undisturbed preserves old values; agnostic may preserve them or write all ones. vl=0 or vstart≥vl updates no destination elements, including tails; successful execution resets vstart=0.
V 1.0 supports RV32/RV64 and depends on F/D. Require supported source/result formats, valid vtype, and enabled VS/FS. Invalid frm use is reserved even at vl=0; vxrm is not used. Active exceptions accrue in fflags, inactive elements raise none, and NaN rules match scalar FP. This finite RNE model shows SEW=32 to binary64 only; NaNs, infinities, and full fflags are outside it.
VVector OperationsFloating-Point

Instruction Behavior

VFWSUB.VF is a RISC-V V widening floating-point subtract instruction. Both inputs are widened to 2*SEW before subtraction. The result is written to 2*SEW vd elements, with floating-point rounding, exception flags, and NaN handling following RVV FP rules.

VFWSUB.VF Decode And Execute Animation

Decode the OP-V encoding and execute lane-wise widening FP subtraction: SEW=32 sources are widened before writing 2*SEW=64 results.

Instruction input
vfwsub.vf
Execution context
LMULm1fixed register-group multiplier
VLEN4096fixed vector-register length (bits)
VLMAX128maximum element count at m1
vstart0prestart elements are outside this animation
frmRNEfinite teaching context fixed at RNE; the architectural instruction uses dynamic frm
FP stateFS enabledFS=Off raises illegal instruction; this animation fixes the architectural state to FS enabled
dest EEW64destination element width
vta/vmata, matail/inactive policy
opcode1010111OP-V major opcode
Encoding fields
0xc8855257
31..26
25
24..20
19..15
14..12
11..7
6..0
110010
funct6
0
vm
01000
vs2
01010
rs1
101
funct3
00100
vd
1010111
OP-V
Execution data path

lane 0: 1 - 1.5 -> -0.5

This lane follows the current-step highlight; the remaining lane results appear below.

Step 1 / 15
Read OP-V encoding fields

V-extension FP instructions use the OP-V major opcode, with funct6, source registers, vm, funct3, vd, and opcode fields.

Lane results
Long vectors scroll inside this module without page overflow.
i=0active
1 - 1.5
-0.5
i=1active
1.5 - 1.5
0
i=2skip
v0.t=0, not executed
--
i=3active
2.5 - 1.5
1
i=4active
-3 - 1.5
-4.5
i=5active
3.5 - 1.5
2
i=6skip
v0.t=0, not executed
--
i=7active
4.5 - 1.5
3
This finite subtraction model fixes SEW=32, LMUL=m1, VLEN=4096, vstart=0, valid vtype, enabled VS/FS, frm=RNE, and ta/ma. vs2 is represented as binary32 and widened exactly; the right source is represented as binary32 and widened exactly before vs2 minus right source rounds to binary64. Destination and wide vs2 use even two-register groups; narrow sources may overlap only the destination high end, and equal narrow sources require equal initial values. FLEN=64 with valid scalar NaN-boxing assumed. VL=0 updates no destination elements, including tails; inactive/tail values have no definite display. NaNs, infinities, overflow, full fflags, and microarchitectural cycles are outside this model; the real instruction uses dynamic frm, with invalid frm use reserved even at VL=0.

Quick Understanding & Search Notes

VFWSUB.VF subtracts f[rs1] from vs2; it is not a reversed subtract.

For .VV/.VF forms, narrow inputs are widened first, and vd elements are 2*SEW wide.
Active subtraction rounds using dynamic frm; invalid frm use is reserved, including at vl=0. vxrm is not used; only active-element FP exceptions accrue in fflags.
Vector FP32/FP64 operations require the corresponding scalar F/D support; half precision is controlled by the relevant vector half-precision extension.
vm=0 uses v0.t; omitting the mask gives vm=1. Prestart stays unchanged; inactive/tail elements follow vma/vta without guaranteed zeros. At vl=0 or vstart≥vl, no destination elements, including tails, update.

Vector Execution Context

32-bit OP-V: opcode=1010111, funct3=101, funct6=110010. vs2 is a SEW FP source; rs1 selects an SEW FP f register.

Widen narrow sources exactly, compute vs2[i]−f[rs1], then round to 2×SEW using dynamic frm. Destination EEW=2×SEW, EMUL=2×LMUL; EMUL=2/4/8 groups align to their size; EMUL>8 is reserved.

Equal-width destination/source overlap is legal. A narrow source with EMUL≥1 may overlap only the wide destination high end; legal different-EEW overlap forces agnostic policy. One register cannot be read with two source EEWs, including an EEW=1 mask. FLEN>SEW checks NaN-boxing and supplies canonical NaN for an invalid box; FLEN<SEW is reserved.

Omit v0.t for vm=1; include it for vm=0. Prestart stays unchanged; inactive/tail elements follow vma/vta. Undisturbed preserves old values; agnostic may preserve them or write all ones. vl=0 or vstart≥vl updates no destination elements, including tails; successful execution resets vstart=0.

V 1.0 supports RV32/RV64 and depends on F/D. Require supported source/result formats, valid vtype, and enabled VS/FS. Invalid frm use is reserved even at vl=0; vxrm is not used. Active exceptions accrue in fflags, inactive elements raise none, and NaN rules match scalar FP. This finite RNE model shows SEW=32 to binary64 only; NaNs, infinities, and full fflags are outside it.

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

Common Usage Scenarios

High-Precision Difference

Assume valid e32,m1, enabled VS/FS, supported formats, VLMAX≥4, and a0=4; vsetvli sets vl=4 and vstart=0. frm=RNE; ft0 is validly NaN-boxed at FLEN=64. Omit v0.t for unmasked execution. v4(binary32)=[2,4,-2,0], ft0=1.5 → v2/v3(binary64)=[0.5,2.5,-3.5,-1.5]. Inactive/tail elements follow ma/ta without guaranteed zeros.

Pre-Use Checklist

Syntax Check
  • 32-bit OP-V: opcode=1010111, funct3=101, funct6=110010. vs2 is a SEW FP source; rs1 selects an SEW FP f register.
  • Widen narrow sources exactly, compute vs2[i]−f[rs1], then round to 2×SEW using dynamic frm. Destination EEW=2×SEW, EMUL=2×LMUL; EMUL=2/4/8 groups align to their size; EMUL>8 is reserved.
Semantic Check
  • Equal-width destination/source overlap is legal. A narrow source with EMUL≥1 may overlap only the wide destination high end; legal different-EEW overlap forces agnostic policy. One register cannot be read with two source EEWs, including an EEW=1 mask. FLEN>SEW checks NaN-boxing and supplies canonical NaN for an invalid box; FLEN<SEW is reserved.
  • Omit v0.t for vm=1; include it for vm=0. Prestart stays unchanged; inactive/tail elements follow vma/vta. Undisturbed preserves old values; agnostic may preserve them or write all ones. vl=0 or vstart≥vl updates no destination elements, including tails; successful execution resets vstart=0.
  • V 1.0 supports RV32/RV64 and depends on F/D. Require supported source/result formats, valid vtype, and enabled VS/FS. Invalid frm use is reserved even at vl=0; vxrm is not used. Active exceptions accrue in fflags, inactive elements raise none, and NaN rules match scalar FP. This finite RNE model shows SEW=32 to binary64 only; NaNs, infinities, and full fflags are outside it.

Pitfalls / Common Confusions

Destination EEW=2×SEW and EMUL=2×LMUL; EMUL=2/4/8 groups align to their size, and EMUL>8 is reserved. A masked destination cannot include v0; narrow-source overlap is allowed only at the destination high end under the specified conditions.
Vector FP32/FP64 operations require matching scalar F/D support; FP16 operation is not implied by V alone.

FAQ

What is the destination width of VFWSUB.VF?

It writes 2*SEW floating-point results, so destination register-group use is based on the widened result.

How does VFWSUB.VF handle masking?

With vm=0, v0 selects active elements; with vm=1, all body elements participate. Inactive and tail elements follow the current policies.