[clang] [clang][bytecode] Implement logical operators for vector type (PR #107678)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 7 22:36:45 PDT 2024


================
@@ -1267,7 +1268,15 @@ bool Compiler<Emitter>::VisitVectorBinOp(const BinaryOperator *E) {
   auto getElem = [=](unsigned Offset, unsigned Index) {
     if (!this->emitGetLocal(PT_Ptr, Offset, E))
       return false;
-    return this->emitArrayElemPop(ElemT, Index, E);
+    if (!this->emitArrayElemPop(ElemT, Index, E))
+      return false;
+    if (E->isLogicalOp()) {
+      if (!this->emitPrimCast(ElemT, PT_Bool, Ctx.getASTContext().BoolTy, E))
+        return false;
+      if (!this->emitPrimCast(PT_Bool, ResultElemT, VecTy->getElementType(), E))
+        return false;
+    }
----------------
tbaederr wrote:

I think that would just move the cast further down, i.e. you still have to convert from bool to` ResultT`. I guess this is fine for now.

https://github.com/llvm/llvm-project/pull/107678


More information about the cfe-commits mailing list