[clang] [clang][bytecode] Implement logical operators for vector type (PR #107678)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 7 07:09:12 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;
+ }
----------------
yronglin wrote:
Yes, this approach doesn't looks well. Seems BitAnd/BitOr doesn't support bool type, should we extend these two operations to support bool type? Then we can avoid these casts.
https://github.com/llvm/llvm-project/pull/107678
More information about the cfe-commits
mailing list