c-rhodes added inline comments.

================
Comment at: clang/test/Sema/attr-arm-sve-vector-bits.c:233-234
 
+svint64_t to_svint64_t__from_gnu_int32_t(gnu_int32_t x) { return x; } // 
expected-error-re {{returning 'gnu_int32_t' (vector of {{[0-9]+}} 'int32_t' 
values) from a function with incompatible result type 'svint64_t' (aka 
'__SVInt64_t')}}
+gnu_int32_t from_svint64_t__to_gnu_int32_t(svint64_t x) { return x; } // 
expected-error-re {{returning 'svint64_t' (aka '__SVInt64_t') from a function 
with incompatible result type 'gnu_int32_t' (vector of {{[0-9]+}} 'int32_t' 
values)}}
+
----------------
I expected similar diagnostics when casting between GNU and fixed-length SVE 
vectors where the element type doesn't match but the vector size is equal but 
that wasn't the case. Since no functional changes were necessary to support 
casting between these types I tried the following:
```#include <stdint.h>

#define N 128

typedef float float32_t;
typedef double float64_t;

typedef float32_t gnu_float32_t __attribute__((vector_size(N/8)));
typedef float64_t gnu_float64_t __attribute__((vector_size(N/8)));

gnu_float32_t foo(gnu_float64_t x) { return (gnu_float32_t)x; }
gnu_float64_t bar(gnu_float32_t x) { return (gnu_float64_t)x; }```

It seems Clang considers this implicit cast valid whereas GCC doesn't, even 
with lax vector conversions enabled.


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

https://reviews.llvm.org/D87607

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to