[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @erichkeane I created a patch at https://reviews.llvm.org/D49327 with the fix for this and added you as a reviewer. Repository: rC Clang https://reviews.llvm.org/D46915 ___ cfe-commits mailing list cfe-commits@lists.

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In https://reviews.llvm.org/D46915#1162095, @leonardchan wrote: > In https://reviews.llvm.org/D46915#1162038, @erichkeane wrote: > > > See this bug here: https://bugs.llvm.org/show_bug.cgi?id=38161 > > > > This patch doesn't seem to properly consider integers, and igno

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D46915#1162038, @erichkeane wrote: > See this bug here: https://bugs.llvm.org/show_bug.cgi?id=38161 > > This patch doesn't seem to properly consider integers, and ignores octals, > which I suspect shouldn't be the case. I just requested

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. See this bug here: https://bugs.llvm.org/show_bug.cgi?id=38161 This patch doesn't seem to properly consider integers, and ignores octals, which I suspect shouldn't be the case. Repository: rC Clang https://reviews.llvm.org/D46915 __

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:90 + // by default. + bool SameFBits; + rjmccall wrote: > Sorry for the extremely late review, but this really needs to be renamed. > Please remember that other compiler maintaine

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-27 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/TargetInfo.h:90 + // by default. + bool SameFBits; + Sorry for the extremely late review, but this really needs to be renamed. Please remember that other compiler maintainers are not experts in t

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-20 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. leonardchan marked an inline comment as done. Closed by commit rC335148: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals (authored by leonardchan, committed by ). Repository: rC Clang https:/

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan accepted this revision. ebevhan added inline comments. This revision is now accepted and ready to land. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { leonardchan wrote: > ebevhan wr

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151919. leonardchan marked 2 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/RecursiveASTVisitor.h include/

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan marked an inline comment as done. leonardchan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { ebevhan wrote: > leonardchan wrote: > > leonardchan wrote: > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added a comment. Just a couple more comments and then I think it looks good. We can discuss the conversion and comparison issues in later patches. Comment at: include/clang/AST/ASTContext.h:1951 + unsigned char getFixedPointScale(const QualType &Ty) const; + unsigned

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { ebevhan wrote: > ebevhan wrote: > > leonardchan wrote: > > > leonardchan wrote: > > > > ebevhan wrote: > > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151744. leonardchan added a comment. - Removed CK_IntegralToFixedPoint to be added to later patch addressing conversion - Create CXString for FixedPointLiteral Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang-c/Index.h i

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-18 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { leonardchan wrote: > leonardchan wrote: > > ebevhan wrote: > > > ebevhan wrote: > > > > leonardchan wrote: > > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151433. leonardchan added a comment. - Removed the functions for performing casting between fixed point types to a common type when performing a binary operation since operations should be performed on the types as is. Also this patch is meant more for d

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151431. leonardchan added a comment. Removed FractFBits property. Fractional bits for _Fract types are now one less the _Fract width unless `SameFBits` is specified. In that case, the number of FBits in unsigned _Fract is the same as that of signed _Frac

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan w

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { ebevhan wrote: > leonardchan wrote: > > ebevhan wrote: > > > leonardchan wrote: > > > > ebevhan wrote: > > > > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; leonardchan wrote: > ebevhan wrote: > > leonardchan w

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan w

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-13 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: lib/AST/ExprConstant.cpp:9437 + } + return Success(-Value, E); +} This looks very suspect to me as well... This might not respect padding on types whose sign bit is not the MSB, such as _Fract. The same go

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-13 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; leonardchan wrote: > ebevhan wrote: > > leonardchan w

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-13 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: lib/Lex/LiteralSupport.cpp:1187 + + uint64_t Base = (radix == 16) ? 2 : 10; + if (BaseShift > 0) { leonardchan wrote: > ebevhan wrote: > > I don't think loops are needed here. BaseShift is essentially Exponent so > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan w

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151016. leonardchan marked 9 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/OperationKinds.def include/clang/AST/RecursiveASTVisitor

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-12 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; leonardchan wrote: > ebevhan wrote: > > I suspect it'

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-08 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/AST/Type.h:6552 +// as a scaled integer. +std::string FixedPointValueToString(unsigned Radix, unsigned Scale, +uint64_t Val); ebevhan wrote: > This should probably ta

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-08 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 150602. leonardchan marked 14 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/OperationKinds.def include/clang/AST/RecursiveASTVisito

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-07 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments. Comment at: include/clang/AST/Type.h:6552 +// as a scaled integer. +std::string FixedPointValueToString(unsigned Radix, unsigned Scale, +uint64_t Val); This should probably take an APInt or APSInt

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/AST/ExprConstant.cpp:9323 + if (Value.isSigned() && Value.isMinSignedValue() && E->canOverflow() && + !HandleOverflow(Info, E, -Value.extend(Value.getBitWidth() + 1), + E->getType())) --