[cfe-commits] r74299 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/ext_vector_components.c
Eli Friedman
eli.friedman at gmail.com
Fri Jun 26 15:17:35 PDT 2009
On Fri, Jun 26, 2009 at 11:22 AM, Nate Begeman<natebegeman at mac.com> wrote:
> - // Check for vector->vector bitcast.
> - if (SE->getType()->isVectorType())
> + // Check for vector->vector bitcast and scalar->vector splat.
> + if (SETy->isVectorType()) {
> return this->Visit(const_cast<Expr*>(SE));
> + } else if (SETy->isIntegerType()) {
> + APSInt IntResult;
> + if (EvaluateInteger(SE, IntResult, Info))
> + Result = APValue(IntResult);
> + } else if (SETy->isRealFloatingType()) {
> + APFloat F(0.0);
> + if (EvaluateFloat(SE, F, Info))
> + Result = APValue(F);
> + }
>
> - return APValue();
> + if (Result.isInt() || Result.isFloat()) {
> + unsigned NumElts = E->getType()->getAsVectorType()->getNumElements();
> + llvm::SmallVector<APValue, 4> Elts(NumElts, Result);
> + Result = APValue(&Elts[0], Elts.size());
> + }
> + return Result;
> }
This code looks a little suspicious; does it handle stuff like "v2f32
x = (v2f32)4LL;" correctly?
-Eli
More information about the cfe-commits
mailing list