VFDIV.VF

RISC-V VFDIV.VF Instruction Details

Instruction ManualR-type

VFDIV.VF is an RVV single-width vector-scalar floating-point divide instruction with syntax vfdiv.vf vd, vs2, rs1, vm; each active element computes vd[i] = vs2[i] / f[rs1].

Instruction Syntax

vfdiv.vf vd, vs2, rs1, 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.
VZvfhVector OperationsFloating-Point

Instruction Behavior

VFDIV.VF divides each active vector element by a floating-point scalar within vl. The scalar source is floating-point register f[rs1], not integer x[rs1]; use VFRDIV.VF for f[rs1] / vs2[i]. Rounding mode, NaNs, infinities, divide-by-zero, and exception flags follow the official RVV floating-point rules.

VFDIV.VF Decode And Execute Animation

Decode the OP-V encoding and execute lane-wise FP division with the second source from scalar f[rs1].

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.

Instruction input
vfdiv.vf
Execution context
frm
RNE
demo dynamic rounding mode
vta/vma
ta, ma
tail/inactive policy
opcode
1010111
OP-V major opcode
Encoding fields
0x80855257
31..26
25
24..20
19..15
14..12
11..7
6..0
100000
funct6
0
vm
01000
vs2
01010
rs1
101
funct3
00100
vd
1010111
OP-V
Lane results
Long vectors scroll inside this module without page overflow.
i=0active
1 / 1.5
0.666666687
i=1active
1.5 / 1.5
1
i=2skip
v0.t=0, not executed
--
i=3active
2.5 / 1.5
1.66666663
i=4active
-3 / 1.5
-2
i=5active
3.5 / 1.5
2.33333325
i=6skip
v0.t=0, not executed
--
i=7active
4.5 / 1.5
3
The animation quantizes source values and results for the current SEW under the RNE demo mode: SEW=32 uses binary32 and SEW=64 uses binary64. NaN, infinity, and exception flags still follow the official RVV FP rules and are not expanded here as a full FP exception simulator.

Quick Understanding & Search Notes

VFDIV.VF divides each vs2[i] by the same FP scalar f[rs1]; it is not reverse division and does not read an integer GPR as the scalar source.

In the OP-V encoding, funct6=100000 and funct3=101 select vector-scalar FP division.
The semantic operation is vd[i] = vs2[i] / f[rs1], with the scalar source from the FP register file.
vm=0 uses v0.t to control active elements; vm=1 is unmasked.
Rounding, NaNs, infinities, divide-by-zero, and fflags follow the official RVV FP rules; vxrm is not involved.
For ordinary masked vector instructions, the destination vector register group must not overlap the v0 mask source; the animation rejects vd=v0 when vm=0.

Vector Execution Context

When reading VFDIV.VF, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. .vf: one vector source and one floating-point 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

Vector normalization

Understand this scenario with real code like «vsetvli t0, a0, e32, m1, ta, ma vfdiv.vf v1, v2, ft0 # v1[i] = v2[i] / ft0».

Scalar scaling

Understand this scenario with real code like «vsetvli t0, a0, e32, m1, ta, ma vfdiv.vf v1, v2, ft0 # v1[i] = v2[i] / ft0».

Numeric computing

Understand this scenario with real code like «vsetvli t0, a0, e32, m1, ta, ma vfdiv.vf v1, v2, ft0 # v1[i] = v2[i] / ft0».

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

Operand order is vs2[i] / f[rs1]; reverse division is vfrdiv.vf.
rs1 names floating-point register f[rs1], not integer register x[rs1].
Divide-by-zero, NaNs, infinities, rounding, and fflags follow the official FP rules.
When vm=0 uses v0.t as the execution mask, the ordinary destination vector register group must not overlap the v0 mask register.

FAQ

What does the vm operand control for VFDIV.VF?

With vm=0, only active elements selected by v0.t execute; vm=1 is unmasked. The page formula is vd[i] = vs2[i] / f[rs1].

Do these vector floating-point instructions use vxrm?

No. Ordinary RVV floating-point operations use the floating-point rounding mode frm and set FP exception flags; vxrm is for fixed-point rounding instructions.

How does VFDIV.VF handle NaNs, infinities, divide-by-zero, or invalid inputs?

Divide-by-zero, 0/0, NaN operands, and infinity inputs are handled by the FP rules. Results, rounding, and fflags follow the official RVV floating-point rules; this page does not simplify them into integer-style fixed results.