Debian Codegraph @

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get4.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -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 -target-feature +sve -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 -target-feature +sve -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 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
8 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
9 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
10
11 #include <arm_sve.h>
12
13 #ifdef SVE_OVERLOADED_FORMS
14 // A simple used,unused... macro, long enough to represent any SVE builtin.
15 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
16 #else
17 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
18 #endif
19
20 #ifdef __ARM_FEATURE_SME
21 #define ATTR __arm_streaming
22 #else
23 #define ATTR
24 #endif
25
26 // NOTE: For these tests clang converts the struct parameter into
27 // several parameters, one for each member of the original struct.
28 // CHECK-LABEL: @test_svget4_s8(
29 // CHECK-NEXT: entry:
30 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv64i8(<vscale x 64 x i8> [[TUPLE:%.*]], i64 0)
31 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
32 //
33 // CPP-CHECK-LABEL: @_Z14test_svget4_s810svint8x4_t(
34 // CPP-CHECK-NEXT: entry:
35 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv64i8(<vscale x 64 x i8> [[TUPLE:%.*]], i64 0)
36 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
37 //
38 svint8_t test_svget4_s8(svint8x4_t tuple) ATTR
39 {
40 return SVE_ACLE_FUNC(svget4,_s8,,)(tuple, 0);
41 }
42
43 // CHECK-LABEL: @test_svget4_s16(
44 // CHECK-NEXT: entry:
45 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv32i16(<vscale x 32 x i16> [[TUPLE:%.*]], i64 16)
46 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
47 //
48 // CPP-CHECK-LABEL: @_Z15test_svget4_s1611svint16x4_t(
49 // CPP-CHECK-NEXT: entry:
50 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv32i16(<vscale x 32 x i16> [[TUPLE:%.*]], i64 16)
51 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
52 //
53 svint16_t test_svget4_s16(svint16x4_t tuple) ATTR
54 {
55 return SVE_ACLE_FUNC(svget4,_s16,,)(tuple, 2);
56 }
57
58 // CHECK-LABEL: @test_svget4_s32(
59 // CHECK-NEXT: entry:
60 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> [[TUPLE:%.*]], i64 8)
61 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
62 //
63 // CPP-CHECK-LABEL: @_Z15test_svget4_s3211svint32x4_t(
64 // CPP-CHECK-NEXT: entry:
65 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> [[TUPLE:%.*]], i64 8)
66 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
67 //
68 svint32_t test_svget4_s32(svint32x4_t tuple) ATTR
69 {
70 return SVE_ACLE_FUNC(svget4,_s32,,)(tuple, 2);
71 }
72
73 // CHECK-LABEL: @test_svget4_s64(
74 // CHECK-NEXT: entry:
75 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv8i64(<vscale x 8 x i64> [[TUPLE:%.*]], i64 6)
76 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
77 //
78 // CPP-CHECK-LABEL: @_Z15test_svget4_s6411svint64x4_t(
79 // CPP-CHECK-NEXT: entry:
80 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv8i64(<vscale x 8 x i64> [[TUPLE:%.*]], i64 6)
81 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
82 //
83 svint64_t test_svget4_s64(svint64x4_t tuple) ATTR
84 {
85 return SVE_ACLE_FUNC(svget4,_s64,,)(tuple, 3);
86 }
87
88 // CHECK-LABEL: @test_svget4_u8(
89 // CHECK-NEXT: entry:
90 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv64i8(<vscale x 64 x i8> [[TUPLE:%.*]], i64 32)
91 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
92 //
93 // CPP-CHECK-LABEL: @_Z14test_svget4_u811svuint8x4_t(
94 // CPP-CHECK-NEXT: entry:
95 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv64i8(<vscale x 64 x i8> [[TUPLE:%.*]], i64 32)
96 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
97 //
98 svuint8_t test_svget4_u8(svuint8x4_t tuple) ATTR
99 {
100 return SVE_ACLE_FUNC(svget4,_u8,,)(tuple, 2);
101 }
102
103 // CHECK-LABEL: @test_svget4_u16(
104 // CHECK-NEXT: entry:
105 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv32i16(<vscale x 32 x i16> [[TUPLE:%.*]], i64 24)
106 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
107 //
108 // CPP-CHECK-LABEL: @_Z15test_svget4_u1612svuint16x4_t(
109 // CPP-CHECK-NEXT: entry:
110 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv32i16(<vscale x 32 x i16> [[TUPLE:%.*]], i64 24)
111 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
112 //
113 svuint16_t test_svget4_u16(svuint16x4_t tuple) ATTR
114 {
115 return SVE_ACLE_FUNC(svget4,_u16,,)(tuple, 3);
116 }
117
118 // CHECK-LABEL: @test_svget4_u32(
119 // CHECK-NEXT: entry:
120 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> [[TUPLE:%.*]], i64 0)
121 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
122 //
123 // CPP-CHECK-LABEL: @_Z15test_svget4_u3212svuint32x4_t(
124 // CPP-CHECK-NEXT: entry:
125 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> [[TUPLE:%.*]], i64 0)
126 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
127 //
128 svuint32_t test_svget4_u32(svuint32x4_t tuple) ATTR
129 {
130 return SVE_ACLE_FUNC(svget4,_u32,,)(tuple, 0);
131 }
132
133 // CHECK-LABEL: @test_svget4_u64(
134 // CHECK-NEXT: entry:
135 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv8i64(<vscale x 8 x i64> [[TUPLE:%.*]], i64 6)
136 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
137 //
138 // CPP-CHECK-LABEL: @_Z15test_svget4_u6412svuint64x4_t(
139 // CPP-CHECK-NEXT: entry:
140 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv8i64(<vscale x 8 x i64> [[TUPLE:%.*]], i64 6)
141 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
142 //
143 svuint64_t test_svget4_u64(svuint64x4_t tuple) ATTR
144 {
145 return SVE_ACLE_FUNC(svget4,_u64,,)(tuple, 3);
146 }
147
148 // CHECK-LABEL: @test_svget4_f16(
149 // CHECK-NEXT: entry:
150 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.extract.nxv8f16.nxv32f16(<vscale x 32 x half> [[TUPLE:%.*]], i64 16)
151 // CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
152 //
153 // CPP-CHECK-LABEL: @_Z15test_svget4_f1613svfloat16x4_t(
154 // CPP-CHECK-NEXT: entry:
155 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.extract.nxv8f16.nxv32f16(<vscale x 32 x half> [[TUPLE:%.*]], i64 16)
156 // CPP-CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
157 //
158 svfloat16_t test_svget4_f16(svfloat16x4_t tuple) ATTR
159 {
160 return SVE_ACLE_FUNC(svget4,_f16,,)(tuple, 2);
161 }
162
163 // CHECK-LABEL: @test_svget4_f32(
164 // CHECK-NEXT: entry:
165 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float> [[TUPLE:%.*]], i64 0)
166 // CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]
167 //
168 // CPP-CHECK-LABEL: @_Z15test_svget4_f3213svfloat32x4_t(
169 // CPP-CHECK-NEXT: entry:
170 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv16f32(<vscale x 16 x float> [[TUPLE:%.*]], i64 0)
171 // CPP-CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]
172 //
173 svfloat32_t test_svget4_f32(svfloat32x4_t tuple) ATTR
174 {
175 return SVE_ACLE_FUNC(svget4,_f32,,)(tuple, 0);
176 }
177
178 // CHECK-LABEL: @test_svget4_f64(
179 // CHECK-NEXT: entry:
180 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.extract.nxv2f64.nxv8f64(<vscale x 8 x double> [[TUPLE:%.*]], i64 4)
181 // CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
182 //
183 // CPP-CHECK-LABEL: @_Z15test_svget4_f6413svfloat64x4_t(
184 // CPP-CHECK-NEXT: entry:
185 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.extract.nxv2f64.nxv8f64(<vscale x 8 x double> [[TUPLE:%.*]], i64 4)
186 // CPP-CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
187 //
188 svfloat64_t test_svget4_f64(svfloat64x4_t tuple) ATTR
189 {
190 return SVE_ACLE_FUNC(svget4,_f64,,)(tuple, 2);
191 }