Clamping (Limit) Functions
Although not specified in any IEEE 754 standard, the ISA supports a clamping (or limit) instruction (FFLIM) intended for use where an input operand needs to be constrained between an upper and lower limit. It serves a similar purpose to the integer equivalent FLIM instruction and is essentially a concurrent execution of FMIN and FMAX operations with a common operand. Refer to the truth table shown in Table 4-12 for a definition of how NaN operands are handled.
Any finite operand value will compare as less than +infinity or greater than -infinity. An operand value of -0 compares to less than +0.
For FFLIM operations, when both upper and lower limits are either both qNaN or both sNaN values, a NaN significant comparison is not required, and the Fb NaN will be the default source for the result. This differs from how coincident NaN values are treated in general.
| Fb(3) (Lower Limit) | Fs(3) (Upper Limit) | Fd (Input Value) | Invalid Exception Mask | Fd (Result) | FSR.INVAL | Exception Taken? |
|---|---|---|---|---|---|---|
| FPNL(1) | FPNU | FPN | Don’t care | FPNL or FPNU or FPN(2) or Distinguished qNaN(3) | 0 | No |
| FPNL | qNaN_U | FPN | Don’t care | qNaN_U | 0 | No |
| FPNL | sNaN_U | FPN | 1 | Quieted sNaN_U | 1 | No |
| 0 | Yes | |||||
| qNaN_L | FPNU | FPN | Don’t care | qNaN_L | 0 | No |
| sNaN_L | FPNU | FPN | 1 | Quieted sNaN_L | 1 | No |
| 0 | Yes | |||||
| sNaN_L | sNaN_U | FPN | 1 | Quieted sNaN_L(5) | 1 | No |
| 0 | Yes | |||||
| sNaN_L | qNaN_U | FPN | 1 | qNaN_U(6) | 1 | No |
| 0 | Yes | |||||
| qNaN_L | sNaN_U | FPN | 1 | qNaN_L(6) | 1 | No |
| 0 | Yes | |||||
| qNaN_L | qNaN_U | FPN | Don’t care | qNaN_L(5) | 0 | No |
| Don’t care | Don’t care | sNaN | 1 | Quieted sNaN(7) | 1 | No |
| 0 | Yes | |||||
| Don’t care | Don’t care | qNaN | Don’t care | qNaN | 0 | No |
|
Note:
| ||||||
