1// RUN: llvm-mc -arch=amdgcn -mcpu=gfx900 -show-encoding %s | FileCheck -check-prefix=GFX9-MADMIX %s 2// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx904 -show-encoding %s 2>&1 | FileCheck -check-prefix=GFX9-FMAMIX-ERR %s 3// RUN: not llvm-mc -arch=amdgcn -mcpu=gfx906 -show-encoding %s 2>&1 | FileCheck -check-prefix=GFX9-FMAMIX-ERR %s 4 5v_mad_mix_f32 v0, v1, v2, v3 6// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04] 7// GFX9-FMAMIX-ERR: error: instruction not supported on this GPU 8 9v_mad_mixlo_f16 v0, v1, v2, v3 10// GFX9-MADMIX: v_mad_mixlo_f16 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa1,0xd3,0x01,0x05,0x0e,0x04] 11// GFX9-FMAMIX-ERR: error: instruction not supported on this GPU 12 13v_mad_mixhi_f16 v0, v1, v2, v3 14// GFX9-MADMIX: v_mad_mixhi_f16 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa2,0xd3,0x01,0x05,0x0e,0x04] 15// GFX9-FMAMIX-ERR: error: instruction not supported on this GPU 16 17// 18// Regular source modifiers on non-packed instructions 19// 20 21v_mad_mix_f32 v0, abs(v1), v2, v3 22// GFX9-MADMIX: v_mad_mix_f32 v0, |v1|, v2, v3 ; encoding: [0x00,0x01,0xa0,0xd3,0x01,0x05,0x0e,0x04] 23 24// FIXME: Better error 25// GFX9-FMAMIX-ERR: error: invalid operand for instruction 26 27v_mad_mix_f32 v0, v1, abs(v2), v3 28// GFX9-MADMIX: v_mad_mix_f32 v0, v1, |v2|, v3 ; encoding: [0x00,0x02,0xa0,0xd3,0x01,0x05,0x0e,0x04] 29 30v_mad_mix_f32 v0, v1, v2, abs(v3) 31// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, |v3| ; encoding: [0x00,0x04,0xa0,0xd3,0x01,0x05,0x0e,0x04] 32 33v_mad_mix_f32 v0, -v1, v2, v3 34// GFX9-MADMIX: v_mad_mix_f32 v0, -v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x24] 35 36v_mad_mix_f32 v0, v1, -v2, v3 37// GFX9-MADMIX: v_mad_mix_f32 v0, v1, -v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x44] 38 39v_mad_mix_f32 v0, v1, v2, -v3 40// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, -v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x84] 41 42v_mad_mix_f32 v0, -abs(v1), v2, v3 43// GFX9-MADMIX: v_mad_mix_f32 v0, -|v1|, v2, v3 ; encoding: [0x00,0x01,0xa0,0xd3,0x01,0x05,0x0e,0x24] 44 45v_mad_mix_f32 v0, v1, -abs(v2), v3 46// GFX9-MADMIX: v_mad_mix_f32 v0, v1, -|v2|, v3 ; encoding: [0x00,0x02,0xa0,0xd3,0x01,0x05,0x0e,0x44] 47 48v_mad_mix_f32 v0, v1, v2, -abs(v3) 49// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, -|v3| ; encoding: [0x00,0x04,0xa0,0xd3,0x01,0x05,0x0e,0x84] 50 51v_mad_mixlo_f16 v0, abs(v1), -v2, abs(v3) 52// GFX9-MADMIX: v_mad_mixlo_f16 v0, |v1|, -v2, |v3| ; encoding: [0x00,0x05,0xa1,0xd3,0x01,0x05,0x0e,0x44] 53 54v_mad_mixhi_f16 v0, -v1, abs(v2), -abs(v3) 55// GFX9-MADMIX: v_mad_mixhi_f16 v0, -v1, |v2|, -|v3| ; encoding: [0x00,0x06,0xa2,0xd3,0x01,0x05,0x0e,0xa4] 56 57v_mad_mixlo_f16 v0, v1, v2, v3 clamp 58// GFX9-MADMIX: v_mad_mixlo_f16 v0, v1, v2, v3 clamp ; encoding: [0x00,0x80,0xa1,0xd3,0x01,0x05,0x0e,0x04] 59 60v_mad_mixhi_f16 v0, v1, v2, v3 clamp 61// GFX9-MADMIX: v_mad_mixhi_f16 v0, v1, v2, v3 clamp ; encoding: [0x00,0x80,0xa2,0xd3,0x01,0x05,0x0e,0x04] 62 63// 64// op_sel with non-packed instructions 65// 66 67v_mad_mix_f32 v0, v1, v2, v3 op_sel:[0,0,0] 68// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04] 69// FIXME: Better error 70// GFX-FMAMIX-ERR: error: unknown token in expression 71 72v_mad_mix_f32 v0, v1, v2, v3 op_sel:[1,0,0] 73// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel:[1,0,0] ; encoding: [0x00,0x08,0xa0,0xd3,0x01,0x05,0x0e,0x04] 74 75v_mad_mix_f32 v0, v1, v2, v3 op_sel:[0,1,0] 76// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel:[0,1,0] ; encoding: [0x00,0x10,0xa0,0xd3,0x01,0x05,0x0e,0x04] 77 78v_mad_mix_f32 v0, v1, v2, v3 op_sel:[0,0,1] 79// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel:[0,0,1] ; encoding: [0x00,0x20,0xa0,0xd3,0x01,0x05,0x0e,0x04] 80 81v_mad_mix_f32 v0, v1, v2, v3 op_sel:[1,1,1] 82// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel:[1,1,1] ; encoding: [0x00,0x38,0xa0,0xd3,0x01,0x05,0x0e,0x04] 83 84v_mad_mix_f32 v0, v1, v2, v3 85// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x04] 86 87v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,0,0] 88// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,0,0] ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x0c] 89 90v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,1,0] 91// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,1,0] ; encoding: [0x00,0x00,0xa0,0xd3,0x01,0x05,0x0e,0x14] 92 93v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,0,1] 94// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[0,0,1] ; encoding: [0x00,0x40,0xa0,0xd3,0x01,0x05,0x0e,0x04] 95 96v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,1,1] 97// GFX9-MADMIX: v_mad_mix_f32 v0, v1, v2, v3 op_sel_hi:[1,1,1] ; encoding: [0x00,0x40,0xa0,0xd3,0x01,0x05,0x0e,0x1c] 98 99v_mad_mixlo_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp 100// GFX9-MADMIX: v_mad_mixlo_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp ; encoding: [0x00,0xc0,0xa1,0xd3,0x01,0x05,0x0e,0x0c] 101 102v_mad_mixhi_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp 103// GFX9-MADMIX: v_mad_mixhi_f16 v0, v1, v2, v3 op_sel_hi:[1,0,1] clamp ; encoding: [0x00,0xc0,0xa2,0xd3,0x01,0x05,0x0e,0x0c] 104