fcvt.s.w
riscv_unified_db)RV32 / RV64 (Ratified & Standard Extensions)
main
userFSummary
The fcvt.s.w instruction converts a 32-bit signed integer in integer register xs1 into a floating-point number in floating-point register fd.
Syntax / Encoding
fcvt.s.w fd, xs1, rm | 110100000000xxxxxxxxxxxxx1010011 (mask=0xfff0007f match=0xd0000053)
Cross-Chip Latency & Throughput (11 cores)
| Microarchitecture | Latency (cycles) | Recip. TP | uops | Ports | Source |
|---|---|---|---|---|---|
| Tenstorrent Ascalon-X | 1 | 1 | 1 | AscalonFXB | llvm_sched_models |
| Andes 45-Series | 2 | 1 | 1 | Andes45FMISC | llvm_sched_models |
| SiFive P670 / P600 | 2 | 1 | 1 | SiFiveP600MulI2F | llvm_sched_models |
| SiFive P870 / P800 | 2 | 1 | 1 | SiFiveP800I2F | llvm_sched_models |
| SiFive 7-Series (U74) | 3 | 1 | 1 | PipeB | llvm_sched_models |
| SpacemiT X100 | 3 | 0.5 | 1 | SMTX100_FQ1 | llvm_sched_models |
| XiangShan KunMingHu | 3 | 1 | 1 | XSPipeBJU2 | llvm_sched_models |
| XiangShan NanHu | 3 | 0.25 | 1 | XS2FMAC | llvm_sched_models |
| MIPS P8700 (RISC-V) | 4 | 1 | 2 | p8700IssueFPUL+p8700FpuApu | llvm_sched_models |
| SpacemiT X60 (K1) | 4 | 0.5 | 1 | SMX60_IEU | llvm_sched_models |
| Syntacore SCR7 | 4 | 1 | 2 | FPU_IS+FALU | llvm_sched_models |
Binary Encodings (1)
| Width | Format | Bit Pattern | Mask / Match |
|---|---|---|---|
| 32 | RV | 110100000000xxxxxxxxxxxxx1010011 | 0xfff0007f / 0xd0000053 |
Operands
| Name | Description |
|---|---|
xs1 | bits [19:15] |
rm | bits [14:12] |
fd | bits [11:7] |
Reference Notes
The `fcvt.s.w` instruction converts a 32-bit signed integer in integer register `xs1` into a floating-point number in floating-point register `fd`. All floating-point to integer and integer to floating-point conversion instructions round according to the `rm` field. A floating-point register can be initialized to floating-point positive zero using `fcvt.s.w fd, x0`, which will never set any exception flags. All floating-point conversion instructions set the Inexact exception flag if the rounded result differs from the operand value and the Invalid exception flag is not set.