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 // Test that the +sve-b16b16 is not considered an SVE flag (it applies to both) 42 __attribute__((target("+sme2,+sve2,+sve-b16b16"))) 43 svbfloat16_t good7(svbfloat16_t a, svbfloat16_t b, svbfloat16_t c) __arm_streaming { 44 return svclamp_bf16(a, b, c); 45 } 46 47 // Without '+sme2', the builtin is only valid in non-streaming mode. 48 __attribute__((target("+sve2p1,+sme"))) 49 svfloat32_t bad1(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming { 50 return svclamp(a, b, c) + svclamp(a, b, c); // expected-error{{builtin can only be called from a non-streaming function}} \ 51 // expected-error{{builtin can only be called from a non-streaming function}} 52 } 53 54 // Without '+sve2p1', the builtin is only valid in streaming mode. 55 __attribute__((target("+sve2,+sme2"))) 56 svfloat32_t bad2(svfloat32_t a, svfloat32_t b, svfloat32_t c) { 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 __attribute__((target("+sve2,+sme2"))) 62 svfloat32_t bad4(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_compatible { 63 return svclamp(a, b, c) + svclamp(a, b, c); // expected-error{{builtin can only be called from a streaming function}} \ 64 // expected-error{{builtin can only be called from a streaming function}} 65 } 66 67 // We don't want a warning about undefined behaviour if none of the feature requirements of the builtin are satisfied. 68 // (this results in a target-guard error emitted by Clang CodeGen) 69 svfloat32_t bad5(svfloat32_t a, svfloat32_t b, svfloat32_t c) { 70 return svclamp(a, b, c); 71 } 72