[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / aarch64-sve-vector-bits.c
blob535b0f157019a8b4c7296d5cf7d1e4f3a91e690c
1 // -----------------------------------------------------------------------------
2 // Tests for the -msve-vector-bits flag
3 // -----------------------------------------------------------------------------
5 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
6 // RUN: -msve-vector-bits=128 2>&1 | FileCheck --check-prefix=CHECK-128 %s
7 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
8 // RUN: -msve-vector-bits=256 2>&1 | FileCheck --check-prefix=CHECK-256 %s
9 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
10 // RUN: -msve-vector-bits=512 2>&1 | FileCheck --check-prefix=CHECK-512 %s
11 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
12 // RUN: -msve-vector-bits=1024 2>&1 | FileCheck --check-prefix=CHECK-1024 %s
13 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
14 // RUN: -msve-vector-bits=2048 2>&1 | FileCheck --check-prefix=CHECK-2048 %s
15 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
16 // RUN: -msve-vector-bits=128+ 2>&1 | FileCheck --check-prefix=CHECK-128P %s
17 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
18 // RUN: -msve-vector-bits=256+ 2>&1 | FileCheck --check-prefix=CHECK-256P %s
19 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
20 // RUN: -msve-vector-bits=512+ 2>&1 | FileCheck --check-prefix=CHECK-512P %s
21 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
22 // RUN: -msve-vector-bits=1024+ 2>&1 | FileCheck --check-prefix=CHECK-1024P %s
23 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
24 // RUN: -msve-vector-bits=2048+ 2>&1 | FileCheck --check-prefix=CHECK-2048P %s
25 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
26 // RUN: -msve-vector-bits=scalable 2>&1 | FileCheck --check-prefix=CHECK-SCALABLE %s
28 // CHECK-128: "-mvscale-max=1" "-mvscale-min=1"
29 // CHECK-256: "-mvscale-max=2" "-mvscale-min=2"
30 // CHECK-512: "-mvscale-max=4" "-mvscale-min=4"
31 // CHECK-1024: "-mvscale-max=8" "-mvscale-min=8"
32 // CHECK-2048: "-mvscale-max=16" "-mvscale-min=16"
34 // CHECK-128P: "-mvscale-min=1"
35 // CHECK-128P-NOT: "-mvscale-max"
36 // CHECK-256P: "-mvscale-min=2"
37 // CHECK-256P-NOT: "-mvscale-max"
38 // CHECK-512P: "-mvscale-min=4"
39 // CHECK-512P-NOT: "-mvscale-max"
40 // CHECK-1024P: "-mvscale-min=8"
41 // CHECK-1024P-NOT: "-mvscale-max"
42 // CHECK-2048P: "-mvscale-min=16"
43 // CHECK-2048P-NOT: "-mvscale-max"
44 // CHECK-SCALABLE-NOT: "-mvscale-min=
45 // CHECK-SCALABLE-NOT: "-mvscale-max=
47 // Error out if an unsupported value is passed to -msve-vector-bits.
48 // -----------------------------------------------------------------------------
49 // RUN: not %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
50 // RUN: -msve-vector-bits=64 2>&1 | FileCheck --check-prefix=CHECK-BAD-VALUE-ERROR %s
51 // RUN: not %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
52 // RUN: -msve-vector-bits=A 2>&1 | FileCheck --check-prefix=CHECK-BAD-VALUE-ERROR %s
54 // CHECK-BAD-VALUE-ERROR: error: unsupported argument '{{.*}}' to option '-msve-vector-bits='
56 // Error if using attribute without -msve-vector-bits=<bits> or if using -msve-vector-bits=<bits>+ syntax
57 // -----------------------------------------------------------------------------
58 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
59 // RUN: -march=armv8-a+sve 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
60 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
61 // RUN: -march=armv8-a+sve -msve-vector-bits=scalable 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
62 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
63 // RUN: -march=armv8-a+sve -msve-vector-bits=256+ 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
65 typedef __SVInt32_t svint32_t;
66 typedef svint32_t noflag __attribute__((arm_sve_vector_bits(256)));
68 // CHECK-NO-FLAG-ERROR: error: 'arm_sve_vector_bits' is only supported when '-msve-vector-bits=<bits>' is specified with a value of 128, 256, 512, 1024 or 2048
70 // Error if attribute vector size != -msve-vector-bits
71 // -----------------------------------------------------------------------------
72 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
73 // RUN: -march=armv8-a+sve -msve-vector-bits=128 2>&1 | FileCheck --check-prefix=CHECK-BAD-VECTOR-SIZE-ERROR %s
75 typedef svint32_t bad_vector_size __attribute__((arm_sve_vector_bits(256)));
77 // CHECK-BAD-VECTOR-SIZE-ERROR: error: invalid SVE vector size '256', must match value set by '-msve-vector-bits' ('128')