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

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 18:20:49 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;
+  }
----------------
yronglin wrote:

Same as above, we will copy the temporary to the LHS at the end.

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


More information about the cfe-commits mailing list