[LLVMdev] fixed point support

Török Edwin edwintorok at gmail.com
Thu Nov 25 03:53:20 PST 2010


On Thu, 25 Nov 2010 11:06:48 +0100
Duncan Sands <baldrick at free.fr> wrote:

> Hi Jonas,
> 
> > I am investigating the possibilities of incorporating fixed point
> > support into the LLVM I/R.
> 
> I think you should write a rationale explaining why you want to
> introduce new types etc rather than using the existing integer types,
> with intrinsic functions for the operations, or some other such
> scheme.  Introducing new types is hard work and creates a maintenance
> burden for everyone, since they will need to be properly supported by
> all parts of the compiler forever more.  It is therefore important to
> give a cogent explanation of why this is the best approach, why the
> benefits outweigh the costs, and so forth.

Also can't fixed point be handled entirely by the frontend?
You store the scaling factor as an attribute on the type.

When you perform operations that involve the same fixed point types you
can perform them with integers, and when you need to perform
conversions you emit the appropriate code to perform the conversions.
The emitted LLVM IR needs to know nothing about the scaling factors
involved.
For saturation, etc. you can use the SSE intrinsics.

Best regards,
--Edwin



More information about the llvm-dev mailing list