ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

mulh

T1 riscv alu insn
Signed multiply high
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 Zmmul, Zkt-DIT
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsZmmul, Zkt-DIT

Summary

Multiply the signed values in xs1 to xs2, and store the upper half of the result in xd. The lower half is thrown away.

Syntax / Encoding

mulh xd, xs1, xs2 | 0000001xxxxxxxxxx001xxxxx0110011 (mask=0xfe00707f match=0x02001033)

Cross-Chip Latency & Throughput (10 cores)

MicroarchitectureLatency (cycles)Recip. TPuopsPortsSource
SiFive P670 / P600211SiFiveP600MulI2Fllvm_sched_models
SiFive P870 / P80020.51SiFiveP800Mulllvm_sched_models
Andes 45-Series311Andes45MDUllvm_sched_models
SiFive 7-Series (U74)311PipeBllvm_sched_models
SpacemiT X10030.51SMTX100_IQ1llvm_sched_models
Tenstorrent Ascalon-X311AscalonFXAllvm_sched_models
XiangShan KunMingHu30.51XSPipeGroupMULllvm_sched_models
XiangShan NanHu30.51XS2MDUllvm_sched_models
MIPS P8700 (RISC-V)411p8700GpMulllvm_sched_models
SpacemiT X60 (K1)60.51SMX60_IEUllvm_sched_models

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV0000001xxxxxxxxxx001xxxxx01100110xfe00707f / 0x02001033

Operands

NameDescription
xs2bits [24:20]
xs1bits [19:15]
xdbits [11:7]

Reference Notes

Multiply the signed values in xs1 to xs2, and store the upper half of the result in xd.
The lower half is thrown away.

If both the upper and lower halves are needed, it suggested to use the sequence:

---
  mulh xdh, xs1, xs2
  mul  xdl, xs1, xs2
---

Microarchitectures may look for that sequence and fuse the operations.