On 01/12/2017 08:24 AM, Nikunj A Dadhania wrote:
> + nan = tp##_is_any_nan(xb.fld); \
> + infinity = tp##_is_infinity(xb.fld); \
> + sign = tp##_is_neg(xb.fld); \
> + zero = denormal = 0; \
> + if (tp##_is_zero_or_denormal(xb.fld)) { \
> + if (tp##_is_zero(xb.fld)) { \
> + zero = 1; \
> + } else { \
> + denormal = 1; \
> + } \
> + } \
> + \
> + if ((extract32(dcmx, 6, 1) && nan) || \
> + (extract32(dcmx, 5, 1) && infinity && !sign) || \
> + (extract32(dcmx, 4, 1) && infinity && sign) || \
> + (extract32(dcmx, 3, 1) && zero && !sign) || \
> + (extract32(dcmx, 3, 1) && zero && sign) || \
> + (extract32(dcmx, 1, 1) && denormal && !sign) || \
> + (extract32(dcmx, 0, 1) && denormal && sign)) { \
> + match = 1; \
> + } \
I'll note that all of these are mutually exclusive, therefore you're doing much
more work than required.
sign = tp##_is_neg(x));
if (tp##is_any_nan(x)) {
match = extract32(dcmx, 6, 1);
} else if (tp##_is_infinity(x)) {
match = extract32(dcmx, 4 + !sign, 1);
} else if (tp##_is_zero(x)) {
match = extract32(dcmx, 2 + !sign, 1);
} else if (tp##_is_zero_or_denormal(x)) {
match = extract32(dcmx, 0 + !sign, 1);
}
(Also, an apparent typo for your zero && sign case.)
r~