4.[12] Vax pcc generates bad code for real comparisons

Chris Maltby chris at basser.SUN
Sat Apr 7 05:48:25 AEST 1984


x - marks the spot

Here is a better fix to pcc for the problem described by Jeff of
DEC western research labs.  The real code generation problem is
that the result of the cvtfd instruction can't be shared with
its 'float' source. Of course, the double intermediate value
needs 2 AREGS.

In fact, the second table entry is unnecessary, as there is a rewrite
rule which will convert the left operand to double (correctly) and
then compare it.  I leave it here mostly to keep the linenumbers right
(and in case I overlooked something).

====== "table.c" line 228 - 238
    OPLOG,	FORCC,
	    SAREG|AWD,	TDOUBLE,
	    SAREG|AWD,	TFLOAT,
-		    NAREG|NASR,	RESCC,
		    "	cvtfd	AR,A1\n	cmpd	AL,A1\nZP",

    OPLOG,	FORCC,
	    SAREG|AWD,	TFLOAT,
	    SAREG|AWD,	TDOUBLE,
-		    NAREG|NASL,	RESCC,
		    "	cvtfd	AL,A1\n	cmpd	A1,AR\nZP",
======
    OPLOG,	FORCC,
	    SAREG|AWD,	TDOUBLE,
	    SAREG|AWD,	TFLOAT,
+		    2*NAREG,	RESCC,
		    "	cvtfd	AR,A1\n	cmpd	AL,A1\nZP",

    OPLOG,	FORCC,
	    SAREG|AWD,	TFLOAT,
	    SAREG|AWD,	TDOUBLE,
+		    2*NAREG,	RESCC,
		    "	cvtfd	AL,A1\n	cmpd	A1,AR\nZP",
======



More information about the Comp.bugs.4bsd.ucb-fixes mailing list