diff options
author | Craig Topper <craig.topper@intel.com> | 2018-08-08 22:31:12 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-08-08 22:31:12 +0000 |
commit | f95a6d93050458f967f4dd69b517bd852451b5c2 (patch) | |
tree | b3c3922bde7ee0afbdeae600087b000a6660f605 /clang/lib/AST/ExprConstant.cpp | |
parent | 7b2745447783faa5f94b6f31377fba9284b2e321 (diff) | |
download | bcm5719-llvm-f95a6d93050458f967f4dd69b517bd852451b5c2.tar.gz bcm5719-llvm-f95a6d93050458f967f4dd69b517bd852451b5c2.zip |
[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr
This addresses a FIXME that has existed since before clang supported the builtin.
This time with only reviewed changes.
Differential Revision: https://reviews.llvm.org/D50471
llvm-svn: 339295
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 7e596d0715c..0ce962e4194 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8117,9 +8117,15 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, case Builtin::BI__builtin_classify_type: return Success((int)EvaluateBuiltinClassifyType(E, Info.getLangOpts()), E); - // FIXME: BI__builtin_clrsb - // FIXME: BI__builtin_clrsbl - // FIXME: BI__builtin_clrsbll + case Builtin::BI__builtin_clrsb: + case Builtin::BI__builtin_clrsbl: + case Builtin::BI__builtin_clrsbll: { + APSInt Val; + if (!EvaluateInteger(E->getArg(0), Val, Info)) + return false; + + return Success(Val.getBitWidth() - Val.getMinSignedBits(), E); + } case Builtin::BI__builtin_clz: case Builtin::BI__builtin_clzl: |