[PATCH] D80574: [ExtVector] Support ExtVectorType conditional operator

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 28 08:07:52 PDT 2020


Anastasia added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:481
 =                                yes     yes       yes         yes
-:? [#]_                          yes     --        yes         --
+?:                               yes     --        yes         --
 sizeof                           yes     yes       yes         yes
----------------
I think it was more clear as a footnote though.


================
Comment at: clang/docs/LanguageExtensions.rst:489
 
+Note that ternary operator(?:) has different behaviors depends on the vector type of
+the condition operands. If the condition is a GNU vector (i.e. __vector_size__),
----------------
has different behaviors depends on -> has different behaviors depending on


================
Comment at: clang/docs/LanguageExtensions.rst:493
+If it's an extension (OpenCL) vector, it's only available in C and OpenCL C. And it 
+selects base on signedness of the condition operands.
+
----------------
Maybe we can add a reference to OpenCL C section 6.3.9


================
Comment at: clang/lib/Sema/SemaExpr.cpp:7484
+  // Only ext vector is allowed
+  if (const auto *VecCondTy = Cond->getType()->getAs<ExtVectorType>()) {
+    QualType EleTy = VecCondTy->getElementType();
----------------
Why do you need this change? I believe OpenCL makes the same restriction.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:7975
+    // condition and result type.
+    QualType CondTy = Cond.get()->getType();
+    if (CondTy->isExtVectorType()) {
----------------
Do you know where it is done for OpenCL? I think we should try to share the same code...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80574/new/

https://reviews.llvm.org/D80574





More information about the cfe-commits mailing list