[AMDGPU] gfx908 v_pk_fmac_f16 support
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 9 Jul 2019 22:42:24 +0000 (22:42 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 9 Jul 2019 22:42:24 +0000 (22:42 +0000)
Differential Revision: https://reviews.llvm.org/D64433

llvm-svn: 365573

llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/VOP2Instructions.td
llvm/test/MC/AMDGPU/xdl-insts-gfx908.s [new file with mode: 0644]
llvm/test/MC/Disassembler/AMDGPU/xdl-insts-gfx908.txt [new file with mode: 0644]

index 47e6421..baeba53 100644 (file)
@@ -666,8 +666,8 @@ def FeatureGFX10 : GCNSubtargetFeatureGeneration<"GFX10",
    FeatureFlatInstOffsets, FeatureFlatGlobalInsts, FeatureFlatScratchInsts,
    FeatureAddNoCarryInsts, FeatureFmaMixInsts, FeatureGFX8Insts,
    FeatureNoSdstCMPX, FeatureVscnt, FeatureRegisterBanking,
-   FeatureVOP3Literal, FeatureDPP8, FeatureNoDataDepHazard,
-   FeatureDoesNotSupportSRAMECC
+   FeatureVOP3Literal, FeatureDPP8,
+   FeatureNoDataDepHazard, FeaturePkFmacF16Inst, FeatureDoesNotSupportSRAMECC
   ]
 >;
 
index 1465f6b..e4f3822 100644 (file)
@@ -694,10 +694,12 @@ let Constraints = "$vdst = $src2",
 defm V_FMAC_F16 : VOP2Inst <"v_fmac_f16", VOP_MAC_F16>;
 }
 
-defm V_PK_FMAC_F16 : VOP2Inst<"v_pk_fmac_f16", VOP_V2F16_V2F16_V2F16>;
-
 } // End SubtargetPredicate = isGFX10Plus
 
+let SubtargetPredicate = HasPkFmacF16Inst in {
+defm V_PK_FMAC_F16 : VOP2Inst<"v_pk_fmac_f16", VOP_V2F16_V2F16_V2F16>;
+} // End SubtargetPredicate = HasPkFmacF16Inst
+
 // Note: 16-bit instructions produce a 0 result in the high 16-bits
 // on GFX8 and GFX9 and preserve high 16 bits on GFX10+
 def ClearHI16 : OutPatFrag<(ops node:$op),
@@ -1548,3 +1550,7 @@ let SubtargetPredicate = HasDot5Insts in {
 let SubtargetPredicate = HasDot6Insts in {
   defm V_DOT4C_I32_I8  : VOP2_Real_DOT_ACC_gfx10<0x0d>;
 }
+
+let SubtargetPredicate = HasPkFmacF16Inst in {
+defm V_PK_FMAC_F16 : VOP2_Real_e32_vi<0x3c>;
+} // End SubtargetPredicate = HasPkFmacF16Inst
diff --git a/llvm/test/MC/AMDGPU/xdl-insts-gfx908.s b/llvm/test/MC/AMDGPU/xdl-insts-gfx908.s
new file mode 100644 (file)
index 0000000..81a7882
--- /dev/null
@@ -0,0 +1,46 @@
+// RUN: llvm-mc -arch=amdgcn -mcpu=gfx908 -show-encoding %s | FileCheck %s
+
+// CHECK: encoding: [0x01,0x05,0x0a,0x78]
+v_pk_fmac_f16 v5, v1, v2
+
+// CHECK: encoding: [0x01,0x05,0xfe,0x79]
+v_pk_fmac_f16 v255, v1, v2
+
+// CHECK: encoding: [0xff,0x05,0x0a,0x78]
+v_pk_fmac_f16 v5, v255, v2
+
+// CHECK: encoding: [0x01,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, s1, v2
+
+// CHECK: encoding: [0x6a,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, vcc_lo, v2
+
+// CHECK: encoding: [0x6b,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, vcc_hi, v2
+
+// CHECK: encoding: [0x77,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, ttmp11, v2
+
+// CHECK: encoding: [0x7c,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, m0, v2
+
+// CHECK: encoding: [0x7e,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, exec_lo, v2
+
+// CHECK: encoding: [0x7f,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, exec_hi, v2
+
+// CHECK: encoding: [0x80,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, 0, v2
+
+// CHECK: encoding: [0xc1,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, -1, v2
+
+// CHECK: encoding: [0xf0,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, 0.5, v2
+
+// CHECK: encoding: [0xf7,0x04,0x0a,0x78]
+v_pk_fmac_f16 v5, -4.0, v2
+
+// CHECK: encoding: [0x01,0xff,0x0b,0x78]
+v_pk_fmac_f16 v5, v1, v255
diff --git a/llvm/test/MC/Disassembler/AMDGPU/xdl-insts-gfx908.txt b/llvm/test/MC/Disassembler/AMDGPU/xdl-insts-gfx908.txt
new file mode 100644 (file)
index 0000000..893fc3d
--- /dev/null
@@ -0,0 +1,46 @@
+# RUN: llvm-mc -arch=amdgcn -mcpu=gfx908 -disassemble -show-encoding < %s | FileCheck %s
+
+# CHECK: v_pk_fmac_f16_e32 v5, v1, v2 ; encoding: [0x01,0x05,0x0a,0x78]
+0x01,0x05,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v255, v1, v2 ; encoding: [0x01,0x05,0xfe,0x79]
+0x01,0x05,0xfe,0x79
+
+# CHECK: v_pk_fmac_f16_e32 v5, v255, v2 ; encoding: [0xff,0x05,0x0a,0x78]
+0xff,0x05,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, s1, v2 ; encoding: [0x01,0x04,0x0a,0x78]
+0x01,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, vcc_lo, v2 ; encoding: [0x6a,0x04,0x0a,0x78]
+0x6a,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, vcc_hi, v2 ; encoding: [0x6b,0x04,0x0a,0x78]
+0x6b,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, ttmp11, v2 ; encoding: [0x77,0x04,0x0a,0x78]
+0x77,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, m0, v2 ; encoding: [0x7c,0x04,0x0a,0x78]
+0x7c,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, exec_lo, v2 ; encoding: [0x7e,0x04,0x0a,0x78]
+0x7e,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, exec_hi, v2 ; encoding: [0x7f,0x04,0x0a,0x78]
+0x7f,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, 0, v2 ; encoding: [0x80,0x04,0x0a,0x78]
+0x80,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, -1, v2 ; encoding: [0xc1,0x04,0x0a,0x78]
+0xc1,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, 0.5, v2 ; encoding: [0xf0,0x04,0x0a,0x78]
+0xf0,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, -4.0, v2 ; encoding: [0xf7,0x04,0x0a,0x78]
+0xf7,0x04,0x0a,0x78
+
+# CHECK: v_pk_fmac_f16_e32 v5, v1, v255 ; encoding: [0x01,0xff,0x0b,0x78]
+0x01,0xff,0x0b,0x78