[llvm] r373736 - [AMDGPU][MC][GFX10] Corrected definition of FLAT GLOBAL/SCRATCH instructions

Dmitry Preobrazhensky via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 05:10:22 PDT 2019


Author: dpreobra
Date: Fri Oct  4 05:10:22 2019
New Revision: 373736

URL: http://llvm.org/viewvc/llvm-project?rev=373736&view=rev
Log:
[AMDGPU][MC][GFX10] Corrected definition of FLAT GLOBAL/SCRATCH instructions

See bug 43483: https://bugs.llvm.org/show_bug.cgi?id=43483

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D68347

Added:
    llvm/trunk/test/MC/Disassembler/AMDGPU/flat_gfx10.txt
Modified:
    llvm/trunk/lib/Target/AMDGPU/FLATInstructions.td
    llvm/trunk/test/MC/AMDGPU/flat-scratch-instructions.s

Modified: llvm/trunk/lib/Target/AMDGPU/FLATInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/FLATInstructions.td?rev=373736&r1=373735&r2=373736&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/FLATInstructions.td (original)
+++ llvm/trunk/lib/Target/AMDGPU/FLATInstructions.td Fri Oct  4 05:10:22 2019
@@ -1184,7 +1184,7 @@ class FLAT_Real_gfx10<bits<7> op, FLAT_P
   let AssemblerPredicate = isGFX10Plus;
   let DecoderNamespace = "GFX10";
 
-  let Inst{11-0}  = {offset{12}, offset{10-0}};
+  let Inst{11-0}  = offset{11-0};
   let Inst{12}    = !if(ps.has_dlc, dlc, ps.dlcValue);
   let Inst{54-48} = !if(ps.has_saddr, !if(ps.enabled_saddr, saddr, 0x7d), 0x7d);
   let Inst{55}    = 0;

Modified: llvm/trunk/test/MC/AMDGPU/flat-scratch-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AMDGPU/flat-scratch-instructions.s?rev=373736&r1=373735&r2=373736&view=diff
==============================================================================
--- llvm/trunk/test/MC/AMDGPU/flat-scratch-instructions.s (original)
+++ llvm/trunk/test/MC/AMDGPU/flat-scratch-instructions.s Fri Oct  4 05:10:22 2019
@@ -115,6 +115,26 @@ scratch_load_dword v1, v2, off offset:-4
 // GFX9-ERR: :32: error: expected a 13-bit signed offset
 // VI-ERR: :32: error: not a valid operand.
 
+scratch_load_dword v0, v1, off offset:-2049 glc slc
+// GFX10-ERR: :32: error: expected a 12-bit signed offset
+// GFX9: scratch_load_dword v0, v1, off offset:-2049 glc slc ; encoding: [0xff,0x57,0x53,0xdc,0x01,0x00,0x7f,0x00]
+// VI-ERR: :32: error: not a valid operand.
+
+scratch_load_dword v0, v1, off offset:-2048 glc slc
+// GFX10: scratch_load_dword v0, v1, off offset:-2048 glc slc ; encoding: [0x00,0x48,0x33,0xdc,0x01,0x00,0x7d,0x00]
+// GFX9: scratch_load_dword v0, v1, off offset:-2048 glc slc ; encoding: [0x00,0x58,0x53,0xdc,0x01,0x00,0x7f,0x00]
+// VI-ERR: :32: error: not a valid operand.
+
+scratch_load_dword v255, off, s1 offset:2047
+// GFX10: scratch_load_dword v255, off, s1 offset:2047 ; encoding: [0xff,0x47,0x30,0xdc,0x00,0x00,0x01,0xff]
+// GFX9: scratch_load_dword v255, off, s1 offset:2047 ; encoding: [0xff,0x47,0x50,0xdc,0x00,0x00,0x01,0xff]
+// VI-ERR: :34: error: not a valid operand.
+
+scratch_load_dword v255, off, s0 offset:2048
+// GFX10-ERR: :34: error: expected a 12-bit signed offset
+// GFX9: scratch_load_dword v255, off, s0 offset:2048 ; encoding: [0x00,0x48,0x50,0xdc,0x00,0x00,0x00,0xff]
+// VI-ERR: :34: error: not a valid operand.
+
 scratch_store_byte v1, v2, off
 // GFX10: encoding: [0x00,0x40,0x60,0xdc,0x01,0x02,0x7d,0x00]
 // GFX9: scratch_store_byte v1, v2, off ; encoding: [0x00,0x40,0x60,0xdc,0x01,0x02,0x7f,0x00]

Added: llvm/trunk/test/MC/Disassembler/AMDGPU/flat_gfx10.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/AMDGPU/flat_gfx10.txt?rev=373736&view=auto
==============================================================================
--- llvm/trunk/test/MC/Disassembler/AMDGPU/flat_gfx10.txt (added)
+++ llvm/trunk/test/MC/Disassembler/AMDGPU/flat_gfx10.txt Fri Oct  4 05:10:22 2019
@@ -0,0 +1,75 @@
+# RUN: llvm-mc -arch=amdgcn -mcpu=gfx1010 -disassemble -show-encoding < %s | FileCheck %s
+
+#===------------------------------------------------------------------------===#
+# scratch_load
+#===------------------------------------------------------------------------===#
+
+# CHECK: scratch_load_dword v1, v255, off offset:-1 glc dlc ; encoding: [0xff,0x5f,0x31,0xdc,0xff,0x00,0x7d,0x01]
+0xff 0x5f 0x31 0xdc 0xff 0x00 0x7d 0x01
+
+# CHECK: scratch_load_dword v5, v255, off offset:-1 glc slc ; encoding: [0xff,0x4f,0x33,0xdc,0xff,0x00,0x7d,0x05]
+0xff 0x4f 0x33 0xdc 0xff 0x00 0x7d 0x05
+
+# CHECK: scratch_load_dword v0, v1, off offset:-2048 glc slc dlc ; encoding: [0x00,0x58,0x33,0xdc,0x01,0x00,0x7d,0x00]
+0x00 0x58 0x33 0xdc 0x01 0x00 0x7d 0x00
+
+# CHECK: scratch_load_dword v255, off, s105 offset:2047 dlc ; encoding: [0xff,0x57,0x30,0xdc,0x00,0x00,0x69,0xff]
+0xff 0x57 0x30 0xdc 0x00 0x00 0x69 0xff
+
+# CHECK: scratch_load_dword v255, v2, off ; encoding: [0x00,0x40,0x30,0xdc,0x02,0x00,0x7d,0xff]
+0x00 0x40 0x30 0xdc 0x02 0x00 0x7d 0xff
+
+# CHECK: scratch_load_dword v5, v0, off dlc ; encoding: [0x00,0x50,0x30,0xdc,0x00,0x00,0x7d,0x05]
+0x00 0x50 0x30 0xdc 0x00 0x00 0x7d 0x05
+
+# CHECK: scratch_load_dword v5, v3, off slc ; encoding: [0x00,0x40,0x32,0xdc,0x03,0x00,0x7d,0x05]
+0x00 0x40 0x32 0xdc 0x03 0x00 0x7d 0x05
+
+# CHECK: scratch_load_dword v5, v255, off slc dlc ; encoding: [0x00,0x50,0x32,0xdc,0xff,0x00,0x7d,0x05]
+0x00 0x50 0x32 0xdc 0xff 0x00 0x7d 0x05
+
+# CHECK: scratch_load_dword v255, off, s2 offset:1 ; encoding: [0x01,0x40,0x30,0xdc,0x00,0x00,0x02,0xff]
+0x01 0x40 0x30 0xdc 0x00 0x00 0x02 0xff
+
+#===------------------------------------------------------------------------===#
+# scratch_store
+#===------------------------------------------------------------------------===#
+
+# CHECK: scratch_store_dword off, v2, s3 offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x03,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v255, s3 offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0xff,0x03,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0xff,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s105 offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x69,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x69,0x00
+
+# CHECK: scratch_store_dword off, v2, vcc_lo offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x6a,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x6a,0x00
+
+# CHECK: scratch_store_dword off, v2, vcc_hi offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x6b,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x6b,0x00
+
+# CHECK: scratch_store_dword off, v2, ttmp15 offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x7b,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x7b,0x00
+
+# CHECK: scratch_store_dword v0, v2, off offset:-1 ; encoding: [0xff,0x4f,0x70,0xdc,0x00,0x02,0x7d,0x00]
+0xff,0x4f,0x70,0xdc,0x00,0x02,0x7d,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 ; encoding: [0x00,0x40,0x70,0xdc,0x00,0x02,0x03,0x00]
+0x00,0x40,0x70,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 offset:2047 ; encoding: [0xff,0x47,0x70,0xdc,0x00,0x02,0x03,0x00]
+0xff,0x47,0x70,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 offset:-2048 ; encoding: [0x00,0x48,0x70,0xdc,0x00,0x02,0x03,0x00]
+0x00,0x48,0x70,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 offset:-1 glc ; encoding: [0xff,0x4f,0x71,0xdc,0x00,0x02,0x03,0x00]
+0xff,0x4f,0x71,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 offset:-1 slc ; encoding: [0xff,0x4f,0x72,0xdc,0x00,0x02,0x03,0x00]
+0xff,0x4f,0x72,0xdc,0x00,0x02,0x03,0x00
+
+# CHECK: scratch_store_dword off, v2, s3 offset:-1 dlc ; encoding: [0xff,0x5f,0x70,0xdc,0x00,0x02,0x03,0x00]
+0xff,0x5f,0x70,0xdc,0x00,0x02,0x03,0x00




More information about the llvm-commits mailing list