Debian Codegraph @

clang/test/Sema/aarch64-streaming-sme-or-nonstreaming-sve-builtins.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify %s
3
4 // REQUIRES: aarch64-registered-target
5
6 #include <arm_sve.h>
7
8 __attribute__((target("+sve2p1")))
9 svfloat32_t good1(svfloat32_t a, svfloat32_t b, svfloat32_t c) {
10 return svclamp(a, b, c);
11 }
12
13 __attribute__((target("+sme2")))
14 svfloat32_t good2(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming {
15 return svclamp(a, b, c);
16 }
17
18 __attribute__((target("+sve2p1,+sme2")))
19 svfloat32_t good3(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_compatible {
20 return svclamp(a, b, c);
21 }
22
23 __attribute__((target("+sve2p1,+sme2")))
24 svfloat32_t good4(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming {
25 return svclamp(a, b, c);
26 }
27
28 __attribute__((target("+sve2p1")))
29 svfloat32_t good5(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_compatible {
30 return svclamp(a, b, c);
31 }
32
33 // Even though svclamp is not available in streaming mode without +sme2,
34 // the behaviour should be the same as above, irrespective of whether +sme
35 // is passed or not.
36 __attribute__((target("+sve2p1,+sme")))
37 svfloat32_t good6(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_compatible {
38 return svclamp(a, b, c);
39 }
40
41 // Without '+sme2', the builtin is only valid in non-streaming mode.
42 __attribute__((target("+sve2p1,+sme")))
43 svfloat32_t bad1(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming {
44 return svclamp(a, b, c) + svclamp(a, b, c); // expected-error{{builtin can only be called from a non-streaming function}} \
45 // expected-error{{builtin can only be called from a non-streaming function}}
46 }
47
48 // Without '+sve2p1', the builtin is only valid in streaming mode.
49 __attribute__((target("+sve2,+sme2")))
50 svfloat32_t bad2(svfloat32_t a, svfloat32_t b, svfloat32_t c) {
51 return svclamp(a, b, c) + svclamp(a, b, c); // expected-error{{builtin can only be called from a streaming function}} \
52 // expected-error{{builtin can only be called from a streaming function}}
53 }
54
55 __attribute__((target("+sve2,+sme2")))
56 svfloat32_t bad4(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_compatible {
57 return svclamp(a, b, c) + svclamp(a, b, c); // expected-error{{builtin can only be called from a streaming function}} \
58 // expected-error{{builtin can only be called from a streaming function}}
59 }
60
61 // We don't want a warning about undefined behaviour if none of the feature requirements of the builtin are satisfied.
62 // (this results in a target-guard error emitted by Clang CodeGen)
63 svfloat32_t bad5(svfloat32_t a, svfloat32_t b, svfloat32_t c) {
64 return svclamp(a, b, c);
65 }