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