diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-08-27 11:55:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-27 11:55:37 +0200 |
commit | d5c5ed3723a61b19c72c05f7dff31aa00917027a (patch) | |
tree | 000674e76ad984c6f2ed7683260bbc560fcd2468 /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | 57a472767e8ce7e795aac7e5d0a3e8a6b3ea2918 (diff) | |
download | llvm-d5c5ed3723a61b19c72c05f7dff31aa00917027a.zip llvm-d5c5ed3723a61b19c72c05f7dff31aa00917027a.tar.gz llvm-d5c5ed3723a61b19c72c05f7dff31aa00917027a.tar.bz2 |
[clang][bytecode] Handle vector assignments (#155573)
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 6e64fc0..ea6195c 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -1383,7 +1383,7 @@ bool Compiler<Emitter>::VisitVectorBinOp(const BinaryOperator *E) { assert(E->getRHS()->getType()->isVectorType()); // Prepare storage for result. - if (!Initializing && !E->isCompoundAssignmentOp()) { + if (!Initializing && !E->isCompoundAssignmentOp() && !E->isAssignmentOp()) { UnsignedOrNone LocalIndex = allocateTemporary(E); if (!LocalIndex) return false; @@ -1402,6 +1402,21 @@ bool Compiler<Emitter>::VisitVectorBinOp(const BinaryOperator *E) { PrimType RHSElemT = this->classifyVectorElementType(RHS->getType()); PrimType ResultElemT = this->classifyVectorElementType(E->getType()); + if (E->getOpcode() == BO_Assign) { + assert(Ctx.getASTContext().hasSameUnqualifiedType( + LHS->getType()->castAs<VectorType>()->getElementType(), + RHS->getType()->castAs<VectorType>()->getElementType())); + if (!this->visit(LHS)) + return false; + if (!this->visit(RHS)) + return false; + if (!this->emitCopyArray(ElemT, 0, 0, VecTy->getNumElements(), E)) + return false; + if (DiscardResult) + return this->emitPopPtr(E); + return true; + } + // Evaluate LHS and save value to LHSOffset. unsigned LHSOffset = this->allocateLocalPrimitive(LHS, PT_Ptr, /*IsConst=*/true); |