Debian Codegraph @

clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_get2.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 // CHECK-LABEL: @test_svget2_s8(
27 // CHECK-NEXT: entry:
28 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv32i8(<vscale x 32 x i8> [[TUPLE:%.*]], i64 0)
29 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
30 //
31 // CPP-CHECK-LABEL: @_Z14test_svget2_s810svint8x2_t(
32 // CPP-CHECK-NEXT: entry:
33 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv32i8(<vscale x 32 x i8> [[TUPLE:%.*]], i64 0)
34 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
35 //
36 svint8_t test_svget2_s8(svint8x2_t tuple) ATTR
37 {
38 return SVE_ACLE_FUNC(svget2,_s8,,)(tuple, 0);
39 }
40
41 // CHECK-LABEL: @test_svget2_s16(
42 // CHECK-NEXT: entry:
43 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv16i16(<vscale x 16 x i16> [[TUPLE:%.*]], i64 8)
44 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
45 //
46 // CPP-CHECK-LABEL: @_Z15test_svget2_s1611svint16x2_t(
47 // CPP-CHECK-NEXT: entry:
48 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv16i16(<vscale x 16 x i16> [[TUPLE:%.*]], i64 8)
49 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
50 //
51 svint16_t test_svget2_s16(svint16x2_t tuple) ATTR
52 {
53 return SVE_ACLE_FUNC(svget2,_s16,,)(tuple, 1);
54 }
55
56 // CHECK-LABEL: @test_svget2_s32(
57 // CHECK-NEXT: entry:
58 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> [[TUPLE:%.*]], i64 0)
59 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
60 //
61 // CPP-CHECK-LABEL: @_Z15test_svget2_s3211svint32x2_t(
62 // CPP-CHECK-NEXT: entry:
63 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> [[TUPLE:%.*]], i64 0)
64 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
65 //
66 svint32_t test_svget2_s32(svint32x2_t tuple) ATTR
67 {
68 return SVE_ACLE_FUNC(svget2,_s32,,)(tuple, 0);
69 }
70
71 // CHECK-LABEL: @test_svget2_s64(
72 // CHECK-NEXT: entry:
73 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv4i64(<vscale x 4 x i64> [[TUPLE:%.*]], i64 2)
74 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
75 //
76 // CPP-CHECK-LABEL: @_Z15test_svget2_s6411svint64x2_t(
77 // CPP-CHECK-NEXT: entry:
78 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv4i64(<vscale x 4 x i64> [[TUPLE:%.*]], i64 2)
79 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
80 //
81 svint64_t test_svget2_s64(svint64x2_t tuple) ATTR
82 {
83 return SVE_ACLE_FUNC(svget2,_s64,,)(tuple, 1);
84 }
85
86 // CHECK-LABEL: @test_svget2_u8(
87 // CHECK-NEXT: entry:
88 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv32i8(<vscale x 32 x i8> [[TUPLE:%.*]], i64 0)
89 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
90 //
91 // CPP-CHECK-LABEL: @_Z14test_svget2_u811svuint8x2_t(
92 // CPP-CHECK-NEXT: entry:
93 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.vector.extract.nxv16i8.nxv32i8(<vscale x 32 x i8> [[TUPLE:%.*]], i64 0)
94 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
95 //
96 svuint8_t test_svget2_u8(svuint8x2_t tuple) ATTR
97 {
98 return SVE_ACLE_FUNC(svget2,_u8,,)(tuple, 0);
99 }
100
101 // CHECK-LABEL: @test_svget2_u16(
102 // CHECK-NEXT: entry:
103 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv16i16(<vscale x 16 x i16> [[TUPLE:%.*]], i64 8)
104 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
105 //
106 // CPP-CHECK-LABEL: @_Z15test_svget2_u1612svuint16x2_t(
107 // CPP-CHECK-NEXT: entry:
108 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.vector.extract.nxv8i16.nxv16i16(<vscale x 16 x i16> [[TUPLE:%.*]], i64 8)
109 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
110 //
111 svuint16_t test_svget2_u16(svuint16x2_t tuple) ATTR
112 {
113 return SVE_ACLE_FUNC(svget2,_u16,,)(tuple, 1);
114 }
115
116 // CHECK-LABEL: @test_svget2_u32(
117 // CHECK-NEXT: entry:
118 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> [[TUPLE:%.*]], i64 0)
119 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
120 //
121 // CPP-CHECK-LABEL: @_Z15test_svget2_u3212svuint32x2_t(
122 // CPP-CHECK-NEXT: entry:
123 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> [[TUPLE:%.*]], i64 0)
124 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
125 //
126 svuint32_t test_svget2_u32(svuint32x2_t tuple) ATTR
127 {
128 return SVE_ACLE_FUNC(svget2,_u32,,)(tuple, 0);
129 }
130
131 // CHECK-LABEL: @test_svget2_u64(
132 // CHECK-NEXT: entry:
133 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv4i64(<vscale x 4 x i64> [[TUPLE:%.*]], i64 2)
134 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
135 //
136 // CPP-CHECK-LABEL: @_Z15test_svget2_u6412svuint64x2_t(
137 // CPP-CHECK-NEXT: entry:
138 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i64> @llvm.vector.extract.nxv2i64.nxv4i64(<vscale x 4 x i64> [[TUPLE:%.*]], i64 2)
139 // CPP-CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
140 //
141 svuint64_t test_svget2_u64(svuint64x2_t tuple) ATTR
142 {
143 return SVE_ACLE_FUNC(svget2,_u64,,)(tuple, 1);
144 }
145
146 // CHECK-LABEL: @test_svget2_f16(
147 // CHECK-NEXT: entry:
148 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.extract.nxv8f16.nxv16f16(<vscale x 16 x half> [[TUPLE:%.*]], i64 0)
149 // CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
150 //
151 // CPP-CHECK-LABEL: @_Z15test_svget2_f1613svfloat16x2_t(
152 // CPP-CHECK-NEXT: entry:
153 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x half> @llvm.vector.extract.nxv8f16.nxv16f16(<vscale x 16 x half> [[TUPLE:%.*]], i64 0)
154 // CPP-CHECK-NEXT: ret <vscale x 8 x half> [[TMP0]]
155 //
156 svfloat16_t test_svget2_f16(svfloat16x2_t tuple) ATTR
157 {
158 return SVE_ACLE_FUNC(svget2,_f16,,)(tuple, 0);
159 }
160
161 // CHECK-LABEL: @test_svget2_f32(
162 // CHECK-NEXT: entry:
163 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv8f32(<vscale x 8 x float> [[TUPLE:%.*]], i64 4)
164 // CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]
165 //
166 // CPP-CHECK-LABEL: @_Z15test_svget2_f3213svfloat32x2_t(
167 // CPP-CHECK-NEXT: entry:
168 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x float> @llvm.vector.extract.nxv4f32.nxv8f32(<vscale x 8 x float> [[TUPLE:%.*]], i64 4)
169 // CPP-CHECK-NEXT: ret <vscale x 4 x float> [[TMP0]]
170 //
171 svfloat32_t test_svget2_f32(svfloat32x2_t tuple) ATTR
172 {
173 return SVE_ACLE_FUNC(svget2,_f32,,)(tuple, 1);
174 }
175
176 // CHECK-LABEL: @test_svget2_f64(
177 // CHECK-NEXT: entry:
178 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.extract.nxv2f64.nxv4f64(<vscale x 4 x double> [[TUPLE:%.*]], i64 0)
179 // CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
180 //
181 // CPP-CHECK-LABEL: @_Z15test_svget2_f6413svfloat64x2_t(
182 // CPP-CHECK-NEXT: entry:
183 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x double> @llvm.vector.extract.nxv2f64.nxv4f64(<vscale x 4 x double> [[TUPLE:%.*]], i64 0)
184 // CPP-CHECK-NEXT: ret <vscale x 2 x double> [[TMP0]]
185 //
186 svfloat64_t test_svget2_f64(svfloat64x2_t tuple) ATTR
187 {
188 return SVE_ACLE_FUNC(svget2,_f64,,)(tuple, 0);
189 }