[LLVMdev] returning a double in two registers

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Oct 2 12:37:52 PDT 2006


I have started to add support for FP in the ARM backend.

According to the ABI, 32 bit floating point numbers should be returned
in R0 and 64bit ones in R0/R1.

I have solved the 32 bit case by inserting bit_converts in LowerRET.
For the 64bit case I considered two options:

1) Creating two nodes. fp_lo and fp_hi. I could then select fmrdh and fmrdl with
(set IntRegs:$dst (bitconvert (fp_hi DFPRegs:$src))) and
(set IntRegs:$dst (bitconvert (fp_lo DFPRegs:$src)))

2) Create a node similar to copytoreg that has two results. This has
the advantage that it is possible to select fmrrd.

I am currently trying to implement 2, but I am not sure how to declare
an instruction that has two results. There are some combined mod/rem
instruction like idivl, but they have fixed defs (EAX, EDX).

I have just committed a partial version that doesn't declare fmrrd as
defining its two integer arguments. Currently this is only used during
returns and the function is marked as defining R0 and R1, so this
shouldn't be a problem,

How can I fix the declaration of fmrrd so that it can be used in other contexts?

Thanks,
Rafael



More information about the llvm-dev mailing list