For a LLVM code target, I am developing a software-supported floating-point engine. I’ve come into a few issues in which the DAG conversion is
Can anyone help with:
I have some C code test like:
float x;
printf(“%f”, x);
which clang coverts to:
%0 = load float* @x, align 4
%conv = fpext float %0 to double
The issue is for simple Float to Double extension, the DAGCombiner.cpp
DAGCombiner::visitFP_EXTEND(SDNode *N) is making a decision to do a load extension, and it translates into doing a simple double load. But problem is that my target can’t simple load 8 bytes from the 4 byte float memory location to do a conversion to double.
But what I need is for the DAG conversion to respect that the fpext should be converted into a “call” to a software routine, specifically RTLIB
I have the code set for “custom” ISD:FP_EXTEND to make the subroutine call, but the FP_EXTEND never gets invoked because the DAG conversion changes this to a load extension.
I have seen a few things about TLI:isLoadExtLegal, that I need to track down.
But I wanted to check on the best way to make sure a set of floating-point concepts are left as calls for my target. Is there a way to explain to the DAG conversion system prior to the target lowering, that it should above some target-specific.
For example, since I have a software-only float architecture, how is it best supported for LLVM compilation to have the DAG system know that the operations types need to remain as float calls?
Thanks for any pointers and help.
Dan