fcvt.wu.s
riscv_unified_db)RV32 / RV64 (Ratified & Standard Extensions)
main
userFSummary
Converts a floating-point number in floating-point register fs1 to an unsigned 32-bit integer in integer register xd. For XLEN >32, fcvt.wu.s sign-extends the 32-bit result to the destination register width.
Syntax / Encoding
fcvt.wu.s xd, fs1, rm | 110000000001xxxxxxxxxxxxx1010011 (mask=0xfff0007f match=0xc0100053)
Cross-Chip Latency & Throughput (11 cores)
| Microarchitecture | Latency (cycles) | Recip. TP | uops | Ports | Source |
|---|---|---|---|---|---|
| Tenstorrent Ascalon-X | 1 | 1 | 1 | AscalonFXA | llvm_sched_models |
| Andes 45-Series | 2 | 1 | 1 | Andes45FMISC | llvm_sched_models |
| SiFive P670 / P600 | 2 | 1 | 1 | SiFiveP600F2I | llvm_sched_models |
| SiFive P870 / P800 | 2 | 1 | 1 | SiFiveP800F2I | 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 | XSPipeFEX0 | 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 |
| Syntacore SCR7 | 4 | 1 | 2 | FPU_IS+FALU | llvm_sched_models |
| SpacemiT X60 (K1) | 6 | 0.5 | 1 | SMX60_IEU | llvm_sched_models |
Binary Encodings (1)
| Width | Format | Bit Pattern | Mask / Match |
|---|---|---|---|
| 32 | RV | 110000000001xxxxxxxxxxxxx1010011 | 0xfff0007f / 0xc0100053 |
Operands
| Name | Description |
|---|---|
fs1 | bits [19:15] |
rm | bits [14:12] |
xd | bits [11:7] |
Reference Notes
Converts a floating-point number in floating-point register `fs1` to an unsigned 32-bit integer in integer register `xd`. For XLEN >32, `fcvt.wu.s` sign-extends the 32-bit result to the destination register width. If the rounded result is not representable as a 32-bit unsigned integer, it is clipped to the nearest value and the invalid flag is set. The range of valid inputs and behavior for invalid inputs are: [separator="!"] !=== ! ! Value h! Minimum valid input (after rounding) ! `0` h! Maximum valid input (after rounding) ! `2^32 - 1` h! Output for out-of-range negative input ! `0` h! Output for `-∞` ! `0` h! Output for out-of-range positive input ! `2^32 - 1` h! Output for `+∞` for `NaN` ! `2^32 - 1` !=== 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 xd, 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.