[LLVMdev] Multiple return values (floating-point exception flags)

Jason Riedy jason at acm.org
Wed Mar 18 14:22:24 PDT 2009


Does anyone have suggestions for either extending operators or
adding intrinsics that support multiple return values?  Or is
packaging everything into a derived types the only way?

I have an idea for supporting floating-point exception flags and
modes in a flexible way by making the data dependencies explicit,
but I've become quite lost poking around.  I suspect this will
end up involving some combinations of intrinsics and, alas, rely
on derived type optimizations combined with SelectionDAG nodes
for sensible performance.  But simply returning the flags seems
nicer, e.g.
  <result>, <flags> = floatadd <result-format> <op1> <op2> <fpu-mode>
If the flags are to be ignored, it should be relatively easy to
dispose of them with multiple return values.

(Part of this (very long-term) work would be to decide if it's
better to pass flags as input and return the OR (as currently is
done in hardware) or to keep the OR separate.)

Right now, I'm somewhat terrified of supporting LLVM users.  I
don't see how it catches any of the implicit data dependencies
that occur in the floating-point environment...  Other compilers
finally are working with the FPU environment, but LLVM's link-time
optimizations without any of the barriers seems capable of
wreaking severe havoc.

Jason




More information about the llvm-dev mailing list