@@ -13766,44 +13766,40 @@ static bool getBuiltinAlignArguments(const CallExpr *E, EvalInfo &Info,
1376613766
1376713767bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
1376813768 unsigned BuiltinOp) {
13769- auto EvalTestOp =
13770- [&](llvm::function_ref<bool(const APInt &, const APInt &)> Fn) {
13771- APValue SourceLHS, SourceRHS;
13772- if (!EvaluateAsRValue(Info, E->getArg(0), SourceLHS) ||
13773- !EvaluateAsRValue(Info, E->getArg(1), SourceRHS))
13774- return false;
13769+ auto EvalTestOp = [&](llvm::function_ref<bool(const APInt &, const APInt &)>
13770+ Fn) {
13771+ APValue SourceLHS, SourceRHS;
13772+ if (!EvaluateAsRValue(Info, E->getArg(0), SourceLHS) ||
13773+ !EvaluateAsRValue(Info, E->getArg(1), SourceRHS))
13774+ return false;
1377513775
13776- unsigned SourceLen = SourceLHS.getVectorLength();
13777- const VectorType *VT = E->getArg(0)->getType()->castAs<VectorType>();
13778- QualType ElemQT = VT->getElementType();
13779- unsigned LaneWidth = Info.Ctx.getTypeSize(ElemQT);
13780-
13781- APInt AWide(LaneWidth * SourceLen, 0);
13782- APInt BWide(LaneWidth * SourceLen, 0);
13783-
13784- for (unsigned I = 0; I != SourceLen; ++I) {
13785- APInt ALane;
13786- APInt BLane;
13787- if (ElemQT->isIntegerType()) { // Get value.
13788- ALane = SourceLHS.getVectorElt(I).getInt();
13789- BLane = SourceRHS.getVectorElt(I).getInt();
13790- } else if (ElemQT->isFloatingType()) { // Get only sign bit.
13791- ALane = SourceLHS.getVectorElt(I)
13792- .getFloat()
13793- .bitcastToAPInt()
13794- .isNegative();
13795- BLane = SourceRHS.getVectorElt(I)
13796- .getFloat()
13797- .bitcastToAPInt()
13798- .isNegative();
13799- } else { // Must be integer or floating type.
13800- return false;
13801- }
13802- AWide.insertBits(ALane, I * LaneWidth);
13803- BWide.insertBits(BLane, I * LaneWidth);
13804- }
13805- return Success(Fn(AWide, BWide), E);
13806- };
13776+ unsigned SourceLen = SourceLHS.getVectorLength();
13777+ const VectorType *VT = E->getArg(0)->getType()->castAs<VectorType>();
13778+ QualType ElemQT = VT->getElementType();
13779+ unsigned LaneWidth = Info.Ctx.getTypeSize(ElemQT);
13780+
13781+ APInt AWide(LaneWidth * SourceLen, 0);
13782+ APInt BWide(LaneWidth * SourceLen, 0);
13783+
13784+ for (unsigned I = 0; I != SourceLen; ++I) {
13785+ APInt ALane;
13786+ APInt BLane;
13787+ if (ElemQT->isIntegerType()) { // Get value.
13788+ ALane = SourceLHS.getVectorElt(I).getInt();
13789+ BLane = SourceRHS.getVectorElt(I).getInt();
13790+ } else if (ElemQT->isFloatingType()) { // Get only sign bit.
13791+ ALane =
13792+ SourceLHS.getVectorElt(I).getFloat().bitcastToAPInt().isNegative();
13793+ BLane =
13794+ SourceRHS.getVectorElt(I).getFloat().bitcastToAPInt().isNegative();
13795+ } else { // Must be integer or floating type.
13796+ return false;
13797+ }
13798+ AWide.insertBits(ALane, I * LaneWidth);
13799+ BWide.insertBits(BLane, I * LaneWidth);
13800+ }
13801+ return Success(Fn(AWide, BWide), E);
13802+ };
1380713803
1380813804 auto HandleMaskBinOp =
1380913805 [&](llvm::function_ref<APSInt(const APSInt &, const APSInt &)> Fn)
0 commit comments