[PATCH] D124091: [clang][AArch64][SVE] Implement conditional operator for SVE vectors

Peter Waller via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 26 02:18:57 PDT 2022


peterwaller-arm added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:6266
+    LHS = ImpCastExprToType(LHS.get(), ResultType, CK_VectorSplat);
+    RHS = ImpCastExprToType(RHS.get(), ResultType, CK_VectorSplat);
+  }
----------------
I get an assert with the following input (float64 in, float32 out). I was lead here by noticing that the element count comes from `CondElementCount`, but nothing ensures that the numbers of elements are consistent with LHS or RHS.

```
svfloat32_t cond_f32_splat(svfloat64_t a) {
    return a < 0. ? 1.f : 0.f;
}
```

```
#11 0x0000000001fef77e clang::ASTContext::getCanonicalType(clang::QualType) const CodeGenTypes.cpp:0:0
#12 0x000000000446b39c clang::Sema::ImpCastExprToType(clang::Expr*, clang::QualType, clang::CastKind, clang::ExprValueKind, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::Sema::CheckedCo
nversionKind) (out/rel/bin/clang+0x446b39c)
#13 0x00000000048ca1ce clang::Sema::CheckSizelessVectorConditionalTypes(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clan
g::SourceLocation) (out/rel/bin/clang+0x48ca1ce)
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124091/new/

https://reviews.llvm.org/D124091



More information about the cfe-commits mailing list