mul
riscv_unified_db)RV32 / RV64 (Ratified & Standard Extensions)
main
userZmmul, Zkt-DITSummary
MUL performs an XLEN-bitxXLEN-bit multiplication of xs1 by xs2 and places the lower XLEN bits in the destination register. Any overflow is thrown away.
Syntax / Encoding
mul xd, xs1, xs2 | 0000001xxxxxxxxxx000xxxxx0110011 (mask=0xfe00707f match=0x02000033)
Cross-Chip Latency & Throughput (20 cores)
| Microarchitecture | Latency (cycles) | Recip. TP | uops | Ports | Source |
|---|---|---|---|---|---|
| Andes AX45MPV | — | 1.27 | — | RVV 1.0, VLEN=512 | rvv_bench_timings |
| SiFive X280 | — | 1.65 | — | RVV 1.0, VLEN=512 (Tenstorrent Blackhole) | rvv_bench_timings |
| SpacemiT X100 | — | 1.5 | — | RVV 1.0, VLEN=256 | rvv_bench_timings |
| SpacemiT X60 | — | 3.5 | — | RVV 1.0, VLEN=256 | rvv_bench_timings |
| Tenstorrent Ascalon-X | — | 1.5 | — | RVV 1.0, VLEN=256 | rvv_bench_timings |
| XuanTie C906 | — | 4 | — | RVV 0.7.1, VLEN=128 (Allwinner D1) | rvv_bench_timings |
| XuanTie C908 | — | 2.5 | — | RVV 1.0, VLEN=128 (Kendryte K230) | rvv_bench_timings |
| XuanTie C910 | — | 1 | — | RVV 0.7.1, VLEN=128 (TH1520) | rvv_bench_timings |
| XuanTie C920 (SG2042) | — | 1 | — | RVV 0.7.1, VLEN=128 (Milk-V Pioneer) | rvv_bench_timings |
| XuanTie C920v2 | — | 1.75 | — | RVV 1.0, VLEN=128 | rvv_bench_timings |
| SiFive P670 / P600 | 2 | 1 | 1 | SiFiveP600MulI2F | llvm_sched_models |
| SiFive P870 / P800 | 2 | 0.5 | 1 | SiFiveP800Mul | llvm_sched_models |
| Andes 45-Series | 3 | 1 | 1 | Andes45MDU | llvm_sched_models |
| SiFive 7-Series (U74) | 3 | 1 | 1 | PipeB | llvm_sched_models |
| SpacemiT X100 | 3 | 0.5 | 1 | SMTX100_IQ1 | llvm_sched_models |
| Tenstorrent Ascalon-X | 3 | 1 | 1 | AscalonFXA | llvm_sched_models |
| XiangShan KunMingHu | 3 | 0.5 | 1 | XSPipeGroupMUL | llvm_sched_models |
| XiangShan NanHu | 3 | 0.5 | 1 | XS2MDU | llvm_sched_models |
| MIPS P8700 (RISC-V) | 4 | 1 | 1 | p8700GpMul | 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 | 0000001xxxxxxxxxx000xxxxx0110011 | 0xfe00707f / 0x02000033 |
Operands
| Name | Description |
|---|---|
xs2 | bits [24:20] |
xs1 | bits [19:15] |
xd | bits [11:7] |
Reference Notes
MUL performs an XLEN-bitxXLEN-bit multiplication of `xs1` by `xs2` and places the lower XLEN bits in the destination register. Any overflow is thrown away. [NOTE] If both the high and low bits of the same product are required, then the recommended code sequence is: MULH[[S]U] xdh, xs1, xs2; MUL xdl, xs1, xs2 (source register specifiers must be in same order and xdh cannot be the same as xs1 or xs2). Microarchitectures can then fuse these into a single multiply operation instead of performing two separate multiplies.