[PATCH] D115670: Correct behavior of Vector boolean-operations, implement vector operator-

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 15 07:54:56 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:10389
+    return false;
+  case UO_Minus: {
+    for (unsigned EltNum = 0; EltNum < VD->getNumElements(); ++EltNum) {
----------------
Would it be worth handling ~ and ! as well given that they seem pretty trivial to support? I don't insist, but I'm trying to reason whether the `for` loop should be hoisted out of the `switch` because it seems like it'll be needed for all of the cases.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:12262-12287
     if (TypeSize == Context.getTypeSize(Context.CharTy))
       return Context.getExtVectorType(Context.CharTy, VTy->getNumElements());
     else if (TypeSize == Context.getTypeSize(Context.ShortTy))
       return Context.getExtVectorType(Context.ShortTy, VTy->getNumElements());
     else if (TypeSize == Context.getTypeSize(Context.IntTy))
       return Context.getExtVectorType(Context.IntTy, VTy->getNumElements());
+    else if (TypeSize == Context.getTypeSize(Context.Int128Ty))
----------------
NFC nit: a whole pile of `else after return` that can be removed someday.


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

https://reviews.llvm.org/D115670



More information about the cfe-commits mailing list