GCC extensions not implemented yet

http://clang.llvm.org/docs/UsersManual.html says “clang does not support decimal floating point types (_Decimal32 and friends) or fixed-point types (_Fract and friends); nobody has expressed interest in these features yet, so it’s hard to say when they will be implemented”.

Synopsys is interested in the fixed point data types and is starting to add extensions for it. Is this an extension the community would want in the clang/llvm tree?

See section 4:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1275.pdf

See “Contributing Extensions to Clang” on <http://clang.llvm.org/get_involved.html>.

– Sean Silva

Mark,

Can you explain more about what you have in mind. I suppose that the semantic analysis portions are pretty well defined, but what would this mean in terms of code generation?

-Hal

Fixed point arithmetic is basically integer arithmetic that saturates instead of wrapping zero. I want to add saturating integer operations to the IR. I could implement these by adding intrinsic functions rather than real opcodes, but I would really like to have vectorization support someday.

Note, the operations are defined by the technical report in section 4.1.6.

I have read http://clang.llvm.org/get_involved.html and will commit to it. I do not know if there is "Evidence of a significant user community". It is supported by gcc and ACE, but I have no insight beyond that.

Hi,

So I imagine that you're aware that there are some of the integer binary operators take additional modifiers (eg, add can take nuw or nsw

http://llvm.org/releases/3.3/docs/LangRef.html#add-instruction

). The current modifiers are primarily of use indirectly in terms of providing simple behaviour at edge cases in order
to allow optimizers to do transformations that wouldn't otherwise be valid. However, there's no reason that additional
modifiers couldn't be added where the edge case behaviour is actually something where the primary benefit is when it
occurs at run-time. Doing it this way would potentially allow re-use of a lot of IR-level optimizers, at the cost
of needing careful modifications to those optimizations when the modifier is present and it affects validity of
certain things. However, given the similarity to nsw/nuw that seems like a tractable "search and duplicate" job.

Cheers,
Dave

Fixed point arithmetic is basically integer arithmetic that saturates
instead of wrapping zero. I want to add saturating integer
operations to the IR. I could implement these by adding intrinsic
functions rather than real opcodes, but I would really like to have
vectorization support someday.

There seems to be a fair amount of overlap here with what OpenCL needs.

-Hal