[llvm-dev] Fixed Point Support in LLVM

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 27 22:36:59 PDT 2018



> On Aug 20, 2018, at 10:59 AM, Leonard Chan via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> We would like to discuss the possibility of adding support for fixed
> point operations, either through new types, instructions, or
> intrinsics. This is an extension to a previous proposal
> (http://lists.llvm.org/pipermail/cfe-dev/2018-April/057756.html) for
> implementing fixed point arithmetic entirely in clang, but John McCall
> brings up good points in the comments thread of
> https://reviews.llvm.org/D50616 for adding LLVM support.

Hi Leonard,

I’m sorry for the delay responding to this.  Please let me +1 a few downstream comments:

+1 for adding a first class type.  I agree with John that this is not as bad as it might seem.  This allows the core LLVM IR types (e.g. add sub etc) to be defined on these types, and for legalize to do the right thing.  This makes it easier for producers of IR (e.g. clang) to handle them in a uniform way.  I don’t see a downside to this.

+1 to Philip’s point about getting much of an implementation in place before starting integration.  This is a big enough piece of work that we should be confident in the design direction, and I don’t want to get another partial transition into the codebase that may or may not get finished.

+1 to the point about figuring out the saturation situation separately from the fixed point situation.  This has come up before and gets one-off solutions (e.g. in the vector space) and it would be better to have a holistic solution to this that applies everywhere - we can migrate the existing intrinsics over to a better builtin answer once it exists.


In short, I’m very strongly in the camp of supporting a new builtin type.  I don’t see any downside at all to it.

-Chris


More information about the llvm-dev mailing list