Re: [RFA/alpha] Add handling of FP control insn in software-single step

Richard Henderson
2005-05-17T06:22:39Z

On Tue, May 17, 2005 at 12:34:00PM +1000, Joel Brobecker wrote:
> +fp_register_zero_p (char *buf)
> +{
> + return ((buf[1] & 0x0f) == 0 && buf[2] == 0 && buf[3] == 0
> + && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0);
> +}
...
> + case 0x31: /* FBEQ */
> + if (fp_register_zero_p (reg))
> + goto branch_taken;
> + break;
> + case 0x36: /* FBGE */
> + if (fp_register_sign_bit (reg) == 0 || fp_register_zero_p (reg))
> + goto branch_taken;
> + break;
> + case 0x37: /* FBGT */
> + if (fp_register_sign_bit (reg) == 0 && ! fp_register_zero_p (reg))
> + goto branch_taken;
> + break;
> + case 0x33: /* FBLE */
> + if (fp_register_sign_bit (reg) == 1 || fp_register_zero_p (reg))
> + goto branch_taken;
> + break;
> + case 0x32: /* FBLT */
> + if (fp_register_sign_bit (reg) == 1 && ! fp_register_zero_p (reg))
> + goto branch_taken;
> + break;
> + case 0x35: /* FBNE */
> + if (! fp_register_zero_p (reg))
> + goto branch_taken;
> + break;

NACK. Why are you ignoring the entire exponent? These are not the
operations that fp branches perform. The tests are:

zero (reg & 0x7fff_ffff_ffff_ffff) == 0
sign (reg & 0x8000_0000_0000_0000) != 0

fbeq zero
fbne !zero
fbge !sign || zero
fbgt !sign && !zero
fble sign || zero
fblt sign && !zero

This is a nearly normal integer test, except for the special case
of 0x8000_0000_0000_0000, i.e. -0.0, which is treated as zero.

r~