Add floating-point register variables to PowerPC ncg.
authorGeorge Koehler <xkernigh@netscape.net>
Thu, 16 Feb 2017 00:34:07 +0000 (19:34 -0500)
committerGeorge Koehler <xkernigh@netscape.net>
Thu, 16 Feb 2017 00:34:07 +0000 (19:34 -0500)
commitcbe5d8640b9b268f5e085b7fd319a5bf8ad8775a
treed9134e07d40350bae8198e69988ffb866f0cfafa
parentcf728c2a2a0155822b95d7c3d16195b1a5733f88
Add floating-point register variables to PowerPC ncg.

Use f14 to f31 as register variables for 8-byte double-precison.
There are no regvars for 4-byte double precision, because all
regvar(reg_float) must have the same size.  I expect more programs to
prefer 8-byte double precision.

Teach mach/powerpc/ncg/mach.c to emit stfd and lfd instructions to
save and restore 8-byte regvars.  Delay emitting the function prolog
until f_regsave(), so we can use one addi to make stack space for both
local vars and saved registers.  Be more careful with types in mach.c;
don't assume that int and long and full are the same.

In ncg table, add f14 to f31 as register variables, and some rules to
use them.  Add rules to put the result of fadd, fsub, fmul, fdiv, fneg
in a regvar.  Without such rules, the result would go in a scratch
FREG, and we would need fmr to move it to the regvar.  Also add a rule
for pat sdl inreg($1)==reg_float with STACK, so we can unstack the
value directly into the regvar, again without a scratch FREG and fmr.

Edit util/ego/descr/powerpc.descr to tell ego about the new float
regvars.  This might not be working right; ego usually decides against
using any float regvars, so ack -O1 (not running ego) uses the
regvars, but ack -O4 (running ego) doesn't use the regvars.

Beware that ack -mosxppc runs ego using powerpc.descr but -mlinuxppc
and -mqemuppc run ego without a config file (since 8ef7c31).  I am
testing powerpc.descr with a local edit to plat/linuxppc/descr to run
ego with powerpc.descr there, but I did not commit my local edit.
mach/powerpc/ncg/mach.c
mach/powerpc/ncg/table
util/ego/descr/powerpc.descr