[PATCH] D124860: [clang][AArch64][SVE] Implicit conversions for vector-scalar operations
Peter Waller via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 9 01:48:40 PDT 2022
peterwaller-arm added a comment.
Looking pretty good. A couple of test cases to consider:
#include <arm_neon.h>
#include <arm_sve.h>
svint8_t svi8(svint8_t a) {
return a + 256;
}
int8x16_t nei8(int8x16_t a) {
return a + 256;
}
svint8_t svi8_128(svint8_t a) {
return a + 128;
}
int8x16_t nei8_128(int8x16_t a) {
return a + 128;
}
inp.c:4:13: error: invalid operands to binary expression ('svint8_t' (aka '__SVInt8_t') and 'int')
return a + 256;
~ ^ ~~~
inp.c:7:11: error: cannot convert between scalar type 'int' and vector type 'int8x16_t' (vector of 16 'int8_t' values) as implicit conversion would cause truncation
return a + 256;
^
inp.c:13:13: warning: implicit conversion from 'int' to 'int8x16_t' (vector of 16 'int8_t' values) changes value from 128 to -128 [-Wconstant-conversion]
return a + 128;
~ ^~~
Note that for NEON we get a warning about the implicit conversion, and a clear error message about truncation, but for SVE there is no warning and simply an 'invalid operands to binary expression', which could be confusing since the implicit conversions exist for the same operand type with differing value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124860/new/
https://reviews.llvm.org/D124860
More information about the cfe-commits
mailing list