1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
5 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
6 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
7 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
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
14 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
17 // CHECK-LABEL: @test_svdot_s32(
19 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]])
20 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
22 // CPP-CHECK-LABEL: @_Z14test_svdot_s32u11__SVInt32_tu10__SVInt8_tS0_(
23 // CPP-CHECK-NEXT: entry:
24 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]])
25 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
27 svint32_t
test_svdot_s32(svint32_t op1
, svint8_t op2
, svint8_t op3
)
29 return SVE_ACLE_FUNC(svdot
,_s32
,,)(op1
, op2
, op3
);
32 // CHECK-LABEL: @test_svdot_s64(
34 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]])
35 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
37 // CPP-CHECK-LABEL: @_Z14test_svdot_s64u11__SVInt64_tu11__SVInt16_tS0_(
38 // CPP-CHECK-NEXT: entry:
39 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]])
40 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
42 svint64_t
test_svdot_s64(svint64_t op1
, svint16_t op2
, svint16_t op3
)
44 return SVE_ACLE_FUNC(svdot
,_s64
,,)(op1
, op2
, op3
);
47 // CHECK-LABEL: @test_svdot_u32(
49 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]])
50 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
52 // CPP-CHECK-LABEL: @_Z14test_svdot_u32u12__SVUint32_tu11__SVUint8_tS0_(
53 // CPP-CHECK-NEXT: entry:
54 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]])
55 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
57 svuint32_t
test_svdot_u32(svuint32_t op1
, svuint8_t op2
, svuint8_t op3
)
59 return SVE_ACLE_FUNC(svdot
,_u32
,,)(op1
, op2
, op3
);
62 // CHECK-LABEL: @test_svdot_u64(
64 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]])
65 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
67 // CPP-CHECK-LABEL: @_Z14test_svdot_u64u12__SVUint64_tu12__SVUint16_tS0_(
68 // CPP-CHECK-NEXT: entry:
69 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]])
70 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
72 svuint64_t
test_svdot_u64(svuint64_t op1
, svuint16_t op2
, svuint16_t op3
)
74 return SVE_ACLE_FUNC(svdot
,_u64
,,)(op1
, op2
, op3
);
77 // CHECK-LABEL: @test_svdot_n_s32(
79 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[OP3:%.*]], i64 0
80 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
81 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[DOTSPLAT]])
82 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
84 // CPP-CHECK-LABEL: @_Z16test_svdot_n_s32u11__SVInt32_tu10__SVInt8_ta(
85 // CPP-CHECK-NEXT: entry:
86 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[OP3:%.*]], i64 0
87 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
88 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[DOTSPLAT]])
89 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
91 svint32_t
test_svdot_n_s32(svint32_t op1
, svint8_t op2
, int8_t op3
)
93 return SVE_ACLE_FUNC(svdot
,_n_s32
,,)(op1
, op2
, op3
);
96 // CHECK-LABEL: @test_svdot_n_s64(
98 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP3:%.*]], i64 0
99 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
100 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
101 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
103 // CPP-CHECK-LABEL: @_Z16test_svdot_n_s64u11__SVInt64_tu11__SVInt16_ts(
104 // CPP-CHECK-NEXT: entry:
105 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP3:%.*]], i64 0
106 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
107 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
108 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
110 svint64_t
test_svdot_n_s64(svint64_t op1
, svint16_t op2
, int16_t op3
)
112 return SVE_ACLE_FUNC(svdot
,_n_s64
,,)(op1
, op2
, op3
);
115 // CHECK-LABEL: @test_svdot_n_u32(
116 // CHECK-NEXT: entry:
117 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[OP3:%.*]], i64 0
118 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
119 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[DOTSPLAT]])
120 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
122 // CPP-CHECK-LABEL: @_Z16test_svdot_n_u32u12__SVUint32_tu11__SVUint8_th(
123 // CPP-CHECK-NEXT: entry:
124 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 16 x i8> poison, i8 [[OP3:%.*]], i64 0
125 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 16 x i8> [[DOTSPLATINSERT]], <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
126 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[DOTSPLAT]])
127 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
129 svuint32_t
test_svdot_n_u32(svuint32_t op1
, svuint8_t op2
, uint8_t op3
)
131 return SVE_ACLE_FUNC(svdot
,_n_u32
,,)(op1
, op2
, op3
);
134 // CHECK-LABEL: @test_svdot_n_u64(
135 // CHECK-NEXT: entry:
136 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP3:%.*]], i64 0
137 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
138 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
139 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
141 // CPP-CHECK-LABEL: @_Z16test_svdot_n_u64u12__SVUint64_tu12__SVUint16_tt(
142 // CPP-CHECK-NEXT: entry:
143 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP3:%.*]], i64 0
144 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
145 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
146 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
148 svuint64_t
test_svdot_n_u64(svuint64_t op1
, svuint16_t op2
, uint16_t op3
)
150 return SVE_ACLE_FUNC(svdot
,_n_u64
,,)(op1
, op2
, op3
);
153 // CHECK-LABEL: @test_svdot_lane_s32(
154 // CHECK-NEXT: entry:
155 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 0)
156 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
158 // CPP-CHECK-LABEL: @_Z19test_svdot_lane_s32u11__SVInt32_tu10__SVInt8_tS0_(
159 // CPP-CHECK-NEXT: entry:
160 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 0)
161 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
163 svint32_t
test_svdot_lane_s32(svint32_t op1
, svint8_t op2
, svint8_t op3
)
165 return SVE_ACLE_FUNC(svdot_lane
,_s32
,,)(op1
, op2
, op3
, 0);
168 // CHECK-LABEL: @test_svdot_lane_s32_1(
169 // CHECK-NEXT: entry:
170 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 3)
171 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
173 // CPP-CHECK-LABEL: @_Z21test_svdot_lane_s32_1u11__SVInt32_tu10__SVInt8_tS0_(
174 // CPP-CHECK-NEXT: entry:
175 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 3)
176 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
178 svint32_t
test_svdot_lane_s32_1(svint32_t op1
, svint8_t op2
, svint8_t op3
)
180 return SVE_ACLE_FUNC(svdot_lane
,_s32
,,)(op1
, op2
, op3
, 3);
183 // CHECK-LABEL: @test_svdot_lane_s64(
184 // CHECK-NEXT: entry:
185 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 0)
186 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
188 // CPP-CHECK-LABEL: @_Z19test_svdot_lane_s64u11__SVInt64_tu11__SVInt16_tS0_(
189 // CPP-CHECK-NEXT: entry:
190 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 0)
191 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
193 svint64_t
test_svdot_lane_s64(svint64_t op1
, svint16_t op2
, svint16_t op3
)
195 return SVE_ACLE_FUNC(svdot_lane
,_s64
,,)(op1
, op2
, op3
, 0);
198 // CHECK-LABEL: @test_svdot_lane_s64_1(
199 // CHECK-NEXT: entry:
200 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 1)
201 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
203 // CPP-CHECK-LABEL: @_Z21test_svdot_lane_s64_1u11__SVInt64_tu11__SVInt16_tS0_(
204 // CPP-CHECK-NEXT: entry:
205 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 1)
206 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
208 svint64_t
test_svdot_lane_s64_1(svint64_t op1
, svint16_t op2
, svint16_t op3
)
210 return SVE_ACLE_FUNC(svdot_lane
,_s64
,,)(op1
, op2
, op3
, 1);
213 // CHECK-LABEL: @test_svdot_lane_u32(
214 // CHECK-NEXT: entry:
215 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 3)
216 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
218 // CPP-CHECK-LABEL: @_Z19test_svdot_lane_u32u12__SVUint32_tu11__SVUint8_tS0_(
219 // CPP-CHECK-NEXT: entry:
220 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.udot.lane.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 16 x i8> [[OP2:%.*]], <vscale x 16 x i8> [[OP3:%.*]], i32 3)
221 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
223 svuint32_t
test_svdot_lane_u32(svuint32_t op1
, svuint8_t op2
, svuint8_t op3
)
225 return SVE_ACLE_FUNC(svdot_lane
,_u32
,,)(op1
, op2
, op3
, 3);
228 // CHECK-LABEL: @test_svdot_lane_u64(
229 // CHECK-NEXT: entry:
230 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 1)
231 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
233 // CPP-CHECK-LABEL: @_Z19test_svdot_lane_u64u12__SVUint64_tu12__SVUint16_tS0_(
234 // CPP-CHECK-NEXT: entry:
235 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.aarch64.sve.udot.lane.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]], <vscale x 8 x i16> [[OP3:%.*]], i32 1)
236 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
238 svuint64_t
test_svdot_lane_u64(svuint64_t op1
, svuint16_t op2
, svuint16_t op3
)
240 return SVE_ACLE_FUNC(svdot_lane
,_u64
,,)(op1
, op2
, op3
, 1);