[PATCH] Add __builtin_convertvector

Eli Friedman eli.friedman at gmail.com
Mon Sep 16 17:26:34 PDT 2013



================
Comment at: include/clang/AST/Expr.h:3474
@@ +3473,3 @@
+/// vector type of the same arity.
+class ConvertVectorExpr : public Expr { // Should this be an ExplicitCastExpr?
+private:
----------------
No, this should not be a CastExpr.

================
Comment at: lib/Sema/TreeTransform.h:9171
@@ +9170,3 @@
+  llvm_unreachable("Cannot transform convertVector expressions yet");
+}
+
----------------
It would be nice to fix this before committing.

================
Comment at: lib/CodeGen/CGExprScalar.cpp:1011
@@ +1010,3 @@
+      Res = Builder.CreateIntCast(Src, DstTy, InputSigned, "conv");
+    else if (InputSigned)
+      Res = Builder.CreateSIToFP(Src, DstTy, "conv");
----------------
What if the destination type is a bool vector?

================
Comment at: lib/Sema/SemaExpr.cpp:4489
@@ +4488,3 @@
+                     << E->getSourceRange());
+
+  return Owned(new (Context) ConvertVectorExpr(E, DstTy, VK, OK, BuiltinLoc,
----------------
You might want to be careful exactly what vector types we accept here... but I can't think of anything you actually need to check for, so maybe not.


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



More information about the cfe-commits mailing list