This is an archive of the discontinued LLVM Phabricator instance.

[Fixed Point Arithmetic] Comparison and Unary Operations for Fixed Point Types
Needs ReviewPublic

Authored by leonardchan on May 15 2018, 4:39 PM.

Details

Reviewers
phosek
mcgrathr
Summary

This patch contains logic and tests for different unary and comparison operations on fixed point types, and casting between integers and fixed point types.

The operations are ==, !=, >, <, >=, <=, !, +, -, ++, and --.

~ is not a supported operation on fixed point types.

Diff Detail

Repository
rC Clang

Event Timeline

leonardchan created this revision.May 15 2018, 4:39 PM
leonardchan retitled this revision from Comparison and Unary Operations for Fixed Point Types to [Fixed Point Arithmetic] Comparison and Unary Operations for Fixed Point Types.May 16 2018, 9:41 AM
ebevhan added inline comments.
lib/CodeGen/CGExprScalar.cpp
2141

Please see my comments on other patches about these values.

2178

Use an APInt with the right size here instead of relying on types in the compiler.

ebevhan added inline comments.May 23 2018, 2:10 AM
lib/CodeGen/CGExprScalar.cpp
2178

Also, what about saturating types?

Ka-Ka added a subscriber: Ka-Ka.Jun 21 2018, 12:04 AM
lib/Sema/SemaExpr.cpp