diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -12052,6 +12052,9 @@ // Strip vector types. if (isa(Source)) { + // Converting from a vector to a sizeless builtin type is fine. + if (Target->isSizelessBuiltinType()) + return; if (!isa(Target)) { if (S.SourceMgr.isInSystemMacro(CC)) return; diff --git a/clang/test/Sema/aarch64-fixed-vector-to-scalable-implicit-conversion.c b/clang/test/Sema/aarch64-fixed-vector-to-scalable-implicit-conversion.c new file mode 100644 --- /dev/null +++ b/clang/test/Sema/aarch64-fixed-vector-to-scalable-implicit-conversion.c @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \ +// RUN: -msve-vector-bits=512 -Wconversion -fallow-half-arguments-and-returns \ +// RUN: -o /dev/null %s 2>&1 | FileCheck %s -allow-empty + +// CHECK-NOT: warning + +#include + +#define N __ARM_FEATURE_SVE_BITS +#define FIXED_ATTR __attribute__((arm_sve_vector_bits(N))) + +typedef svbool_t fixed_svbool_t FIXED_ATTR; + +fixed_svbool_t check_svnot(fixed_svbool_t p) { + return svnot_z(svptrue_b64(), p); +} + +fixed_svbool_t check_svorr(fixed_svbool_t p1, fixed_svbool_t p2) { + return svorr_z(svptrue_b64(), p1, p2); +} + +fixed_svbool_t check_svorn(fixed_svbool_t p1, fixed_svbool_t p2) { + return svorn_z(svptrue_b64(), p1, p2); +} + +fixed_svbool_t check_svand(fixed_svbool_t p1, fixed_svbool_t p2) { + return svand_z(svptrue_b64(), p1, p2); +} + +fixed_svbool_t check_svnand(fixed_svbool_t p1, fixed_svbool_t p2) { + return svnand_z(svptrue_b64(), p1, p2); +}