Hi, we are trying to implement in the LLVM framework the fixed point notation as specified in the ISO/IEC TR 18037 ( ).

We’ve read some old discussions on the mailing list ( f.i. , ), and it seems that some people don’t agree on their implementation as a completely new type.
Do you think that today it is worth to implement them or not? Are there anybody working on this?

If nobody is already working on this, and the dev community think that it can be a good idea we have a couple of questions:

1- we are following this main guidelines ( ) in order to add a new type, do you think that it’s better a fundamental type or a derived one?

2- Do you have any advice or additional tutorial to suggest in order to implement a new data type?

Thank you very much

Best regards

I have no opinion on whether it is “worth” working on fixed-point. I’m not aware of any discussion or effort in that direction, aside from the email discussions you already found.

Non-saturating fixed-point can readily be handled using existing LLVM integer types and tracking the scale factor in the front-end. Languages that support these types (PL/I, COBOL) have done that pretty successfully in other compilers I’ve worked with. There’s no real need for new types to handle these cases.

It’s the saturating operations that are the problem, and my recollection (reinforced by your links, thanks!) is that inventing new types would be a real problem for people. You are probably best off implementing saturating operations with new LLVM intrinsics, which would (correctly) be avoided by optimization passes, unless you chose to teach a particular pass about the new intrinsics. If this works out, and saturating fixed-point is demonstrably useful and successful, then it would be time to talk about adding new IR types and instructions.


Hi Fabio,

I’d suggest bringing this up on the cfe-dev mailing list, since this is likely to be a pure clang extension and have little impact on LLVM itself (at least in the short term, it is possible that LLVM extensions will eventually be interesting to improve the implementation).