[AMDGPU] Check for immediate SrcC in mfma in AsmParser
[llvm-core.git] / test / MC / AMDGPU / fma-mix.s
blob9d4c762bef557e0a9dadadaa94be401985a4e281
1 // RUN: llvm-mc -arch=amdgcn -mcpu=gfx904 -show-encoding %s | FileCheck -check-prefix=GFX9-FMAMIX %s
2 // RUN: llvm-mc -arch=amdgcn -mcpu=gfx906 -show-encoding %s | FileCheck -check-prefix=GFX9-FMAMIX %s
3 // RUN: not llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s 2>&1 | FileCheck -check-prefix=GFX9-MADMIX-ERR %s
5 v_fma_mix_f32 v0, v1, v2, v3
6 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04]
7 // GFX9-MADMIX-ERR: error: instruction not supported on this GPU
9 v_fma_mixlo_f16 v0, v1, v2, v3
10 // GFX9-FMAMIX: v_fma_mixlo_f16 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa1,0xd3,0x01,0x05,0x0e,0x04]
11 // GFX9-MADMIX-ERR: error: instruction not supported on this GPU
13 v_fma_mixhi_f16 v0, v1, v2, v3
14 // GFX9-FMAMIX: v_fma_mixhi_f16 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa2,0xd3,0x01,0x05,0x0e,0x04]
15 // GFX9-MADMIX-ERR: error: instruction not supported on this GPU
18 // Regular source modifiers on non-packed instructions
21 v_fma_mix_f32 v0, abs(v1), v2, v3
22 // GFX9-FMAMIX: v_fma_mix_f32 v0, |v1|, v2, v3 ; encoding: [0x00,0x01,0xa0,0xd3,0x01,0x05,0x0e,0x04]
24 // FIXME: Better error
25 // GFX9-MADMIX-ERR: error: invalid operand for instruction
27 v_fma_mix_f32 v0, v1, abs(v2), v3
28 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, |v2|, v3 ; encoding: [0x00,0x02,0xa0,0xd3,0x01,0x05,0x0e,0x04]
30 v_fma_mix_f32 v0, v1, v2, abs(v3)
31 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, |v3| ; encoding: [0x00,0x04,0xa0,0xd3,0x01,0x05,0x0e,0x04]
33 v_fma_mix_f32 v0, -v1, v2, v3
34 // GFX9-FMAMIX: v_fma_mix_f32 v0, -v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x24]
36 v_fma_mix_f32 v0, v1, -v2, v3
37 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, -v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x44]
39 v_fma_mix_f32 v0, v1, v2, -v3
40 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, -v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x84]
42 v_fma_mix_f32 v0, -abs(v1), v2, v3
43 // GFX9-FMAMIX: v_fma_mix_f32 v0, -|v1|, v2, v3 ; encoding: [0x00,0x01,0xa0,0xd3,0x01,0x05,0x0e,0x24]
45 v_fma_mix_f32 v0, v1, -abs(v2), v3
46 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, -|v2|, v3 ; encoding: [0x00,0x02,0xa0,0xd3,0x01,0x05,0x0e,0x44]
48 v_fma_mix_f32 v0, v1, v2, -abs(v3)
49 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, -|v3| ; encoding: [0x00,0x04,0xa0,0xd3,0x01,0x05,0x0e,0x84]
51 v_fma_mixlo_f16 v0, abs(v1), -v2, abs(v3)
52 // GFX9-FMAMIX: v_fma_mixlo_f16 v0, |v1|, -v2, |v3| ; encoding: [0x00,0x05,0xa1,0xd3,0x01,0x05,0x0e,0x44]
54 v_fma_mixhi_f16 v0, -v1, abs(v2), -abs(v3)
55 // GFX9-FMAMIX: v_fma_mixhi_f16 v0, -v1, |v2|, -|v3| ; encoding: [0x00,0x06,0xa2,0xd3,0x01,0x05,0x0e,0xa4]
57 v_fma_mixlo_f16 v0, v1, v2, v3 clamp
58 // GFX9-FMAMIX: v_fma_mixlo_f16 v0, v1, v2, v3 clamp ; encoding: [0x00,0x80,0xa1,0xd3,0x01,0x05,0x0e,0x04]
60 v_fma_mixhi_f16 v0, v1, v2, v3 clamp
61 // GFX9-FMAMIX: v_fma_mixhi_f16 v0, v1, v2, v3 clamp ; encoding: [0x00,0x80,0xa2,0xd3,0x01,0x05,0x0e,0x04]
64 // op_sel with non-packed instructions
67 v_fma_mix_f32 v0, v1, v2, v3 op_sel:[0,0,0]
68 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04]
69 // FIXME: Better error
70 // GFX-MADMIX-ERR: error: unknown token in expression
72 v_fma_mix_f32 v0, v1, v2, v3 op_sel:[1,0,0]
73 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel:[1,0,0] ; encoding: [0x00,0x08,0xa0,0xd3,0x01,0x05,0x0e,0x04]
75 v_fma_mix_f32 v0, v1, v2, v3 op_sel:[0,1,0]
76 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel:[0,1,0] ; encoding: [0x00,0x10,0xa0,0xd3,0x01,0x05,0x0e,0x04]
78 v_fma_mix_f32 v0, v1, v2, v3 op_sel:[0,0,1]
79 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel:[0,0,1] ; encoding: [0x00,0x20,0xa0,0xd3,0x01,0x05,0x0e,0x04]
81 v_fma_mix_f32 v0, v1, v2, v3 op_sel:[1,1,1]
82 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel:[1,1,1] ; encoding: [0x00,0x38,0xa0,0xd3,0x01,0x05,0x0e,0x04]
84 v_fma_mix_f32 v0, v1, v2, v3
85 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04]
87 v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,0,0]
88 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,0,0] ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x0c]
90 v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,1,0]
91 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,1,0] ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x14]
93 v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,0,1]
94 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,0,1] ; encoding: [0x00,0x40,0xa0,0xd3,0x01,0x05,0x0e,0x04]
96 v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,1,1]
97 // GFX9-FMAMIX: v_fma_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,1,1] ; encoding: [0x00,0x40,0xa0,0xd3,0x01,0x05,0x0e,0x1c]
99 v_fma_mixlo_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp
100 // GFX9-FMAMIX: v_fma_mixlo_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp ; encoding: [0x00,0xc0,0xa1,0xd3,0x01,0x05,0x0e,0x0c]
102 v_fma_mixhi_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp
103 // GFX9-FMAMIX: v_fma_mixhi_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp ; encoding: [0x00,0xc0,0xa2,0xd3,0x01,0x05,0x0e,0x0c]