]> granicus.if.org Git - llvm/commitdiff
AMDGPU: Fix vintrp disassembly
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 10 Dec 2016 00:29:55 +0000 (00:29 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 10 Dec 2016 00:29:55 +0000 (00:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289292 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIInstrFormats.td
lib/Target/AMDGPU/SIInstructions.td
test/MC/Disassembler/AMDGPU/missing_op.txt [deleted file]
test/MC/Disassembler/AMDGPU/vintrp.txt [new file with mode: 0644]

index ea5e58d07e029faeec7b25895f1032ab36666614..5523ec142ba736048b0290b793e4853f9eb73665 100644 (file)
@@ -242,7 +242,7 @@ let Uses = [EXEC] in {
 
 class VINTRPCommon <dag outs, dag ins, string asm, list<dag> pattern> :
     InstSI <outs, ins, asm, pattern> {
-
+  let VINTRP = 1;
   // VINTRP instructions read parameter values from LDS, but these parameter
   // values are stored outside of the LDS memory that is allocated to the
   // shader for general purpose use.
index 9f728110faa3d9e40c31fc722a19c132b9b064f4..0d6166ac2aff3c466199402ab94347e99bc0ff38 100644 (file)
@@ -51,10 +51,10 @@ let Uses = [M0, EXEC] in {
 multiclass V_INTERP_P1_F32_m : VINTRP_m <
   0x00000000,
   (outs VGPR_32:$vdst),
-  (ins VGPR_32:$i, i32imm:$attr_chan, i32imm:$attr),
-  "v_interp_p1_f32 $vdst, $i, $attr_chan, $attr",
-  [(set f32:$vdst, (AMDGPUinterp_p1 f32:$i, (i32 imm:$attr_chan),
-                                            (i32 imm:$attr)))]
+  (ins VGPR_32:$vsrc, i32imm:$attrchan, i32imm:$attr),
+  "v_interp_p1_f32 $vdst, $vsrc, $attrchan, $attr",
+  [(set f32:$vdst, (AMDGPUinterp_p1 f32:$vsrc, (i32 imm:$attrchan),
+                                               (i32 imm:$attr)))]
 >;
 
 let OtherPredicates = [has32BankLDS] in {
@@ -74,19 +74,19 @@ let DisableEncoding = "$src0", Constraints = "$src0 = $vdst" in {
 defm V_INTERP_P2_F32 : VINTRP_m <
   0x00000001,
   (outs VGPR_32:$vdst),
-  (ins VGPR_32:$src0, VGPR_32:$j, i32imm:$attr_chan, i32imm:$attr),
-  "v_interp_p2_f32 $vdst, $j, $attr_chan, $attr",
-  [(set f32:$vdst, (AMDGPUinterp_p2 f32:$src0, f32:$j, (i32 imm:$attr_chan),
-                                                       (i32 imm:$attr)))]>;
+  (ins VGPR_32:$src0, VGPR_32:$vsrc, i32imm:$attrchan, i32imm:$attr),
+  "v_interp_p2_f32 $vdst, $vsrc, $attrchan, $attr",
+  [(set f32:$vdst, (AMDGPUinterp_p2 f32:$src0, f32:$vsrc, (i32 imm:$attrchan),
+                                                          (i32 imm:$attr)))]>;
 
 } // End DisableEncoding = "$src0", Constraints = "$src0 = $vdst"
 
 defm V_INTERP_MOV_F32 : VINTRP_m <
   0x00000002,
   (outs VGPR_32:$vdst),
-  (ins InterpSlot:$src0, i32imm:$attr_chan, i32imm:$attr),
-  "v_interp_mov_f32 $vdst, $src0, $attr_chan, $attr",
-  [(set f32:$vdst, (AMDGPUinterp_mov (i32 imm:$src0), (i32 imm:$attr_chan),
+  (ins InterpSlot:$vsrc, i32imm:$attrchan, i32imm:$attr),
+  "v_interp_mov_f32 $vdst, $vsrc, $attrchan, $attr",
+  [(set f32:$vdst, (AMDGPUinterp_mov (i32 imm:$vsrc), (i32 imm:$attrchan),
                                      (i32 imm:$attr)))]>;
 
 } // End Uses = [M0, EXEC]
diff --git a/test/MC/Disassembler/AMDGPU/missing_op.txt b/test/MC/Disassembler/AMDGPU/missing_op.txt
deleted file mode 100644 (file)
index 010da5f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# RUN: llvm-mc -arch=amdgcn -mcpu=fiji -disassemble < %s | FileCheck %s -check-prefix=VI
-
-#TODO: this test will fail when we fix v_interp_p2_f32 signature, remove it then
-#VI: v_interp_p2_f32 v7, 16, /*Missing OP3*/, /*Missing OP4*/
-0xd4 0x41 0x1d 0xd4
diff --git a/test/MC/Disassembler/AMDGPU/vintrp.txt b/test/MC/Disassembler/AMDGPU/vintrp.txt
new file mode 100644 (file)
index 0000000..881f09b
--- /dev/null
@@ -0,0 +1,49 @@
+# RUN: llvm-mc -arch=amdgcn -mcpu=fiji -disassemble < %s | FileCheck %s -check-prefix=VI
+
+#VI: v_interp_p1_f32 v7, v212, 1, 16
+0xd4 0x41 0x1c 0xd4
+
+#VI: v_interp_p2_f32 v7, v212, 1, 16
+0xd4 0x41 0x1d 0xd4
+
+#VI: v_interp_mov_f32 v7, invalid_param_212, 1, 16
+0xd4 0x41 0x1e 0xd4
+
+#VI: v_interp_mov_f32 v7, p10, 1, 16
+0x00 0x41 0x1e 0xd4
+
+#VI: v_interp_mov_f32 v7, p20, 1, 16
+0x01 0x41 0x1e 0xd4
+
+#VI: v_interp_mov_f32 v7, p0, 1, 16
+0x02 0x41 0x1e 0xd4
+
+#VI: v_interp_mov_f32 v7, invalid_param_3, 1, 16
+0x03 0x41 0x1e 0xd4
+
+# VI: v_interp_p1_f32 v0, v0, 0, 0
+0x00 0x00 0x00 0xd4
+
+# VI: v_interp_p1_f32 v0, v0, 0, 0
+0x00 0x00 0x00 0xd4
+
+# VI: v_interp_p1_f32 v0, v1, 0, 0
+0x01 0x00 0x00 0xd4
+
+# VI: v_interp_p1_f32 v0, v1, 3, 0
+0x01 0x03 0x00 0xd4
+
+# VI: v_interp_p2_f32 v0, v1, 0, 0
+0x01 0x00 0x01 0xd4
+
+# VI: v_interp_mov_f32 v0, p20, 0, 0
+0x01 0x00 0x02 0xd4
+
+#VI: v_interp_p2_f32 v0, v1, 0, 63
+0x01 0xfc 0x01 0xd4
+
+#VI: v_interp_p2_f32 v0, v1, 0, 63
+0x01 0xfc 0x01 0xd4
+
+#VI: v_interp_p2_f32 v0, v1, 3, 63
+0x01 0xff 0x01 0xd4