From 1f19152abda2fda461663fa578f50760d19f4ee5 Mon Sep 17 00:00:00 2001 From: Dmitry Preobrazhensky Date: Fri, 4 Oct 2019 13:04:17 +0000 Subject: [PATCH] [AMDGPU][MC][GFX10][WS32] Corrected decoding of dst operand for v_cmp_*_sdwa opcodes See bug 43484: https://bugs.llvm.org/show_bug.cgi?id=43484 Reviewers: arsenm, rampitec Differential Revision: https://reviews.llvm.org/D68349 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373745 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp | 3 ++- test/MC/Disassembler/AMDGPU/vcmp-gfx10.txt | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/MC/Disassembler/AMDGPU/vcmp-gfx10.txt diff --git a/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index e3b179c5caf..ec2e2c4e8b7 100644 --- a/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -1173,7 +1173,8 @@ MCOperand AMDGPUDisassembler::decodeSDWAVopcDst(unsigned Val) const { int TTmpIdx = getTTmpIdx(Val); if (TTmpIdx >= 0) { - return createSRegOperand(getTtmpClassId(OPW64), TTmpIdx); + auto TTmpClsId = getTtmpClassId(IsWave64 ? OPW64 : OPW32); + return createSRegOperand(TTmpClsId, TTmpIdx); } else if (Val > SGPR_MAX) { return IsWave64 ? decodeSpecialReg64(Val) : decodeSpecialReg32(Val); diff --git a/test/MC/Disassembler/AMDGPU/vcmp-gfx10.txt b/test/MC/Disassembler/AMDGPU/vcmp-gfx10.txt new file mode 100644 index 00000000000..9dfa8606da4 --- /dev/null +++ b/test/MC/Disassembler/AMDGPU/vcmp-gfx10.txt @@ -0,0 +1,6 @@ +# RUN: llvm-mc -arch=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX10,W32 %s +# RUN: llvm-mc -arch=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -disassemble -show-encoding < %s | FileCheck -check-prefixes=GFX10,W64 %s + +# W32: v_cmp_class_f16_sdwa ttmp14, v1, v2 src0_sel:DWORD src1_sel:DWORD ; encoding: [0xf9,0x04,0x1e,0x7d,0x01,0xfa,0x06,0x06] +# W64: v_cmp_class_f16_sdwa ttmp[14:15], v1, v2 src0_sel:DWORD src1_sel:DWORD ; encoding: [0xf9,0x04,0x1e,0x7d,0x01,0xfa,0x06,0x06] +0xf9,0x04,0x1e,0x7d,0x01,0xfa,0x06,0x06 -- 2.40.0