diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-09-18 03:29:45 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-09-18 03:29:45 +0000 |
commit | c4d7c82c7f7356ac9aca70d67593479897ad7f2b (patch) | |
tree | 6805191117ef09e757b99f96db3d0764c7f296fb /clang/lib/Serialization/ASTWriterStmt.cpp | |
parent | 4c2316be490f798ed44e439d91a6604f57d3b9db (diff) | |
download | bcm5719-llvm-c4d7c82c7f7356ac9aca70d67593479897ad7f2b.tar.gz bcm5719-llvm-c4d7c82c7f7356ac9aca70d67593479897ad7f2b.zip |
Add the intrinsic __builtin_convertvector
LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.
C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.
llvm-svn: 190915
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index ee328e2351a..d527fcd382d 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -794,6 +794,15 @@ void ASTStmtWriter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { Code = serialization::EXPR_SHUFFLE_VECTOR; } +void ASTStmtWriter::VisitConvertVectorExpr(ConvertVectorExpr *E) { + VisitExpr(E); + Writer.AddSourceLocation(E->getBuiltinLoc(), Record); + Writer.AddSourceLocation(E->getRParenLoc(), Record); + Writer.AddTypeSourceInfo(E->getTypeSourceInfo(), Record); + Writer.AddStmt(E->getSrcExpr()); + Code = serialization::EXPR_CONVERT_VECTOR; +} + void ASTStmtWriter::VisitBlockExpr(BlockExpr *E) { VisitExpr(E); Writer.AddDeclRef(E->getBlockDecl(), Record); |