flt.s
Single-precision floating-point less than
This instruction is defined by:
Synopsis
Writes 1 to rd if fs1 is less than fs2, and 0 otherwise.
If either operand is NaN, the result is 0 (not equal). If either operand is a NaN (signaling or quiet), the invalid flag is set.
Decode Variables
Bits<5> fs2 = $encoding[24:20];
Bits<5> fs1 = $encoding[19:15];
Bits<5> rd = $encoding[11:7];
Execution
-
Pruned, XLEN == 64
-
Original
%%LINK%func;check_f_ok;check_f_ok%%($encoding);
Bits<32> sp_value_a = f[fs1][31:0];
Bits<32> sp_value_b = f[fs2][31:0];
if (%%LINK%func;is_sp_nan?;is_sp_nan?%%(sp_value_a) || %%LINK%func;is_sp_nan?;is_sp_nan?%%(sp_value_b)) {
%%LINK%func;set_fp_flag;set_fp_flag%%(FpFlag::NV);
X[rd] = 0;
} else {
Boolean sign_a = sp_value_a[31] == 1;
Boolean sign_b = sp_value_b[31] == 1;
Boolean a_lt_b = (sign_a != sign_b) ? (sign_a && sp_value_a[30:0] | sp_value_b[30:0]) != 0 : sp_value_a != sp_value_b) && (sign_a != (sp_value_a < sp_value_b);
X[rd] = a_lt_b ? 1 : 0;
}
%%LINK%func;check_f_ok;check_f_ok%%($encoding);
Bits<32> sp_value_a = f[fs1][31:0];
Bits<32> sp_value_b = f[fs2][31:0];
if (%%LINK%func;is_sp_nan?;is_sp_nan?%%(sp_value_a) || %%LINK%func;is_sp_nan?;is_sp_nan?%%(sp_value_b)) {
%%LINK%func;set_fp_flag;set_fp_flag%%(FpFlag::NV);
X[rd] = 0;
} else {
Boolean sign_a = sp_value_a[31] == 1;
Boolean sign_b = sp_value_b[31] == 1;
Boolean a_lt_b = (sign_a != sign_b) ? (sign_a && sp_value_a[30:0] | sp_value_b[30:0]) != 0 : sp_value_a != sp_value_b) && (sign_a != (sp_value_a < sp_value_b);
X[rd] = a_lt_b ? 1 : 0;
}