llvm.org GIT mirror llvm / 6f67bb8
[AMDGPU][MC][DISASSEMBLER][GFX9] Corrected decoding of GLOBAL/SCRATCH opcodes See bug 35433: https://bugs.llvm.org/show_bug.cgi?id=35433 Differential Revision: https://reviews.llvm.org/D40493 Reviewers: artem.tamazov, SamWot, arsenm git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319050 91177308-0d34-0410-b5e6-96231b3b80d8 Dmitry Preobrazhensky 2 years ago
4 changed file(s) with 91 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
304304 def _SADDR : FLAT_AtomicNoRet_Pseudo
305305 (outs),
306306 (ins VReg_64:$vaddr, data_rc:$vdata, SReg_64:$saddr, offset_s13:$offset, slc:$slc),
307 " $vaddr, $vdata$saddr$offset$slc">,
307 " $vaddr, $vdata, $saddr$offset$slc">,
308308 AtomicNoRet {
309309 let has_saddr = 1;
310310 let enabled_saddr = 1;
314314 def _SADDR_RTN : FLAT_AtomicRet_Pseudo
315315 (outs vdst_rc:$vdst),
316316 (ins VReg_64:$vaddr, data_rc:$vdata, SReg_64:$saddr, offset_s13:$offset, slc:$slc),
317 " $vdst, $vaddr, $vdata$saddr$offset glc$slc">,
317 " $vdst, $vaddr, $vdata, $saddr$offset glc$slc">,
318318 AtomicNoRet {
319319 let has_saddr = 1;
320320 let enabled_saddr = 1;
7171 O << formatDec(MI->getOperand(OpNo).getImm() & 0xffff);
7272 }
7373
74 void AMDGPUInstPrinter::printS16ImmDecOperand(const MCInst *MI, unsigned OpNo,
74 void AMDGPUInstPrinter::printS13ImmDecOperand(const MCInst *MI, unsigned OpNo,
7575 raw_ostream &O) {
76 O << formatDec(static_cast>(MI->getOperand(OpNo).getImm()));
76 O << formatDec(SignExtend32<13>(MI->getOperand(OpNo).getImm()));
7777 }
7878
7979 void AMDGPUInstPrinter::printU32ImmOperand(const MCInst *MI, unsigned OpNo,
128128 uint16_t Imm = MI->getOperand(OpNo).getImm();
129129 if (Imm != 0) {
130130 O << ((OpNo == 0)? "offset:" : " offset:");
131 printS16ImmDecOperand(MI, OpNo, O);
131 printS13ImmDecOperand(MI, OpNo, O);
132132 }
133133 }
134134
4141 void printU4ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4242 void printU8ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4343 void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
44 void printS16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
44 void printS13ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4545 void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
4646 const MCSubtargetInfo &STI, raw_ostream &O);
4747 void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,
0 # RUN: llvm-mc -arch=amdgcn -mcpu=gfx901 -disassemble -show-encoding < %s | FileCheck %s
1
2 # CHECK: flat_atomic_add v[0:1], v0 ; encoding: [0x00,0x00,0x08,0xdd,0x00,0x00,0x00,0x00]
3 0x00,0x00,0x08,0xdd,0x00,0x00,0x00,0x00
4
5 # CHECK: flat_atomic_add v[0:1], v0 offset:7 ; encoding: [0x07,0x00,0x08,0xdd,0x00,0x00,0x00,0x00]
6 0x07,0x00,0x08,0xdd,0x00,0x00,0x00,0x00
7
8 # CHECK: flat_atomic_add v0, v[0:1], v0 offset:4095 glc ; encoding: [0xff,0x0f,0x09,0xdd,0x00,0x00,0x00,0x00]
9 0xff,0x0f,0x09,0xdd,0x00,0x00,0x00,0x00
10
11 # CHECK: flat_atomic_add v[0:1], v0 offset:4095 slc ; encoding: [0xff,0x0f,0x0a,0xdd,0x00,0x00,0x00,0x00]
12 0xff,0x0f,0x0a,0xdd,0x00,0x00,0x00,0x00
13
14 # CHECK: flat_load_dword v0, v[0:1] ; encoding: [0x00,0x00,0x50,0xdc,0x00,0x00,0x00,0x00]
15 0x00,0x00,0x50,0xdc,0x00,0x00,0x00,0x00
16
17 # CHECK: flat_load_dword v0, v[0:1] offset:7 ; encoding: [0x07,0x00,0x50,0xdc,0x00,0x00,0x00,0x00]
18 0x07,0x00,0x50,0xdc,0x00,0x00,0x00,0x00
19
20 # CHECK: flat_load_dword v0, v[0:1] offset:4095 glc ; encoding: [0xff,0x0f,0x51,0xdc,0x00,0x00,0x00,0x00]
21 0xff,0x0f,0x51,0xdc,0x00,0x00,0x00,0x00
22
23 # CHECK: flat_store_byte v[0:1], v0 ; encoding: [0x00,0x00,0x60,0xdc,0x00,0x00,0x00,0x00]
24 0x00,0x00,0x60,0xdc,0x00,0x00,0x00,0x00
25
26 # CHECK: flat_store_byte v[0:1], v0 offset:7 ; encoding: [0x07,0x00,0x60,0xdc,0x00,0x00,0x00,0x00]
27 0x07,0x00,0x60,0xdc,0x00,0x00,0x00,0x00
28
29 # CHECK: flat_store_byte v[0:1], v0 offset:4095 glc ; encoding: [0xff,0x0f,0x61,0xdc,0x00,0x00,0x00,0x00]
30 0xff,0x0f,0x61,0xdc,0x00,0x00,0x00,0x00
31
32 # CHECK: global_atomic_add v[2:3], v4, s[0:1] ; encoding: [0x00,0x80,0x08,0xdd,0x02,0x04,0x00,0x00]
33 0x00,0x80,0x08,0xdd,0x02,0x04,0x00,0x00
34
35 # CHECK: global_atomic_add v[2:3], v4, s[0:1] offset:4095 ; encoding: [0xff,0x8f,0x08,0xdd,0x02,0x04,0x00,0x00]
36 0xff,0x8f,0x08,0xdd,0x02,0x04,0x00,0x00
37
38 # CHECK: global_atomic_add v[2:3], v4, s[0:1] offset:-4096 ; encoding: [0x00,0x90,0x08,0xdd,0x02,0x04,0x00,0x00]
39 0x00,0x90,0x08,0xdd,0x02,0x04,0x00,0x00
40
41 # CHECK: global_atomic_add v0, v[2:3], v4, s[0:1] offset:-1 glc ; encoding: [0xff,0x9f,0x09,0xdd,0x02,0x04,0x00,0x00]
42 0xff,0x9f,0x09,0xdd,0x02,0x04,0x00,0x00
43
44 # CHECK: global_load_sbyte v0, v[2:3], s[0:1] ; encoding: [0x00,0x80,0x44,0xdc,0x02,0x00,0x00,0x00]
45 0x00,0x80,0x44,0xdc,0x02,0x00,0x00,0x00
46
47 # CHECK: global_load_sbyte v0, v[2:3], s[0:1] offset:4095 ; encoding: [0xff,0x8f,0x44,0xdc,0x02,0x00,0x00,0x00]
48 0xff,0x8f,0x44,0xdc,0x02,0x00,0x00,0x00
49
50 # CHECK: global_load_sbyte v0, v[2:3], s[0:1] offset:-4096 ; encoding: [0x00,0x90,0x44,0xdc,0x02,0x00,0x00,0x00]
51 0x00,0x90,0x44,0xdc,0x02,0x00,0x00,0x00
52
53 # CHECK: global_store_dwordx2 v[2:3], v[4:5], s[0:1] ; encoding: [0x00,0x80,0x74,0xdc,0x02,0x04,0x00,0x00]
54 0x00,0x80,0x74,0xdc,0x02,0x04,0x00,0x00
55
56 # CHECK: global_store_dwordx2 v[2:3], v[4:5], s[0:1] offset:4095 ; encoding: [0xff,0x8f,0x74,0xdc,0x02,0x04,0x00,0x00]
57 0xff,0x8f,0x74,0xdc,0x02,0x04,0x00,0x00
58
59 # CHECK: global_store_dwordx2 v[2:3], v[4:5], s[0:1] offset:-4096 ; encoding: [0x00,0x90,0x74,0xdc,0x02,0x04,0x00,0x00]
60 0x00,0x90,0x74,0xdc,0x02,0x04,0x00,0x00
61
62 # CHECK: scratch_load_dword v0, v0, off offset:-1 ; encoding: [0xff,0x5f,0x50,0xdc,0x00,0x00,0x7f,0x00]
63 0xff,0x5f,0x50,0xdc,0x00,0x00,0x7f,0x00
64
65 # CHECK: scratch_load_dword v0, off, s0 ; encoding: [0x00,0x40,0x50,0xdc,0x00,0x00,0x00,0x00]
66 0x00,0x40,0x50,0xdc,0x00,0x00,0x00,0x00
67
68 # CHECK: scratch_load_dword v0, off, s0 offset:4095 ; encoding: [0xff,0x4f,0x50,0xdc,0x00,0x00,0x00,0x00]
69 0xff,0x4f,0x50,0xdc,0x00,0x00,0x00,0x00
70
71 # CHECK: scratch_load_dword v0, off, s0 offset:-4096 ; encoding: [0x00,0x50,0x50,0xdc,0x00,0x00,0x00,0x00]
72 0x00,0x50,0x50,0xdc,0x00,0x00,0x00,0x00
73
74 # CHECK: scratch_store_short v0, v0, off offset:-1 ; encoding: [0xff,0x5f,0x68,0xdc,0x00,0x00,0x7f,0x00]
75 0xff,0x5f,0x68,0xdc,0x00,0x00,0x7f,0x00
76
77 # CHECK: scratch_store_short off, v0, s0 ; encoding: [0x00,0x40,0x68,0xdc,0x00,0x00,0x00,0x00]
78 0x00,0x40,0x68,0xdc,0x00,0x00,0x00,0x00
79
80 # CHECK: scratch_store_short off, v0, s0 offset:4095 ; encoding: [0xff,0x4f,0x68,0xdc,0x00,0x00,0x00,0x00]
81 0xff,0x4f,0x68,0xdc,0x00,0x00,0x00,0x00
82
83 # CHECK: scratch_store_short off, v0, s0 offset:-4096 ; encoding: [0x00,0x50,0x68,0xdc,0x00,0x00,0x00,0x00]
84 0x00,0x50,0x68,0xdc,0x00,0x00,0x00,0x00