1 // RUN
: llvm-mc
-arch
=amdgcn
-mcpu
=tonga
-show-encoding
%s | FileCheck
%s
3 //---------------------------------------------------------------------------//
5 //---------------------------------------------------------------------------//
8 // CHECK
: [0xc1,0x8a,0x00,0x7e]
11 // CHECK
: [0xc2,0x8a,0x00,0x7e]
14 // CHECK
: [0xd0,0x8a,0x00,0x7e]
17 // CHECK
: [0xf1,0x8a,0x00,0x7e]
20 // CHECK
: [0xf3,0x8a,0x00,0x7e]
23 // CHECK
: [0xf5,0x8a,0x00,0x7e]
26 // CHECK
: [0xf7,0x8a,0x00,0x7e]
28 // Arbitrary
f16 literal in hex
30 // CHECK
: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
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]
36 v_ceil_f16 v0
, abs(0xabcd)
37 // CHECK
: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]
39 v_ceil_f16 v0
, neg(0xabcd)
40 // CHECK
: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]
42 v_ceil_f16 v0
, neg(abs(0xabcd))
43 // CHECK
: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
45 v_ceil_f16 v0
, -abs(0xabcd)
46 // CHECK
: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]
48 // 1/(2*pi
) encoded as inline constant in VOP1
50 // CHECK
: [0xf8,0x8a,0x00,0x7e]
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]
56 // neg(-1/(2*pi
)) = 1/(2*pi
)
57 v_ceil_f16 v0
, neg(0xb118)
58 // CHECK
: [0xf8,0x8a,0x00,0x7e]
60 // -1/(2*pi
) cannot
be encoded as inline constant in VOP1
62 // CHECK
: [0xff,0x8a,0x00,0x7e,0x18,0xb1,0x00,0x00]
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]
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]
72 v_ceil_f16_e64 v0
, abs(0x3118)
73 // CHECK
: 0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x00]
75 v_ceil_f16_e64 v0
, neg(abs(0x3118))
76 // CHECK
: [0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x20]
78 v_ceil_f16_e64 v0
, neg(|v1|
)
79 // CHECK
: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]
81 v_ceil_f16_e64 v0
, -|v1|
82 // CHECK
: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]
84 //---------------------------------------------------------------------------//
86 //---------------------------------------------------------------------------//
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]
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]
96 v_ceil_f64_e32 v
[0:1], 1.0
97 // CHECK
: [0xf2,0x30,0x00,0x7e]
100 v_ceil_f64_e32 v
[0:1], abs(1.0)
101 // CHECK
: [0xf2,0x30,0x00,0x7e]
104 v_ceil_f64_e32 v
[0:1], neg(1.0)
105 // CHECK
: [0xf3,0x30,0x00,0x7e]
107 // 1/(2*pi
) encoded as inline constant in VOP1
108 v_ceil_f64 v
[0:1], 0x3fc45f306dc9c882
109 // CHECK
: [0xf8,0x30,0x00,0x7e]
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]
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]
121 v_ceil_f64 v
[0:1], neg(abs(0x3fc45f306dc9c882))
122 // CHECK
: [0x00,0x01,0x58,0xd1,0xf8,0x00,0x00,0x20]
125 //---------------------------------------------------------------------------//
127 //---------------------------------------------------------------------------//
130 // CHECK
: [0xc1,0x04,0x0a,0x02]
132 v_add_f32 v5
, -16, v2
133 // CHECK
: [0xd0,0x04,0x0a,0x02]
135 v_add_f32 v5
, 0x3e22f983, v2
136 // CHECK
: [0xf8,0x04,0x0a,0x02]
138 // abs(1/(2*pi
)) = 1/(2*pi
)
139 v_add_f32 v5
, abs(0x3e22f983), v2
140 // CHECK
: [0xf8,0x04,0x0a,0x02]
142 // neg(-1/(2*pi
)) = 1/(2*pi
)
143 v_add_f32 v5
, neg(0xbe22f983), v2
144 // CHECK
: [0xf8,0x04,0x0a,0x02]
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]
151 v_add_f32_e64 v0
, -2, s0
152 // CHECK
: [0x00,0x00,0x01,0xd1,0xc2,0x00,0x00,0x00]
154 v_add_f32_e64 v0
, -16, s0
155 // CHECK
: [0x00,0x00,0x01,0xd1,0xd0,0x00,0x00,0x00]
157 v_add_f32_e64 v0
, -0.5, s0
158 // CHECK
: [0x00,0x00,0x01,0xd1,0xf1,0x00,0x00,0x00]
160 v_add_f32_e64 v0
, -1.0, s0
161 // CHECK
: [0x00,0x00,0x01,0xd1,0xf3,0x00,0x00,0x00]
163 v_add_f32_e64 v0
, -2.0, s0
164 // CHECK
: [0x00,0x00,0x01,0xd1,0xf5,0x00,0x00,0x00]
166 v_add_f32_e64 v0
, -4.0, s0
167 // CHECK
: [0x00,0x00,0x01,0xd1,0xf7,0x00,0x00,0x00]
169 v_add_f32_e64 v0
, 0x3e22f983, s0
170 // CHECK
: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x00]
172 v_add_f32_e64 v0
, neg(0x3e22f983), s0
173 // CHECK
: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x20]
175 //---------------------------------------------------------------------------//
177 //---------------------------------------------------------------------------//
179 v_cmp_eq_f16 vcc
, -1, v0
180 // CHECK
: [0xc1,0x00,0x44,0x7c]
182 v_cmp_eq_f16_e64 s
[0:1], s0
, -1
183 // CHECK
: [0x00,0x00,0x22,0xd0,0x00,0x82,0x01,0x00]
185 v_cmp_eq_f16_e64 s
[0:1], s0
, 0x3118
186 // CHECK
: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x00]
188 v_cmp_eq_f16_e64 s
[0:1], s0
, neg(0x3118)
189 // CHECK
: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x40]
191 v_cmp_eq_f32 vcc
, -4.0, v0
192 // CHECK
: [0xf7,0x00,0x84,0x7c]
194 // 1/(2*pi
) can
be encoded as inline constant
195 v_cmp_eq_f32 vcc
, 0x3e22f983, v0
196 // CHECK
: [0xf8,0x00,0x84,0x7c]
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]
202 // abs(1/(2*pi
)) = 1/(2*pi
)
203 v_cmp_eq_f32 vcc
, abs(0x3e22f983), v0
204 // CHECK
: [0xf8,0x00,0x84,0x7c]
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]
210 v_cmp_eq_f32_e64 vcc
, v0
, abs(0x3e22f983)
211 // CHECK
: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x00]
213 v_cmp_eq_f32_e64 vcc
, v0
, -abs(0x3e22f983)
214 // CHECK
: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x40]
216 //---------------------------------------------------------------------------//
218 //---------------------------------------------------------------------------//
220 v_add_f64 v
[0:1], s
[0:1], -1
221 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0x82,0x01,0x00]
223 v_add_f64 v
[0:1], s
[0:1], -16
224 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0xa0,0x01,0x00]
226 v_add_f64 v
[0:1], s
[0:1], -0.5
227 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0xe2,0x01,0x00]
229 v_add_f64 v
[0:1], s
[0:1], -1.0
230 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0xe6,0x01,0x00]
232 v_add_f64 v
[0:1], s
[0:1], -2.0
233 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0xea,0x01,0x00]
235 v_add_f64 v
[0:1], s
[0:1], -4.0
236 // CHECK
: [0x00,0x00,0x80,0xd2,0x00,0xee,0x01,0x00]
238 v_add_f64 v
[4:5], s
[0:1], 0x3fc45f306dc9c882
239 // CHECK
: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x00]
241 v_add_f64 v
[4:5], s
[0:1], neg(0x3fc45f306dc9c882)
242 // CHECK
: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x40]
245 v_cubeid_f32 v0
, s0
, s0
, -1
246 // CHECK
: [0x00,0x00,0xc4,0xd1,0x00,0x00,0x04,0x03]
248 v_cubeid_f32 v0
, s0
, s0
, -4.0
249 // CHECK
: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xdc,0x03]
251 v_cubeid_f32 v0
, s0
, s0
, 0x3e22f983
252 // CHECK
: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x03]
254 v_cubeid_f32 v0
, s0
, s0
, neg(0x3e22f983)
255 // CHECK
: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x83]
257 v_cubeid_f32 v0
, s0
, s0
, abs(0x3e22f983)
258 // CHECK
: [0x00,0x04,0xc4,0xd1,0x00,0x00,0xe0,0x03]
261 //---------------------------------------------------------------------------//
262 // VOP3 Instructions without Input Modifiers but with Output Modifiers
263 //---------------------------------------------------------------------------//
265 v_cvt_f64_i32_e64 v
[5:6], s1 clamp
266 // CHECK
: [0x05,0x80,0x44,0xd1,0x01,0x00,0x00,0x00]
268 v_cvt_f64_i32_e64 v
[5:6], s1
mul:2
269 // CHECK
: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x08]
271 v_cvt_f64_i32_e64 v
[5:6], s1
mul:4
272 // CHECK
: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x10]
274 v_cvt_f64_i32_e64 v
[5:6], s1
div:2
275 // CHECK
: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x18]
278 v_cvt_f64_u32_e64 v
[5:6], s1 clamp
279 // CHECK
: [0x05,0x80,0x56,0xd1,0x01,0x00,0x00,0x00]
281 v_cvt_f64_u32_e64 v
[5:6], s1
mul:2
282 // CHECK
: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x08]
284 v_cvt_f64_u32_e64 v
[5:6], s1
mul:4
285 // CHECK
: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x10]
287 v_cvt_f64_u32_e64 v
[5:6], s1
div:2
288 // CHECK
: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x18]
291 v_cvt_f32_i32_e64 v5
, s1 clamp
292 // CHECK
: [0x05,0x80,0x45,0xd1,0x01,0x00,0x00,0x00]
294 v_cvt_f32_i32_e64 v5
, s1
mul:2
295 // CHECK
: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x08]
297 v_cvt_f32_i32_e64 v5
, s1
mul:4
298 // CHECK
: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x10]
300 v_cvt_f32_i32_e64 v5
, s1
div:2
301 // CHECK
: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x18]
304 v_cvt_f32_u32_e64 v5
, s1 clamp
305 // CHECK
: [0x05,0x80,0x46,0xd1,0x01,0x00,0x00,0x00]
307 v_cvt_f32_u32_e64 v5
, s1
mul:2
308 // CHECK
: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x08]
310 v_cvt_f32_u32_e64 v5
, s1
mul:4
311 // CHECK
: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x10]
313 v_cvt_f32_u32_e64 v5
, s1
div:2
314 // CHECK
: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x18]
317 v_cvt_off_f32_i4_e64 v5
, s1 clamp
318 // CHECK
: [0x05,0x80,0x4e,0xd1,0x01,0x00,0x00,0x00]
320 v_cvt_off_f32_i4_e64 v5
, s1
mul:2
321 // CHECK
: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x08]
323 v_cvt_off_f32_i4_e64 v5
, s1
mul:4
324 // CHECK
: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x10]
326 v_cvt_off_f32_i4_e64 v5
, s1
div:2
327 // CHECK
: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x18]
330 v_cvt_f32_ubyte0_e64 v5
, s1 clamp
331 // CHECK
: [0x05,0x80,0x51,0xd1,0x01,0x00,0x00,0x00]
333 v_cvt_f32_ubyte0_e64 v5
, s1
mul:2
334 // CHECK
: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x08]
336 v_cvt_f32_ubyte0_e64 v5
, s1
mul:4
337 // CHECK
: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x10]
339 v_cvt_f32_ubyte0_e64 v5
, s1
div:2
340 // CHECK
: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x18]
343 v_cvt_f32_ubyte1_e64 v5
, s1 clamp
344 // CHECK
: [0x05,0x80,0x52,0xd1,0x01,0x00,0x00,0x00]
346 v_cvt_f32_ubyte1_e64 v5
, s1
mul:2
347 // CHECK
: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x08]
349 v_cvt_f32_ubyte1_e64 v5
, s1
mul:4
350 // CHECK
: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x10]
352 v_cvt_f32_ubyte1_e64 v5
, s1
div:2
353 // CHECK
: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x18]
356 v_cvt_f32_ubyte2_e64 v5
, s1 clamp
357 // CHECK
: [0x05,0x80,0x53,0xd1,0x01,0x00,0x00,0x00]
359 v_cvt_f32_ubyte2_e64 v5
, s1
mul:2
360 // CHECK
: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x08]
362 v_cvt_f32_ubyte2_e64 v5
, s1
mul:4
363 // CHECK
: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x10]
365 v_cvt_f32_ubyte2_e64 v5
, s1
div:2
366 // CHECK
: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x18]
369 v_cvt_f32_ubyte3_e64 v5
, s1 clamp
370 // CHECK
: [0x05,0x80,0x54,0xd1,0x01,0x00,0x00,0x00]
372 v_cvt_f32_ubyte3_e64 v5
, s1
mul:2
373 // CHECK
: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x08]
375 v_cvt_f32_ubyte3_e64 v5
, s1
mul:4
376 // CHECK
: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x10]
378 v_cvt_f32_ubyte3_e64 v5
, s1
div:2
379 // CHECK
: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x18]
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]
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]