1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
3 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
6 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s
7
8 #include <arm_sve.h>
9
10 #ifdef SVE_OVERLOADED_FORMS
11 // A simple used,unused... macro, long enough to represent any SVE builtin.
12 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
13 #else
14 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
15 #endif
16
test_svsra_n_s8(svint8_t op1,svint8_t op2)17 svint8_t test_svsra_n_s8(svint8_t op1, svint8_t op2)
18 {
19 // CHECK-LABEL: test_svsra_n_s8
20 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.ssra.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 1)
21 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
22 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
23 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s8'}}
24 return SVE_ACLE_FUNC(svsra,_n_s8,,)(op1, op2, 1);
25 }
26
test_svsra_n_s8_1(svint8_t op1,svint8_t op2)27 svint8_t test_svsra_n_s8_1(svint8_t op1, svint8_t op2)
28 {
29 // CHECK-LABEL: test_svsra_n_s8_1
30 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.ssra.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 8)
31 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
32 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
33 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s8'}}
34 return SVE_ACLE_FUNC(svsra,_n_s8,,)(op1, op2, 8);
35 }
36
test_svsra_n_s16(svint16_t op1,svint16_t op2)37 svint16_t test_svsra_n_s16(svint16_t op1, svint16_t op2)
38 {
39 // CHECK-LABEL: test_svsra_n_s16
40 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.ssra.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 1)
41 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
42 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
43 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s16'}}
44 return SVE_ACLE_FUNC(svsra,_n_s16,,)(op1, op2, 1);
45 }
46
test_svsra_n_s16_1(svint16_t op1,svint16_t op2)47 svint16_t test_svsra_n_s16_1(svint16_t op1, svint16_t op2)
48 {
49 // CHECK-LABEL: test_svsra_n_s16_1
50 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.ssra.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 16)
51 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
52 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
53 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s16'}}
54 return SVE_ACLE_FUNC(svsra,_n_s16,,)(op1, op2, 16);
55 }
56
test_svsra_n_s32(svint32_t op1,svint32_t op2)57 svint32_t test_svsra_n_s32(svint32_t op1, svint32_t op2)
58 {
59 // CHECK-LABEL: test_svsra_n_s32
60 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.ssra.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 1)
61 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
62 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
63 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s32'}}
64 return SVE_ACLE_FUNC(svsra,_n_s32,,)(op1, op2, 1);
65 }
66
test_svsra_n_s32_1(svint32_t op1,svint32_t op2)67 svint32_t test_svsra_n_s32_1(svint32_t op1, svint32_t op2)
68 {
69 // CHECK-LABEL: test_svsra_n_s32_1
70 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.ssra.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 32)
71 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
72 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
73 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s32'}}
74 return SVE_ACLE_FUNC(svsra,_n_s32,,)(op1, op2, 32);
75 }
76
test_svsra_n_s64(svint64_t op1,svint64_t op2)77 svint64_t test_svsra_n_s64(svint64_t op1, svint64_t op2)
78 {
79 // CHECK-LABEL: test_svsra_n_s64
80 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.ssra.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 1)
81 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
82 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
83 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s64'}}
84 return SVE_ACLE_FUNC(svsra,_n_s64,,)(op1, op2, 1);
85 }
86
test_svsra_n_s64_1(svint64_t op1,svint64_t op2)87 svint64_t test_svsra_n_s64_1(svint64_t op1, svint64_t op2)
88 {
89 // CHECK-LABEL: test_svsra_n_s64_1
90 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.ssra.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 64)
91 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
92 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
93 // expected-warning@+1 {{implicit declaration of function 'svsra_n_s64'}}
94 return SVE_ACLE_FUNC(svsra,_n_s64,,)(op1, op2, 64);
95 }
96
test_svsra_n_u8(svuint8_t op1,svuint8_t op2)97 svuint8_t test_svsra_n_u8(svuint8_t op1, svuint8_t op2)
98 {
99 // CHECK-LABEL: test_svsra_n_u8
100 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.usra.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 1)
101 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
102 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
103 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u8'}}
104 return SVE_ACLE_FUNC(svsra,_n_u8,,)(op1, op2, 1);
105 }
106
test_svsra_n_u8_1(svuint8_t op1,svuint8_t op2)107 svuint8_t test_svsra_n_u8_1(svuint8_t op1, svuint8_t op2)
108 {
109 // CHECK-LABEL: test_svsra_n_u8_1
110 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.usra.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 8)
111 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
112 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
113 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u8'}}
114 return SVE_ACLE_FUNC(svsra,_n_u8,,)(op1, op2, 8);
115 }
116
test_svsra_n_u16(svuint16_t op1,svuint16_t op2)117 svuint16_t test_svsra_n_u16(svuint16_t op1, svuint16_t op2)
118 {
119 // CHECK-LABEL: test_svsra_n_u16
120 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.usra.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 1)
121 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
122 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
123 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u16'}}
124 return SVE_ACLE_FUNC(svsra,_n_u16,,)(op1, op2, 1);
125 }
126
test_svsra_n_u16_1(svuint16_t op1,svuint16_t op2)127 svuint16_t test_svsra_n_u16_1(svuint16_t op1, svuint16_t op2)
128 {
129 // CHECK-LABEL: test_svsra_n_u16_1
130 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.usra.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 16)
131 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
132 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
133 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u16'}}
134 return SVE_ACLE_FUNC(svsra,_n_u16,,)(op1, op2, 16);
135 }
136
test_svsra_n_u32(svuint32_t op1,svuint32_t op2)137 svuint32_t test_svsra_n_u32(svuint32_t op1, svuint32_t op2)
138 {
139 // CHECK-LABEL: test_svsra_n_u32
140 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.usra.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 1)
141 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
142 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
143 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u32'}}
144 return SVE_ACLE_FUNC(svsra,_n_u32,,)(op1, op2, 1);
145 }
146
test_svsra_n_u32_1(svuint32_t op1,svuint32_t op2)147 svuint32_t test_svsra_n_u32_1(svuint32_t op1, svuint32_t op2)
148 {
149 // CHECK-LABEL: test_svsra_n_u32_1
150 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.usra.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 32)
151 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
152 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
153 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u32'}}
154 return SVE_ACLE_FUNC(svsra,_n_u32,,)(op1, op2, 32);
155 }
156
test_svsra_n_u64(svuint64_t op1,svuint64_t op2)157 svuint64_t test_svsra_n_u64(svuint64_t op1, svuint64_t op2)
158 {
159 // CHECK-LABEL: test_svsra_n_u64
160 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.usra.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 1)
161 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
162 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
163 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u64'}}
164 return SVE_ACLE_FUNC(svsra,_n_u64,,)(op1, op2, 1);
165 }
166
test_svsra_n_u64_1(svuint64_t op1,svuint64_t op2)167 svuint64_t test_svsra_n_u64_1(svuint64_t op1, svuint64_t op2)
168 {
169 // CHECK-LABEL: test_svsra_n_u64_1
170 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.usra.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 64)
171 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
172 // overload-warning@+2 {{implicit declaration of function 'svsra'}}
173 // expected-warning@+1 {{implicit declaration of function 'svsra_n_u64'}}
174 return SVE_ACLE_FUNC(svsra,_n_u64,,)(op1, op2, 64);
175 }
176