aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/arm64_vext.c
blob: 6c3fe73399a1a61b4923b78e63dcc488251c2f3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// RUN: %clang_cc1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s

// Test ARM64 extract intrinsics
// can use as back end test by adding a run line with
// -check-prefix=CHECK-CODEGEN on the FileCheck

#include <arm_neon.h>

void test_vext_s8()
{
  // CHECK: test_vext_s8
  int8x8_t xS8x8;
  xS8x8 = vext_s8(xS8x8, xS8x8, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_s8:
  // CHECK-CODEGEN: {{ext.8.*#1}}
}

void test_vext_u8()
{
  // CHECK: test_vext_u8
  uint8x8_t xU8x8;
  xU8x8 = vext_u8(xU8x8, xU8x8, 2);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_u8:
  // CHECK-CODEGEN: {{ext.8.*#2}}
}

void test_vext_p8()
{
  // CHECK: test_vext_p8
  poly8x8_t xP8x8;
  xP8x8 = vext_p8(xP8x8, xP8x8, 3);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_p8:
  // CHECK-CODEGEN: {{ext.8.*#3}}
}

void test_vext_s16()
{
  // CHECK: test_vext_s16
  int16x4_t xS16x4;
  xS16x4 = vext_s16(xS16x4, xS16x4, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_s16:
  // CHECK-CODEGEN: {{ext.8.*#2}}
}

void test_vext_u16()
{
  // CHECK: test_vext_u16
  uint16x4_t xU16x4;
  xU16x4 = vext_u16(xU16x4, xU16x4, 2);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_u16:
  // CHECK-CODEGEN: {{ext.8.*#4}}
}

void test_vext_p16()
{
  // CHECK: test_vext_p16
  poly16x4_t xP16x4;
  xP16x4 = vext_p16(xP16x4, xP16x4, 3);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_p16:
  // CHECK-CODEGEN: {{ext.8.*#6}}
}

void test_vext_s32()
{
  // CHECK: test_vext_s32
  int32x2_t xS32x2;
  xS32x2 = vext_s32(xS32x2, xS32x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_s32:
  // CHECK-CODEGEN: {{ext.8.*#4}}
}

void test_vext_u32()
{
  // CHECK: test_vext_u32
  uint32x2_t xU32x2;
  xU32x2 = vext_u32(xU32x2, xU32x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_u32:
  // CHECK-CODEGEN: {{ext.8.*#4}}
}

void test_vext_f32()
{
  // CHECK: test_vext_f32
  float32x2_t xF32x2;
  xF32x2 = vext_f32(xF32x2, xF32x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_f32:
  // CHECK-CODEGEN: {{ext.8.*#4}}
}

void test_vext_s64()
{
  // CHECK: test_vext_s64
  int64x1_t xS64x1;
  // FIXME don't use 1 as index or check for now, clang has a bug?
  xS64x1 = vext_s64(xS64x1, xS64x1, /*1*/0);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_s64:
  // CHECK_FIXME: {{ext.8.*#0}}
}

void test_vext_u64()
{
  // CHECK: test_vext_u64
  uint64x1_t xU64x1;
  // FIXME don't use 1 as index or check for now, clang has a bug?
  xU64x1 = vext_u64(xU64x1, xU64x1, /*1*/0);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vext_u64:
  // CHECK_FIXME: {{ext.8.*#0}}
}

void test_vextq_s8()
{
  // CHECK: test_vextq_s8
  int8x16_t xS8x16;
  xS8x16 = vextq_s8(xS8x16, xS8x16, 4);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_s8:
  // CHECK-CODEGEN: {{ext.16.*#4}}
}

void test_vextq_u8()
{
  // CHECK: test_vextq_u8
  uint8x16_t xU8x16;
  xU8x16 = vextq_u8(xU8x16, xU8x16, 5);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_u8:
  // CHECK-CODEGEN: {{ext.16.*#5}}
}

void test_vextq_p8()
{
  // CHECK: test_vextq_p8
  poly8x16_t xP8x16;
  xP8x16 = vextq_p8(xP8x16, xP8x16, 6);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_p8:
  // CHECK-CODEGEN: {{ext.16.*#6}}
}

void test_vextq_s16()
{
  // CHECK: test_vextq_s16
  int16x8_t xS16x8;
  xS16x8 = vextq_s16(xS16x8, xS16x8, 7);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_s16:
  // CHECK-CODEGEN: {{ext.16.*#14}}
}

void test_vextq_u16()
{
  // CHECK: test_vextq_u16
  uint16x8_t xU16x8;
  xU16x8 = vextq_u16(xU16x8, xU16x8, 4);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_u16:
  // CHECK-CODEGEN: {{ext.16.*#8}}
}

void test_vextq_p16()
{
  // CHECK: test_vextq_p16
  poly16x8_t xP16x8;
  xP16x8 = vextq_p16(xP16x8, xP16x8, 5);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_p16:
  // CHECK-CODEGEN: {{ext.16.*#10}}
}

void test_vextq_s32()
{
  // CHECK: test_vextq_s32
  int32x4_t xS32x4;
  xS32x4 = vextq_s32(xS32x4, xS32x4, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_s32:
  // CHECK-CODEGEN: {{ext.16.*#4}}
}

void test_vextq_u32()
{
  // CHECK: test_vextq_u32
  uint32x4_t xU32x4;
  xU32x4 = vextq_u32(xU32x4, xU32x4, 2);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_u32:
  // CHECK-CODEGEN: {{ext.16.*#8}}
}

void test_vextq_f32()
{
  // CHECK: test_vextq_f32
  float32x4_t xF32x4;
  xF32x4 = vextq_f32(xF32x4, xF32x4, 3);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_f32:
  // CHECK-CODEGEN: {{ext.16.*#12}}
}

void test_vextq_s64()
{
  // CHECK: test_vextq_s64
  int64x2_t xS64x2;
  xS64x2 = vextq_s64(xS64x2, xS64x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_s64:
  // CHECK-CODEGEN: {{ext.16.*#8}}
}

void test_vextq_u64()
{
  // CHECK: test_vextq_u64
  uint64x2_t xU64x2;
  xU64x2 = vextq_u64(xU64x2, xU64x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_u64:
  // CHECK-CODEGEN: {{ext.16.*#8}}
}

void test_vextq_f64()
{
  // CHECK: test_vextq_f64
  float64x2_t xF64x2;
  xF64x2 = vextq_f64(xF64x2, xF64x2, 1);
  // CHECK: shufflevector
  // CHECK-CODEGEN: test_vextq_u64:
  // CHECK-CODEGEN: {{ext.16.*#8}}
}