[clang] [AArch64] Add option -msve-streaming-vector-bits= . (PR #144611)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 23 08:24:56 PDT 2025
sdesmalen-arm wrote:
> This currently doesn't touch the __ARM_FEATURE_SVE_BITS define or the arm_sve_vector_bits attribute
We actually need to be a bit more careful to guard against code that uses the `arm_sve_vector_bits` types in streaming[-compatible] contexts when the streaming and non-streaming vector lengths are not the same.
For example:
```
typedef svint32_t int32x16_t __attribute__((arm_sve_vector_bits(512)));
int32x16_t foo_512(int32x16_t a, int32x16_t b) __arm_streaming {
return a + b;
}
```
Compiling this with `-msve-vector-bits=512 -msve-streaming-vector-bits=256`, Clang will create `foo_512` with `vscale_range(2, 2)`, and to extract the <16 x i32> value from the scalable function argument, it will generate:
```call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> %a.coerce, i64 0)```
This is effectively undefined if vscale is not >= 4.
https://github.com/llvm/llvm-project/pull/144611
More information about the cfe-commits
mailing list