File: aarch64-incompat-sm-builtin-calls.c

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (118 lines) | stat: -rw-r--r-- 6,245 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1  -triple aarch64-none-linux-gnu -target-feature +sve \
// RUN:   -target-feature +bf16 -target-feature +sve -target-feature +sme -target-feature +sme2 -target-feature +sve2 -target-feature +neon -Waarch64-sme-attributes -fsyntax-only -verify %s

// REQUIRES: aarch64-registered-target

#include "arm_neon.h"
#include "arm_sme.h"
#include "arm_sve.h"

int16x8_t incompat_neon_sm(int16x8_t splat) __arm_streaming {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
}

__arm_locally_streaming int16x8_t incompat_neon_ls(int16x8_t splat) {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
}

int16x8_t incompat_neon_smc(int16x8_t splat) __arm_streaming_compatible {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33);
}

void incompat_sme_smc(svbool_t pg, void const *ptr) __arm_streaming_compatible __arm_inout("za") {
  // expected-error@+1 {{builtin can only be called from a streaming function}}
  return __builtin_sme_svld1_hor_za128(0, 0, pg, ptr);
}

svuint32_t incompat_sve_sm(svbool_t pg, svuint32_t a, int16_t b) __arm_streaming {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
}

// expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
// expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
__arm_locally_streaming svuint32_t incompat_sve_ls(svbool_t pg, svuint32_t a, int64_t b) {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
}

svuint32_t incompat_sve_smc(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming_compatible {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
}

svuint32_t incompat_sve2_sm(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
}

// expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
// expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
__arm_locally_streaming svuint32_t incompat_sve2_ls(svbool_t pg, svuint32_t a, int64_t b) {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
}

svuint32_t incompat_sve2_smc(svbool_t pg, svuint32_t a, int64_t b) __arm_streaming_compatible {
  // expected-error@+1 {{builtin can only be called from a non-streaming function}}
  return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
}

void incompat_sme_sm(svbool_t pn, svbool_t pm, svfloat32_t zn, svfloat32_t zm) __arm_inout("za") {
  // expected-error@+1 {{builtin can only be called from a streaming function}}
  svmops_za32_f32_m(0, pn, pm, zn, zm);
}

svfloat64_t streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_streaming {
  return svadd_n_f64_m(pg, a, b);
}

// expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
// expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
__arm_locally_streaming svfloat64_t locally_streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) {
  return svadd_n_f64_m(pg, a, b);
}

svfloat64_t streaming_compatible_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_streaming_compatible {
  return svadd_n_f64_m(pg, a, b);
}

svint16_t streaming_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming {
  return svmul_lane_s16(op1, op2, 0);
}

// expected-warning@+2 {{returning a VL-dependent argument from a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
// expected-warning@+1 {{passing a VL-dependent argument to a locally streaming function is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}
__arm_locally_streaming svint16_t locally_streaming_caller_sve2(svint16_t op1, svint16_t op2) {
  return svmul_lane_s16(op1, op2, 0);
}

svint16_t streaming_compatible_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming_compatible {
  return svmul_lane_s16(op1, op2, 0);
}

svbool_t streaming_caller_ptrue(void) __arm_streaming {
  return svand_z(svptrue_b16(), svptrue_pat_b16(SV_ALL), svptrue_pat_b16(SV_VL4));
}

svint8_t missing_za(svint8_t zd, svbool_t pg, uint32_t slice_base) __arm_streaming {
  // expected-warning@+1 {{builtin call is not valid when calling from a function without active ZA state}}
    return svread_hor_za8_s8_m(zd, pg, 0, slice_base);
}

__arm_new("za")
svint8_t new_za(svint8_t zd, svbool_t pg, uint32_t slice_base) __arm_streaming {
    return svread_hor_za8_s8_m(zd, pg, 0, slice_base);
}

void missing_zt0(void) __arm_streaming {
  // expected-warning@+1 {{builtin call is not valid when calling from a function without active ZT0 state}}
  svzero_zt(0);
}

__arm_new("zt0")
void new_zt0(void) __arm_streaming { svzero_zt(0); }