| 101 | `maxuw RT,RA,RB` | `RT = (uint32_t)RA > (uint32_t)RB ? RA : RB` |
| 110 | `minsw RT,RA,RB` | `RT = (int32_t)RA < (int32_t)RB ? RA : RB` |
| 111 | `maxsw RT,RA,RB` | `RT = (int32_t)RA > (int32_t)RB ? RA : RB` |
-
-## Minimum Unsigned
-X-Form
+## Integer Min/Max MM-Form
-```
- |0 |6 |11 |16 |21 |31 |
- | PO | RT | RA | RB | XO | Rc |
-```
-
-* minu RT, RA, RB
-* minu. RT, RA, RB
-
-
-```
- if (RA) <u (RB) then
- RT <- (RA)
- else
- RT <- (RB)
-```
-
-Special Registers altered:
-
-```
- CR0 (if Rc=1)
-```
-
-Compute the unsigned minimum of RA and RB and store the result in RT.
-
-## Maximum Unsigned
-
-X-Form
-
-```
- maxu RT, RA, RB
- maxu. RT, RA, RB
-```
-
-```
- |0 |6 |11 |16 |21 |31 |
- | PO | RT | RA | RB | XO | Rc |
-```
-
-```
- if (RA) >u (RB) then
- RT <- (RA)
- else
- RT <- (RB)
-```
-
-Special Registers altered:
-
-```
- CR0 (if Rc=1)
-```
-
-Compute the unsigned maximum of RA and RB and store the result in RT.
-
-\newpage{}
-
-## Minimum
-
-X-Form
-
-```
- min RT, RA, RB
- min. RT, RA, RB
-```
-
-```
- |0 |6 |11 |16 |21 |31 |
- | PO | RT | RA | RB | XO | Rc |
-```
-
-```
- if (RA) < (RB) then
- RT <- (RA)
- else
- RT <- (RB)
-```
-
-Special Registers altered:
-
-```
- CR0 (if Rc=1)
-```
-Compute the signed minimum of RA and RB and store the result in RT.
-
-## Maximum
-
-X-Form
-
-```
- max RT, RA, RB
- max. RT, RA, RB
-```
+* minmax RT, RA, RB, MMM
+* minmax. RT, RA, RB, MMM
```
- |0 |6 |11 |16 |21 |31 |
- | PO | RT | RA | RB | XO | Rc |
+ |0 |6 |11 |16 |21 |24 |25 |31 |
+ | PO | RT | RA | RB | MMM | / | XO | Rc |
```
```
- if (RA) > (RB) then
+ a <- (RA)
+ b <- (RB)
+ if MMM[0] then # word mode
+ # shift left by XLEN/2 to make the dword comparison
+ # do word comparison of the original inputs
+ a <- a[XLEN/2:XLEN-1] || [0] * XLEN/2
+ b <- b[XLEN/2:XLEN-1] || [0] * XLEN/2
+ if MMM[1] then # signed mode
+ # invert sign bits to make the unsigned comparison
+ # do signed comparison of the original inputs
+ a[0] <- !a[0] # convert
+ b[0] <- !b[0]
+ if MMM[2] then # max mode
+ # swap a and b to make the less than comparison do
+ # greater than comparison of the original inputs
+ t <- a
+ a <- b
+ b <- t
+ if a <u b then
RT <- (RA)
else
RT <- (RB)
```
-Compute the signed maximum of RA and RB and store the result in RT.
+Compute the integer minimum/maximum according to `MMM` of `RA` and `RB` and
+store the result in `RT`.
Special Registers altered: