PPro conditional move problem

H.J. Lu hjl@lucon.org
Fri Jun 5 09:20:00 GMT 1998


Hi,

I took a look at the PPro FP conditional move. Whoever designed it
assumed we only use it in

	double x, y;

	if (y > 0.0)
	  x = 1.0;

It won't work with

	double x;
	int y;

	if (y > 0)
	  x = 1.0;

since no FP conditional move insn checks sign or overflow bit in CC.
It is kind of braindead. Anyway, I think we can change all non-FP CC
setting insns to

[(parallel [(set (cc0)
		 ..............
	    (clobber (match_scratch:HI 1 ""))])]


[(set (cc0)
      ......
 (clobber (match_scratch:HI 3 "=a"))]

When we output the CC setting insn, we check if the next cc user is the
FP conditional move. If yes and code is LT/GE/GT/LE, we emit a pproper

	setxx	%ax

before the FP conditional move and emit an corresponding

	fmovxx xx,xx

for the FP conditional move. output_fp_conditional_move () will tell
final_scan_insn to restore the test insn for LT/GE/GT/LE.

Is this reasonable? If yes, I will try to implement it this weekend.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)



More information about the Gcc-patches mailing list