[clang] [clang][bytecode] Implement arithmetic, bitwise and compound assignment operator (PR #108949)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 09:02:43 PDT 2024


================
@@ -1371,10 +1455,27 @@ bool Compiler<Emitter>::VisitVectorBinOp(const BinaryOperator *E) {
         return false;
     }
 
+    // If we performed an integer promotion, we need to cast the compute result
+    // into result vector element type.
+    if (NeedIntPromot &&
+        !this->emitPrimCast(PromotT, ResultElemT, VecTy->getElementType(), E))
+      return false;
+
     // Initialize array element with the value we just computed.
     if (!this->emitInitElem(ResultElemT, I, E))
       return false;
   }
+
+  if (E->isCompoundAssignmentOp()) {
+    if (!this->emitGetLocal(PT_Ptr, LHSOffset, E))
+      return false;
+    if (!this->emitFlip(PT_Ptr, PT_Ptr, E))
+      return false;
+    if (!this->emitMemcpy(E))
+      return false;
+    if (!this->emitPopPtr(E))
+      return false;
+  }
----------------
tbaederr wrote:

I don't understand this block - why is the copy necessary?

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


More information about the cfe-commits mailing list