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

max

T1 riscv alu insn
Maximum
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 Zbb
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsZbb

Summary

Returns the larger of two signed integers.

Syntax / Encoding

max xd, xs1, xs2 | 0000101xxxxxxxxxx110xxxxx0110011 (mask=0xfe00707f match=0x0a006033)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV0000101xxxxxxxxxx110xxxxx01100110xfe00707f / 0x0a006033

Operands

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

Reference Notes

Returns the larger of two signed integers.

.Software Hint
[NOTE]
Calculating the absolute value of a signed integer can be performed using the
following sequence: `neg rD,rS` followed by `max rD,rS,rD. When using this
common sequence, it is suggested that they are scheduled with no intervening
instructions so that implementations that are so optimized can fuse them
together.