This is an archive of the discontinued LLVM Phabricator instance.

[clang][AArch64][SVE] Implement conditional operator for SVE vectors
ClosedPublic

Authored by DavidTruby on Apr 20 2022, 7:00 AM.

Details

Summary

This patch adds support for the conditional (ternary) operator on SVE
scalable vector types in C++, matching the behaviour for NEON vector
types. Like the conditional operator for NEON types, this is disabled in
C mode.

Diff Detail

Event Timeline

DavidTruby created this revision.Apr 20 2022, 7:00 AM
DavidTruby requested review of this revision.Apr 20 2022, 7:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 7:00 AM
Matt added a subscriber: Matt.Apr 20 2022, 12:26 PM

Add additional tests for vector splats

clang/lib/Sema/SemaExprCXX.cpp
6266

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)

Fix crash where condition and splatted result don't have the same width

peterwaller-arm accepted this revision.Apr 28 2022, 9:07 AM
This revision is now accepted and ready to land.Apr 28 2022, 9:07 AM
This revision was landed with ongoing or failed builds.May 3 2022, 6:10 AM
This revision was automatically updated to reflect the committed changes.

I think that this has caused assert failures on the VLS (fixed sized vector) SVE bot.

https://lab.llvm.org/buildbot/#/builders/176/builds/1632/steps/12/logs/stdio

Based on the other SVE change being in llvm and seeing Sema in the backtrace.

These issues are not on any of the other AArch64 bots or the vector length agnostic bot. I appreciate that I'm pulling your change out of a list of 80 without that much evidence so if it's clearly not the issue just let me know.

I appreciate that I'm pulling your change out of a list of 80 without that much evidence so if it's clearly not the issue just let me know.

My guess was incorrect, I've tracked this down to a different change. Sorry for the noise.