Home/Instructions/VFNCVTBF16-F-F-W
VFNCVTBF16.F.F.W

RISC-V VFNCVTBF16.F.F.W Instruction Details

Instruction ManualR-type

Narrow FP32 vector sources to BF16 using frm rounding.

Instruction Syntax

vfncvtbf16.f.f.w vd, 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.
ZvfbfminVector Operations

Instruction Behavior

VFNCVTBF16.F.F.W, with SEW=16, narrows 32-bit FP32 source elements from vs2 to 16-bit BF16 results in vd. The conversion rounds according to frm and may raise Overflow, Underflow, Inexact, or Invalid; it belongs to Zvfbfmin.

VFNCVTBF16.F.F.W Decode And Execute Animation

Decode the OP-V encoding and execute vector BF16 narrowing conversion: each active lane rounds an FP32 source value to BF16 using frm.

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
vfncvtbf16.f.f.w
Execution context
frm
RNE
demo dynamic rounding mode
source EEW
32
source element width
vta/vma
ta, ma
tail/inactive policy
opcode
1010111
OP-V major opcode
vs1
11101
VFUNARY0 conversion selector
Encoding fields
0x488e9257
31..26
25
24..20
19..15
14..12
11..7
6..0
010010
funct6
0
vm
01000
vs2
11101
vs1/sel
001
funct3
00100
vd
1010111
OP-V
Lane results
Long vectors scroll inside this module without page overflow.
i=0active
bf16_rne(1.5)
0x3fc0 (1.5)
i=1active
bf16_rne(-2.25)
0xc010 (-2.25)
i=2skip
v0.t=0, not executed
--
i=3active
bf16_rne(-4.5)
0xc090 (-4.5)
i=4active
bf16_rne(7.75)
0x40f8 (7.75)
i=5active
bf16_rne(-8.25)
0xc104 (-8.25)
i=6skip
v0.t=0, not executed
--
i=7active
bf16_rne(-31.25)
0xc1fa (-31.25)
SEW=16, source EEW=32 / FP32 -> destination EEW=16 / BF16. The animation uses an RNE demo implementation of BF16 rounding; officially this instruction rounds by frm and may set Overflow, Underflow, Inexact, and Invalid.

Quick Understanding & Search Notes

This is the RVV BF16 FP32-to-BF16 narrowing conversion: the assembly syntax has only vd, vs2, and vm; SEW is fixed to 16, and vs1[19:15]=11101 is a VFUNARY0 selector, not a source register.

OP-V encoding: funct6=010010, vs1/selector=11101, funct3=001 (OPFVV), opcode=1010111.
Official reserved encoding: any SEW value other than 16 is reserved.
Source elements are EEW=32 FP32 and destination elements are EEW=16 BF16; active elements are controlled by vl and v0.t.
The result rounds according to frm, with Overflow, Underflow, Inexact, and Invalid exceptions.
The page animation uses finite FP32 examples and RNE demo rounding; NaN and exception boundaries remain governed by the official manual.

Vector Execution Context

When reading VFNCVTBF16.F.F.W, do not stop at the mnemonic. Official V-extension semantics also depend on the current vl, vtype, and mask state. The suffix and operand form determine whether sources are vector, scalar, or immediate values.

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 Operations

Understand this scenario with real code like «vfncvtbf16.f.f.w v4, v8 # v4[bf16] = bf16(v8[fp32])».

Machine Learning

Understand this scenario with real code like «vfncvtbf16.f.f.w v4, v8 # v4[bf16] = bf16(v8[fp32])».

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

SEW must be 16; other SEW encodings are reserved.
The vs2 source elements have EEW=32 FP32, while vd destination elements have EEW=16 BF16.
Narrowing to BF16 rounds according to frm; it is not just taking the upper 16 FP32 bits.
BF16 has only 7 fraction bits, so the result is much less precise than FP32.
NaN, infinity, overflow, underflow, and exception flags follow the official BF16/FP conversion rules.

FAQ

Do these vector BF16 instructions support any SEW?

No. The official vector BF16 instructions reserve encodings when SEW is not 16; this page animation fixes SEW=16.

Is BF16 the same as IEEE binary16?

No. BF16 has 1 sign bit, 8 exponent bits, and 7 fraction bits; it differs from half-precision binary16 in exponent and fraction widths.

Is VFNCVTBF16.F.F.W just truncating FP32?

No. The official semantics are FP32-to-BF16 narrowing conversion rounded by frm; simple truncation would misrepresent rounding and exception boundaries.