Debian Codegraph @

clang/test/Driver/aarch64-sve-vector-bits.c

raw
1 // -----------------------------------------------------------------------------
2 // Tests for the -msve-vector-bits flag
3 // -----------------------------------------------------------------------------
4
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
27 // RUN: %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve+sme \
28 // RUN: -msve-streaming-vector-bits=128 2>&1 | FileCheck --check-prefix=STREAMING-128 %s
29
30 // CHECK-128: "-mvscale-max=1" "-mvscale-min=1"
31 // CHECK-256: "-mvscale-max=2" "-mvscale-min=2"
32 // CHECK-512: "-mvscale-max=4" "-mvscale-min=4"
33 // CHECK-1024: "-mvscale-max=8" "-mvscale-min=8"
34 // CHECK-2048: "-mvscale-max=16" "-mvscale-min=16"
35
36 // CHECK-128P: "-mvscale-min=1"
37 // CHECK-128P-NOT: "-mvscale-max"
38 // CHECK-256P: "-mvscale-min=2"
39 // CHECK-256P-NOT: "-mvscale-max"
40 // CHECK-512P: "-mvscale-min=4"
41 // CHECK-512P-NOT: "-mvscale-max"
42 // CHECK-1024P: "-mvscale-min=8"
43 // CHECK-1024P-NOT: "-mvscale-max"
44 // CHECK-2048P: "-mvscale-min=16"
45 // CHECK-2048P-NOT: "-mvscale-max"
46 // CHECK-SCALABLE-NOT: "-mvscale-min=
47 // CHECK-SCALABLE-NOT: "-mvscale-max=
48
49 // STREAMING-128: "-mvscale-streaming-max=1" "-mvscale-streaming-min=1"
50
51 // Error out if an unsupported value is passed to -msve-vector-bits.
52 // -----------------------------------------------------------------------------
53 // RUN: not %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
54 // RUN: -msve-vector-bits=64 2>&1 | FileCheck --check-prefix=CHECK-BAD-VALUE-ERROR %s
55 // RUN: not %clang -c %s -### --target=aarch64-none-linux-gnu -march=armv8-a+sve \
56 // RUN: -msve-vector-bits=A 2>&1 | FileCheck --check-prefix=CHECK-BAD-VALUE-ERROR %s
57
58 // CHECK-BAD-VALUE-ERROR: error: unsupported argument '{{.*}}' to option '-msve-vector-bits='
59
60 // Error if using attribute without -msve-vector-bits=<bits> or if using -msve-vector-bits=<bits>+ syntax
61 // -----------------------------------------------------------------------------
62 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
63 // RUN: -march=armv8-a+sve 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
64 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
65 // RUN: -march=armv8-a+sve -msve-vector-bits=scalable 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
66 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
67 // RUN: -march=armv8-a+sve -msve-vector-bits=256+ 2>&1 | FileCheck --check-prefix=CHECK-NO-FLAG-ERROR %s
68
69 typedef __SVInt32_t svint32_t;
70 typedef svint32_t noflag __attribute__((arm_sve_vector_bits(256)));
71
72 // 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
73
74 // Error if attribute vector size != -msve-vector-bits
75 // -----------------------------------------------------------------------------
76 // RUN: not %clang -c %s -o /dev/null --target=aarch64-none-linux-gnu \
77 // RUN: -march=armv8-a+sve -msve-vector-bits=128 2>&1 | FileCheck --check-prefix=CHECK-BAD-VECTOR-SIZE-ERROR %s
78
79 typedef svint32_t bad_vector_size __attribute__((arm_sve_vector_bits(256)));
80
81 // CHECK-BAD-VECTOR-SIZE-ERROR: error: invalid SVE vector size '256', must match value set by '-msve-vector-bits' ('128')