]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/MC/AMDGPU/vop3-modifiers.s
Vendor import of llvm trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / MC / AMDGPU / vop3-modifiers.s
1 // RUN: llvm-mc -arch=amdgcn -mcpu=tonga -show-encoding %s | FileCheck %s
2
3 //---------------------------------------------------------------------------//
4 // VOP1/VOP3 F16
5 //---------------------------------------------------------------------------//
6
7 v_ceil_f16 v0, -1
8 // CHECK: [0xc1,0x8a,0x00,0x7e]
9
10 v_ceil_f16 v0, -2
11 // CHECK: [0xc2,0x8a,0x00,0x7e]
12
13 v_ceil_f16 v0, -16
14 // CHECK: [0xd0,0x8a,0x00,0x7e]
15
16 v_ceil_f16 v0, -0.5
17 // CHECK: [0xf1,0x8a,0x00,0x7e]
18
19 v_ceil_f16 v0, -1.0
20 // CHECK: [0xf3,0x8a,0x00,0x7e]
21
22 v_ceil_f16 v0, -2.0
23 // CHECK: [0xf5,0x8a,0x00,0x7e]
24
25 v_ceil_f16 v0, -4.0
26 // CHECK: [0xf7,0x8a,0x00,0x7e]
27
28 // Arbitrary f16 literal in hex
29 v_ceil_f16 v0, 0xabcd
30 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
31
32 // '-' is a part of hex literal (not a 'neg' modifier)
33 v_ceil_f16 v0, -0x5433
34 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
35
36 v_ceil_f16 v0, abs(0xabcd)
37 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]
38
39 v_ceil_f16 v0, neg(0xabcd)
40 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]
41
42 v_ceil_f16 v0, neg(abs(0xabcd))
43 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
44
45 v_ceil_f16 v0, -abs(0xabcd)
46 // CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
47
48 // 1/(2*pi) encoded as inline constant in VOP1
49 v_ceil_f16 v0, 0x3118
50 // CHECK: [0xf8,0x8a,0x00,0x7e]
51
52 // 1/(2*pi) encoded as inline constant in VOP3
53 v_ceil_f16_e64 v0, 0x3118
54 // CHECK: [0x00,0x00,0x85,0xd1,0xf8,0x00,0x00,0x00]
55
56 // neg(-1/(2*pi)) = 1/(2*pi)
57 v_ceil_f16 v0, neg(0xb118)
58 // CHECK: [0xf8,0x8a,0x00,0x7e]
59
60 // -1/(2*pi) cannot be encoded as inline constant in VOP1
61 v_ceil_f16 v0, 0xb118
62 // CHECK: [0xff,0x8a,0x00,0x7e,0x18,0xb1,0x00,0x00]
63
64 // -1/(2*pi) cannot be encoded as inline constant in VOP1
65 v_ceil_f16 v0, neg(0x3118)
66 // CHECK: [0xff,0x8a,0x00,0x7e,0x18,0xb1,0x00,0x00]
67
68 // -1/(2*pi) can be encoded as inline constant w/ modifiers in VOP3
69 v_ceil_f16_e64 v0, neg(0x3118)
70 // CHECK: [0x00,0x00,0x85,0xd1,0xf8,0x00,0x00,0x20]
71
72 v_ceil_f16_e64 v0, abs(0x3118)
73 // CHECK: 0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x00]
74
75 v_ceil_f16_e64 v0, neg(abs(0x3118))
76 // CHECK: [0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x20]
77
78 v_ceil_f16_e64 v0, neg(|v1|)
79 // CHECK: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]
80
81 v_ceil_f16_e64 v0, -|v1|
82 // CHECK: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]
83
84 //---------------------------------------------------------------------------//
85 // VOP1/VOP3 F64
86 //---------------------------------------------------------------------------//
87
88 // Encoded as inline constant 1 with 'neg' modifier
89 v_ceil_f64 v[0:1], neg(1)
90 // CHECK: [0x00,0x00,0x58,0xd1,0x81,0x00,0x00,0x20]
91
92 // Encoded as inline constant -1 with 'neg' modifier
93 v_ceil_f64 v[0:1], neg(-1)
94 // CHECK: [0x00,0x00,0x58,0xd1,0xc1,0x00,0x00,0x20]
95
96 v_ceil_f64_e32 v[0:1], 1.0
97 // CHECK: [0xf2,0x30,0x00,0x7e]
98
99 // abs(1.0) = 1.0
100 v_ceil_f64_e32 v[0:1], abs(1.0)
101 // CHECK: [0xf2,0x30,0x00,0x7e]
102
103 // neg(1.0) = -1.0
104 v_ceil_f64_e32 v[0:1], neg(1.0)
105 // CHECK: [0xf3,0x30,0x00,0x7e]
106
107 // 1/(2*pi) encoded as inline constant in VOP1
108 v_ceil_f64 v[0:1], 0x3fc45f306dc9c882
109 // CHECK: [0xf8,0x30,0x00,0x7e]
110
111 // 1/(2*pi) encoded as inline constant in VOP3
112 v_ceil_f64_e64 v[0:1], 0x3fc45f306dc9c882
113 // CHECK: [0x00,0x00,0x58,0xd1,0xf8,0x00,0x00,0x00]
114
115 // -1/(2*pi) cannot be encoded as inline constant in VOP1.
116 // It cannot be encoded as literal either due to int literal rules.
117 // So it is encoded as VOP3
118 v_ceil_f64 v[0:1], abs(0x3fc45f306dc9c882)
119 // CHECK: [0x00,0x01,0x58,0xd1,0xf8,0x00,0x00,0x00]
120
121 v_ceil_f64 v[0:1], neg(abs(0x3fc45f306dc9c882))
122 // CHECK: [0x00,0x01,0x58,0xd1,0xf8,0x00,0x00,0x20]
123
124
125 //---------------------------------------------------------------------------//
126 // VOP2/VOP3 F32
127 //---------------------------------------------------------------------------//
128
129 v_add_f32 v5, -1, v2
130 // CHECK: [0xc1,0x04,0x0a,0x02]
131
132 v_add_f32 v5, -16, v2
133 // CHECK: [0xd0,0x04,0x0a,0x02]
134
135 v_add_f32 v5, 0x3e22f983, v2
136 // CHECK: [0xf8,0x04,0x0a,0x02]
137
138 // abs(1/(2*pi)) = 1/(2*pi)
139 v_add_f32 v5, abs(0x3e22f983), v2
140 // CHECK: [0xf8,0x04,0x0a,0x02]
141
142 // neg(-1/(2*pi)) = 1/(2*pi)
143 v_add_f32 v5, neg(0xbe22f983), v2
144 // CHECK: [0xf8,0x04,0x0a,0x02]
145
146 // -1/(2*pi) cannot be encoded as inline constant in VOP1
147 v_add_f32 v5, neg(0x3e22f983), v2
148 // CHECK: [0xff,0x04,0x0a,0x02,0x83,0xf9,0x22,0xbe]
149
150
151 v_add_f32_e64 v0, -2, s0
152 // CHECK: [0x00,0x00,0x01,0xd1,0xc2,0x00,0x00,0x00]
153
154 v_add_f32_e64 v0, -16, s0
155 // CHECK: [0x00,0x00,0x01,0xd1,0xd0,0x00,0x00,0x00]
156
157 v_add_f32_e64 v0, -0.5, s0
158 // CHECK: [0x00,0x00,0x01,0xd1,0xf1,0x00,0x00,0x00]
159
160 v_add_f32_e64 v0, -1.0, s0
161 // CHECK: [0x00,0x00,0x01,0xd1,0xf3,0x00,0x00,0x00]
162
163 v_add_f32_e64 v0, -2.0, s0
164 // CHECK: [0x00,0x00,0x01,0xd1,0xf5,0x00,0x00,0x00]
165
166 v_add_f32_e64 v0, -4.0, s0
167 // CHECK: [0x00,0x00,0x01,0xd1,0xf7,0x00,0x00,0x00]
168
169 v_add_f32_e64 v0, 0x3e22f983, s0
170 // CHECK: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x00]
171
172 v_add_f32_e64 v0, neg(0x3e22f983), s0
173 // CHECK: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x20]
174
175 //---------------------------------------------------------------------------//
176 // VOPC/VOP3
177 //---------------------------------------------------------------------------//
178
179 v_cmp_eq_f16 vcc, -1, v0
180 // CHECK: [0xc1,0x00,0x44,0x7c]
181
182 v_cmp_eq_f16_e64 s[0:1], s0, -1
183 // CHECK: [0x00,0x00,0x22,0xd0,0x00,0x82,0x01,0x00]
184
185 v_cmp_eq_f16_e64 s[0:1], s0, 0x3118
186 // CHECK: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x00]
187
188 v_cmp_eq_f16_e64 s[0:1], s0, neg(0x3118)
189 // CHECK: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x40]
190
191 v_cmp_eq_f32 vcc, -4.0, v0
192 // CHECK: [0xf7,0x00,0x84,0x7c]
193
194 // 1/(2*pi) can be encoded as inline constant
195 v_cmp_eq_f32 vcc, 0x3e22f983, v0
196 // CHECK: [0xf8,0x00,0x84,0x7c]
197
198 // -1/(2*pi) cannot be encoded as inline constant in VOPC
199 v_cmp_eq_f32 vcc, neg(0x3e22f983), v0
200 // CHECK: [0xff,0x00,0x84,0x7c,0x83,0xf9,0x22,0xbe]
201
202 // abs(1/(2*pi)) = 1/(2*pi)
203 v_cmp_eq_f32 vcc, abs(0x3e22f983), v0
204 // CHECK: [0xf8,0x00,0x84,0x7c]
205
206 // -1/(2*pi) can be encoded as inline constant w/ modifiers in VOP3
207 v_cmp_eq_f32_e64 vcc, neg(0x3e22f983), v0
208 // CHECK: [0x6a,0x00,0x42,0xd0,0xf8,0x00,0x02,0x20]
209
210 v_cmp_eq_f32_e64 vcc, v0, abs(0x3e22f983)
211 // CHECK: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x00]
212
213 v_cmp_eq_f32_e64 vcc, v0, -abs(0x3e22f983)
214 // CHECK: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x40]
215
216 //---------------------------------------------------------------------------//
217 // VOP3
218 //---------------------------------------------------------------------------//
219
220 v_add_f64 v[0:1], s[0:1], -1
221 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0x82,0x01,0x00]
222
223 v_add_f64 v[0:1], s[0:1], -16
224 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0xa0,0x01,0x00]
225
226 v_add_f64 v[0:1], s[0:1], -0.5
227 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0xe2,0x01,0x00]
228
229 v_add_f64 v[0:1], s[0:1], -1.0
230 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0xe6,0x01,0x00]
231
232 v_add_f64 v[0:1], s[0:1], -2.0
233 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0xea,0x01,0x00]
234
235 v_add_f64 v[0:1], s[0:1], -4.0
236 // CHECK: [0x00,0x00,0x80,0xd2,0x00,0xee,0x01,0x00]
237
238 v_add_f64 v[4:5], s[0:1], 0x3fc45f306dc9c882
239 // CHECK: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x00]
240
241 v_add_f64 v[4:5], s[0:1], neg(0x3fc45f306dc9c882)
242 // CHECK: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x40]
243
244
245 v_cubeid_f32 v0, s0, s0, -1
246 // CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0x04,0x03]
247
248 v_cubeid_f32 v0, s0, s0, -4.0
249 // CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xdc,0x03]
250
251 v_cubeid_f32 v0, s0, s0, 0x3e22f983
252 // CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x03]
253
254 v_cubeid_f32 v0, s0, s0, neg(0x3e22f983)
255 // CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x83]
256
257 v_cubeid_f32 v0, s0, s0, abs(0x3e22f983)
258 // CHECK: [0x00,0x04,0xc4,0xd1,0x00,0x00,0xe0,0x03]
259
260
261 //---------------------------------------------------------------------------//
262 // VOP3 Instructions without Input Modifiers but with Output Modifiers
263 //---------------------------------------------------------------------------//
264
265 v_cvt_f64_i32_e64 v[5:6], s1 clamp
266 // CHECK: [0x05,0x80,0x44,0xd1,0x01,0x00,0x00,0x00]
267
268 v_cvt_f64_i32_e64 v[5:6], s1 mul:2
269 // CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x08]
270
271 v_cvt_f64_i32_e64 v[5:6], s1 mul:4
272 // CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x10]
273
274 v_cvt_f64_i32_e64 v[5:6], s1 div:2
275 // CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x18]
276
277
278 v_cvt_f64_u32_e64 v[5:6], s1 clamp
279 // CHECK: [0x05,0x80,0x56,0xd1,0x01,0x00,0x00,0x00]
280
281 v_cvt_f64_u32_e64 v[5:6], s1 mul:2
282 // CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x08]
283
284 v_cvt_f64_u32_e64 v[5:6], s1 mul:4
285 // CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x10]
286
287 v_cvt_f64_u32_e64 v[5:6], s1 div:2
288 // CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x18]
289
290
291 v_cvt_f32_i32_e64 v5, s1 clamp
292 // CHECK: [0x05,0x80,0x45,0xd1,0x01,0x00,0x00,0x00]
293
294 v_cvt_f32_i32_e64 v5, s1 mul:2
295 // CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x08]
296
297 v_cvt_f32_i32_e64 v5, s1 mul:4
298 // CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x10]
299
300 v_cvt_f32_i32_e64 v5, s1 div:2
301 // CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x18]
302
303
304 v_cvt_f32_u32_e64 v5, s1 clamp
305 // CHECK: [0x05,0x80,0x46,0xd1,0x01,0x00,0x00,0x00]
306
307 v_cvt_f32_u32_e64 v5, s1 mul:2
308 // CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x08]
309
310 v_cvt_f32_u32_e64 v5, s1 mul:4
311 // CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x10]
312
313 v_cvt_f32_u32_e64 v5, s1 div:2
314 // CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x18]
315
316
317 v_cvt_off_f32_i4_e64 v5, s1 clamp
318 // CHECK: [0x05,0x80,0x4e,0xd1,0x01,0x00,0x00,0x00]
319
320 v_cvt_off_f32_i4_e64 v5, s1 mul:2
321 // CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x08]
322
323 v_cvt_off_f32_i4_e64 v5, s1 mul:4
324 // CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x10]
325
326 v_cvt_off_f32_i4_e64 v5, s1 div:2
327 // CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x18]
328
329
330 v_cvt_f32_ubyte0_e64 v5, s1 clamp
331 // CHECK: [0x05,0x80,0x51,0xd1,0x01,0x00,0x00,0x00]
332
333 v_cvt_f32_ubyte0_e64 v5, s1 mul:2
334 // CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x08]
335
336 v_cvt_f32_ubyte0_e64 v5, s1 mul:4
337 // CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x10]
338
339 v_cvt_f32_ubyte0_e64 v5, s1 div:2
340 // CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x18]
341
342
343 v_cvt_f32_ubyte1_e64 v5, s1 clamp
344 // CHECK: [0x05,0x80,0x52,0xd1,0x01,0x00,0x00,0x00]
345
346 v_cvt_f32_ubyte1_e64 v5, s1 mul:2
347 // CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x08]
348
349 v_cvt_f32_ubyte1_e64 v5, s1 mul:4
350 // CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x10]
351
352 v_cvt_f32_ubyte1_e64 v5, s1 div:2
353 // CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x18]
354
355
356 v_cvt_f32_ubyte2_e64 v5, s1 clamp
357 // CHECK: [0x05,0x80,0x53,0xd1,0x01,0x00,0x00,0x00]
358
359 v_cvt_f32_ubyte2_e64 v5, s1 mul:2
360 // CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x08]
361
362 v_cvt_f32_ubyte2_e64 v5, s1 mul:4
363 // CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x10]
364
365 v_cvt_f32_ubyte2_e64 v5, s1 div:2
366 // CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x18]
367
368
369 v_cvt_f32_ubyte3_e64 v5, s1 clamp
370 // CHECK: [0x05,0x80,0x54,0xd1,0x01,0x00,0x00,0x00]
371
372 v_cvt_f32_ubyte3_e64 v5, s1 mul:2
373 // CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x08]
374
375 v_cvt_f32_ubyte3_e64 v5, s1 mul:4
376 // CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x10]
377
378 v_cvt_f32_ubyte3_e64 v5, s1 div:2
379 // CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x18]
380
381
382 // NB: output modifiers are not supported for f16
383 v_cvt_f16_i16_e64 v5, s1 clamp
384 // CHECK: [0x05,0x80,0x7a,0xd1,0x01,0x00,0x00,0x00]
385
386 // NB: output modifiers are not supported for f16
387 v_cvt_f16_u16_e64 v5, s1 clamp
388 // CHECK: [0x05,0x80,0x79,0xd1,0x01,0x00,0x00,0x00]