xref: /llvm-project/clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/target.c (revision ad702e057cf7fc1ffdc0f78f563b416170ea7d57)
1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64 -target-feature +neon -verify -emit-llvm -o - %s
3 
4 #include <arm_neon_sve_bridge.h>
5 
6 __attribute__((target("sve")))
target_sve(svint8_t s,int8x16_t n)7 void target_sve(svint8_t s, int8x16_t n) {
8   svset_neonq_s8(s, n);
9   svget_neonq_s8(s);
10   svdup_neonq_s8(n);
11 }
12 
13 __attribute__((target("sve,bf16")))
target_svebf16(svbfloat16_t t,bfloat16x8_t m)14 void target_svebf16(svbfloat16_t t, bfloat16x8_t m) {
15   svset_neonq_bf16(t, m);
16   svget_neonq_bf16(t);
17   svdup_neonq_bf16(m);
18 }
19 
base(int8x16_t n,bfloat16x8_t m)20 void base(int8x16_t n, bfloat16x8_t m) {
21   // expected-error@+3 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
22   // expected-error@+2 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
23   // expected-error@+1 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
24   svset_neonq_s8(svundef_s8(), n);
25   // expected-error@+2 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
26   // expected-error@+1 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
27   svget_neonq_s8(svundef_s8());
28   // expected-error@+1 {{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}
29   svdup_neonq_s8(n);
30 
31   // expected-error@+3 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
32   // expected-error@+2 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
33   // expected-error@+1 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
34   svset_neonq_bf16(svundef_bf16(), m);
35   // expected-error@+2 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
36   // expected-error@+1 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
37   svget_neonq_bf16(svundef_bf16());
38   // expected-error@+1 {{SVE vector type 'svbfloat16_t' (aka '__SVBfloat16_t') cannot be used in a target without sve}}
39   svdup_neonq_bf16(m);
40 }
41