[PATCH] Add __builtin_convertvector

hfinkel at anl.gov hfinkel at anl.gov
Fri Sep 13 06:16:10 PDT 2013


Hi eli.friedman,

LLVM supports applying conversion instructions to vectors of the same number of elements (fptrunc, fptosi, etc.) but currently there is 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, I'd like to add this new intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This will 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).

Please review.

http://llvm-reviews.chandlerc.com/D1677

Files:
  docs/LanguageExtensions.rst
  include/clang/AST/Expr.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/Builtins.def
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Basic/TokenKinds.def
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Parse/ParseExpr.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CodeGen/convertvector.c
  test/PCH/exprs.h
  test/Preprocessor/feature_tests.c
  test/Sema/convertvector.c
  tools/libclang/CXCursor.cpp
  tools/libclang/RecursiveASTVisitor.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1677.1.patch
Type: text/x-patch
Size: 25324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130913/fe9684c9/attachment.bin>


More information about the cfe-commits mailing list