[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG80bbc05436d9: [clang][Interp] Implement inv and neg unary operations (authored by tbaeder). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132098/new/ https:

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132098/new/ https://reviews.llvm.org/D132098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 453970. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132098/new/ https://reviews.llvm.org/D132098 Files: clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/Interp/Inte

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Integral.h:173 + } + template static Integral from(Integral<0, SrcSign> Value) { erichkeane wrote: > aaron.ballman wrote: > > tbaeder wrote: > > > aaron.ballman wrote: > > > > tbaeder wrote: > >

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 453968. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132098/new/ https://reviews.llvm.org/D132098 Files: clang/lib/AST/Interp/Boolean.h clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/lib/AST/Interp/Inte

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/AST/Interp/Integral.h:173 + } + template static Integral from(Integral<0, SrcSign> Value) { aaron.ballman wrote: > tbaeder wrote: > > aaron.ballman wrote: > > > tbaeder wrote: > > > > I'm a bit out of m

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/AST/Interp/Integral.h:173 + } + template static Integral from(Integral<0, SrcSign> Value) { tbaeder wrote: > aaron.ballman wrote: > > tbaeder wrote: > > > I'm a bit out of my element with the templat

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x erichkeane wrote: > tbaeder wrote: > > aaron.ballman wrote: > > > tbaeder wrote: > > > > aa

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x tbaeder wrote: > aaron.ballman wrote: > > tbaeder wrote: > > > aaron.ballman wrote: > > > >

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x aaron.ballman wrote: > tbaeder wrote: > > aaron.ballman wrote: > > > This is reachable and wil

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x tbaeder wrote: > aaron.ballman wrote: > > This is reachable and will always return true

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/Integral.h:173 + } + template static Integral from(Integral<0, SrcSign> Value) { I'm a bit out of my element with the template magic here. CHANGES SINCE LAST ACTION https://reviews.llvm.org/

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-19 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 453917. tbaeder added a comment. When changing the test to use `-verify=test`, I noticed that `static_assert(-false)` did not assert. I had to implement integral casts (only from sint32 to bool for now) in this patch as well to make it work. CHANGES SINCE

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x aaron.ballman wrote: > This is reachable and will always return true thanks to the magic of in

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-18 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:131 + + return this->emitNE(*T, SubExpr); +} shafik wrote: > Can you explain this line? Nevermind, I get it, you are emitting a `0` and then doing a not equal to zero to

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. I'd appreciate if we handled unary `~` and `+` soon after this Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620 + case UO_Deref: // *x + case UO_Not:// ~x + case UO_Real: // __real x This is reachable and will al

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-18 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:131 + + return this->emitNE(*T, SubExpr); +} Can you explain this line? Comment at: clang/lib/AST/Interp/Interp.h:183 + + S.Stk.push(Val); + return tr

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:123 - default: { -// TODO: implement other casts. -return this->bail(CE); - } + case CK_IntegralToBoolean: +if (Optional T = classify(SubExpr->getType())) { Imple

[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations

2022-08-17 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: erichkeane, aaron.ballman. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Implement inverting and negating values Repository: rG LLVM Github M