[PATCH] D115670: Implement some constexpr vector unary operators, fix boolean-ops
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 15 10:37:43 PST 2021
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/ExprConstant.cpp:10188
+ bool VisitUnaryOperator(const UnaryOperator *E);
+ // FIXME: Missing: unary ~, conditional operator (for GNU
// conditional select), shufflevector, ExtVectorElementExpr
----------------
Comment can be updated as we're not missing `~` any longer.
================
Comment at: clang/lib/AST/ExprConstant.cpp:10399
+ Elt.getInt() = !Elt.getInt();
+ // operator - on vectors returns -1 for 'truth', so negate it.
+ Elt.getInt().negate();
----------------
`operator!`, right?
================
Comment at: clang/lib/AST/ExprConstant.cpp:10405-10406
+ "Vector can only be int or float type");
+ // Float types result in an int of the same size, but -1 or 0 for true and
+ // false.
+ APSInt EltResult{Ctx.getIntWidth(ResultTy),
----------------
-1 for true and 0 for false (just to be super clear).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115670/new/
https://reviews.llvm.org/D115670
More information about the cfe-commits
mailing list