ahatanak added inline comments.

================
Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8751
@@ -8747,3 +8750,3 @@
 
   // OpenCL v1.1 s6.3.j says that the operands need to be integers.
   if (!LHSEleType->isIntegerType()) {
----------------
Should we mention that any vectors used as shift operands have to have integer 
element types? This comment gives the impression that only OpenCL vectors need 
to be integers.

================
Comment at: llvm/tools/clang/lib/Sema/SemaExpr.cpp:8790
@@ -8774,3 +8789,3 @@
       S.Context.getExtVectorType(RHSEleType, LHSVecTy->getNumElements());
     RHS = S.ImpCastExprToType(RHS.get(), VecTy, CK_VectorSplat);
   }
----------------
OK. So the rule is that the type of the scalar operand is normally converted to 
the vector element type of the other operand before being transformed to a 
vector, but we don't have to do this when it's used as the RHS (shift amount) 
because IRGen generates the correct IR without the conversion?

================
Comment at: llvm/tools/clang/test/Sema/vecshift.c:56
@@ +55,3 @@
+
+  vc4 = vc4 << vc8; // expected-error {{vector operands do not have the same 
number of elements}}
+  vi4 = vi4 << vuc8; // expected-error {{vector operands do not have the same 
number of elements}}
----------------
I don't think this patch was necessary to have clang print diagnostic "vector 
operands do not have the same number of elements"? If that's the case, I think 
it's better to add these lines in a separate commit.


https://reviews.llvm.org/D24467



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to