[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / arm-mfp8.cpp
blobbe5bc9bb71dbd236632d545d45f492703112d7a2
1 // RUN: %clang_cc1 -fsyntax-only -verify=sve,neon,scalar -triple aarch64-arm-none-eabi \
2 // RUN: -target-feature -fp8 -target-feature +sve -target-feature +neon %s
4 // REQUIRES: aarch64-registered-target
6 __mfp8 test_static_cast_from_char(char in) {
7 return static_cast<__mfp8>(in); // scalar-error {{static_cast from 'char' to '__mfp8' is not allowed}}
10 char test_static_cast_to_char(__mfp8 in) {
11 return static_cast<char>(in); // scalar-error {{static_cast from '__mfp8' to 'char' is not allowed}}
14 void test(bool b) {
15 __mfp8 mfp8;
17 mfp8 + mfp8; // scalar-error {{invalid operands to binary expression ('__mfp8' and '__mfp8')}}
18 mfp8 - mfp8; // scalar-error {{invalid operands to binary expression ('__mfp8' and '__mfp8')}}
19 mfp8 * mfp8; // scalar-error {{invalid operands to binary expression ('__mfp8' and '__mfp8')}}
20 mfp8 / mfp8; // scalar-error {{invalid operands to binary expression ('__mfp8' and '__mfp8')}}
21 ++mfp8; // scalar-error {{cannot increment value of type '__mfp8'}}
22 --mfp8; // scalar-error {{cannot decrement value of type '__mfp8'}}
24 char u8;
26 mfp8 + u8; // scalar-error {{invalid operands to binary expression ('__mfp8' and 'char')}}
27 u8 + mfp8; // scalar-error {{invalid operands to binary expression ('char' and '__mfp8')}}
28 mfp8 - u8; // scalar-error {{invalid operands to binary expression ('__mfp8' and 'char')}}
29 u8 - mfp8; // scalar-error {{invalid operands to binary expression ('char' and '__mfp8')}}
30 mfp8 * u8; // scalar-error {{invalid operands to binary expression ('__mfp8' and 'char')}}
31 u8 * mfp8; // scalar-error {{invalid operands to binary expression ('char' and '__mfp8')}}
32 mfp8 / u8; // scalar-error {{invalid operands to binary expression ('__mfp8' and 'char')}}
33 u8 / mfp8; // scalar-error {{invalid operands to binary expression ('char' and '__mfp8')}}
34 mfp8 = u8; // scalar-error {{assigning to '__mfp8' from incompatible type 'char'}}
35 u8 = mfp8; // scalar-error {{assigning to 'char' from incompatible type '__mfp8'}}
36 mfp8 + (b ? u8 : mfp8); // scalar-error {{incompatible operand types ('char' and '__mfp8')}}
39 #include <arm_sve.h>
40 void test_vector_sve(svmfloat8_t a, svuint8_t c) {
41 a + c; // sve-error {{cannot convert between vector type 'svuint8_t' (aka '__SVUint8_t') and vector type 'svmfloat8_t' (aka '__SVMfloat8_t') as implicit conversion would cause truncation}}
42 a - c; // sve-error {{cannot convert between vector type 'svuint8_t' (aka '__SVUint8_t') and vector type 'svmfloat8_t' (aka '__SVMfloat8_t') as implicit conversion would cause truncation}}
43 a * c; // sve-error {{cannot convert between vector type 'svuint8_t' (aka '__SVUint8_t') and vector type 'svmfloat8_t' (aka '__SVMfloat8_t') as implicit conversion would cause truncation}}
44 a / c; // sve-error {{cannot convert between vector type 'svuint8_t' (aka '__SVUint8_t') and vector type 'svmfloat8_t' (aka '__SVMfloat8_t') as implicit conversion would cause truncation}}
48 #include <arm_neon.h>
50 void test_vector(mfloat8x8_t a, mfloat8x16_t b, uint8x8_t c) {
51 a + b; // neon-error {{invalid operands to binary expression ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
52 a - b; // neon-error {{invalid operands to binary expression ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
53 a * b; // neon-error {{invalid operands to binary expression ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
54 a / b; // neon-error {{invalid operands to binary expression ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
56 a + c; // neon-error {{cannot convert between vector and non-scalar values ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'uint8x8_t' (vector of 8 'uint8_t' values))}}
57 a - c; // neon-error {{cannot convert between vector and non-scalar values ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'uint8x8_t' (vector of 8 'uint8_t' values))}}
58 a * c; // neon-error {{cannot convert between vector and non-scalar values ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'uint8x8_t' (vector of 8 'uint8_t' values))}}
59 a / c; // neon-error {{cannot convert between vector and non-scalar values ('mfloat8x8_t' (aka '__MFloat8x8_t') and 'uint8x8_t' (vector of 8 'uint8_t' values))}}
60 c + b; // neon-error {{cannot convert between vector and non-scalar values ('uint8x8_t' (vector of 8 'uint8_t' values) and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
61 c - b; // neon-error {{cannot convert between vector and non-scalar values ('uint8x8_t' (vector of 8 'uint8_t' values) and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
62 c * b; // neon-error {{cannot convert between vector and non-scalar values ('uint8x8_t' (vector of 8 'uint8_t' values) and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}
63 c / b; // neon-error {{cannot convert between vector and non-scalar values ('uint8x8_t' (vector of 8 'uint8_t' values) and 'mfloat8x16_t' (aka '__MFloat8x16_t'))}}