-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[AMDGPU][MC] Disassembler warning for v_cmpx instructions #128256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AMDGPU][MC] Disassembler warning for v_cmpx instructions #128256
Conversation
For GFX10+ the destination reg of v_cmpx instructions and others is implicitly EXEC, which is encoded as 0x7E. However, the disassembler does not check this field, thus allowing any value. With this patch, if the field is not 0x7E a warning is issued.
@llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-mc Author: Jun Wang (jwanggit86) ChangesFor GFX10+ the destination reg of v_cmpx instructions and others is implicitly EXEC, which is encoded as 0x7E. However, the disassembler does not check this field, thus allowing any value. With this patch, if the field is not 0x7E a warning is issued. Patch is 22.39 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/128256.diff 4 Files Affected:
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index 901bfcf5fa54f..50748c7d54660 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
@@ -194,6 +194,7 @@ class MCDisassembler {
private:
MCContext &Ctx;
+ std::string ErrorOrWarningMsg;
protected:
// Subtarget information, for instruction decoding predicates if required.
@@ -222,6 +223,9 @@ class MCDisassembler {
// Marked mutable because we cache it inside the disassembler, rather than
// having to pass it around as an argument through all the autogenerated code.
mutable raw_ostream *CommentStream = nullptr;
+
+ const std::string& getErrorOrWarningMsg() const { return ErrorOrWarningMsg; }
+ void setErrorOrWarningMsg(const std::string &Msg) { ErrorOrWarningMsg = Msg; }
};
} // end namespace llvm
diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
index 308ab8e3b82c4..327fc78ee0e47 100644
--- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
@@ -663,6 +663,8 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
return MCDisassembler::Fail;
} while (false);
+ DecodeStatus Status = MCDisassembler::Success;
+
if (MCII->get(MI.getOpcode()).TSFlags & SIInstrFlags::DPP) {
if (isMacDPP(MI))
convertMacDPPInst(MI);
@@ -801,8 +803,17 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
if (ImmLitIdx != -1 && !IsSOPK)
convertFMAanyK(MI, ImmLitIdx);
+ if ((MCII->get(MI.getOpcode()).TSFlags & SIInstrFlags::VOP3) &&
+ MCII->get(MI.getOpcode()).hasImplicitDefOfPhysReg(AMDGPU::EXEC)) {
+ auto ExecEncoding = MRI.getEncodingValue(AMDGPU::EXEC_LO);
+ if (Bytes_[0] != ExecEncoding) {
+ const_cast<AMDGPUDisassembler*>(this)->setErrorOrWarningMsg("invalid vdst encoding");
+ Status = MCDisassembler::SoftFail;
+ }
+ }
+
Size = MaxInstBytesNum - Bytes.size();
- return MCDisassembler::Success;
+ return Status;
}
void AMDGPUDisassembler::convertEXPInst(MCInst &MI) const {
diff --git a/llvm/test/MC/Disassembler/AMDGPU/gfx10_vop3cx_warn.txt b/llvm/test/MC/Disassembler/AMDGPU/gfx10_vop3cx_warn.txt
new file mode 100644
index 0000000000000..f735a28158637
--- /dev/null
+++ b/llvm/test/MC/Disassembler/AMDGPU/gfx10_vop3cx_warn.txt
@@ -0,0 +1,407 @@
+# RUN: llvm-mc -triple=amdgcn -mcpu=gfx1010 -disassemble -show-encoding < %s 2>&1 | FileCheck -check-prefixes=GFX10 %s
+
+### class
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_class_f16_e64 v1, v2 ; encoding: [0x7e,0x00,0x9f,0xd4,0x01,0x05,0x02,0x00]
+0x00,0x00,0x9f,0xd4,0x01,0x05,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_class_f32_e64 v1, v2 ; encoding: [0x7e,0x00,0x98,0xd4,0x01,0x05,0x02,0x00]
+0x01,0x00,0x98,0xd4,0x01,0x05,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_class_f64_e64 s[4:5], v2 ; encoding: [0x7e,0x00,0xb8,0xd4,0x04,0x04,0x02,0x00]
+0x02,0x00,0xb8,0xd4,0x04,0x04,0x02,0x00
+
+### eq
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_f16_e64 0.5, v2 ; encoding: [0x7e,0x00,0xda,0xd4,0xf0,0x04,0x02,0x00]
+0x03,0x00,0xda,0xd4,0xf0,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x12,0xd4,0xf7,0x04,0x02,0x00]
+0x04,0x00,0x12,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_f64_e64 v[1:2], -4.0 ; encoding: [0x7e,0x00,0x32,0xd4,0x01,0xef,0x01,0x00]
+0x05,0x00,0x32,0xd4,0x01,0xef,0x01,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x9a,0xd4,0xc1,0x04,0x02,0x00]
+0x06,0x00,0x9a,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x92,0xd4,0xc1,0x04,0x02,0x00]
+0x07,0x00,0x92,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb2,0xd4,0xc1,0x04,0x02,0x00]
+0x08,0x00,0xb2,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_u16_e64 s1, v2 ; encoding: [0x7e,0x00,0xba,0xd4,0x01,0x04,0x02,0x00]
+0x09,0x00,0xba,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd2,0xd4,0x01,0x04,0x02,0x00]
+0x0a,0x00,0xd2,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_eq_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf2,0xd4,0x02,0x04,0x02,0x00]
+0x0b,0x00,0xf2,0xd4,0x02,0x04,0x02,0x00
+
+### f_f
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xd8,0xd4,0xf7,0x04,0x02,0x00]
+0x0c,0x00,0xd8,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x10,0xd4,0xf7,0x04,0x02,0x00]
+0x0d,0x00,0x10,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x30,0xd4,0xf7,0x04,0x02,0x00]
+0x0e,0x00,0x30,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x90,0xd4,0xc1,0x04,0x02,0x00]
+0x0f,0x00,0x90,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb0,0xd4,0xc1,0x04,0x02,0x00]
+0x10,0x00,0xb0,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd0,0xd4,0x01,0x04,0x02,0x00]
+0x11,0x00,0xd0,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_f_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf0,0xd4,0x02,0x04,0x02,0x00]
+0x12,0x00,0xf0,0xd4,0x02,0x04,0x02,0x00
+
+### ge
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xde,0xd4,0xf7,0x04,0x02,0x00]
+0x13,0x00,0xde,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x16,0xd4,0xf7,0x04,0x02,0x00]
+0x14,0x00,0x16,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x36,0xd4,0xf7,0x04,0x02,0x00]
+0x15,0x00,0x36,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x9e,0xd4,0xc1,0x04,0x02,0x00]
+0x16,0x00,0x9e,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x96,0xd4,0xc1,0x04,0x02,0x00]
+0x17,0x00,0x96,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb6,0xd4,0xc1,0x04,0x02,0x00]
+0x18,0x00,0xb6,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_u16_e64 -1, v2 ; encoding: [0x7e,0x00,0xbe,0xd4,0xc1,0x04,0x02,0x00]
+0x19,0x00,0xbe,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_u16_e64 v1, m0 ; encoding: [0x7e,0x00,0xbe,0xd4,0x01,0xf9,0x00,0x00]
+0x1a,0x00,0xbe,0xd4,0x01,0xf9,0x00,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_u32_e64 v1, m0 ; encoding: [0x7e,0x00,0xd6,0xd4,0x01,0xf9,0x00,0x00]
+0x1b,0x00,0xd6,0xd4,0x01,0xf9,0x00,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ge_u64_e64 exec, v[2:3] ; encoding: [0x7e,0x00,0xf6,0xd4,0x7e,0x04,0x02,0x00]
+0x1c,0x00,0xf6,0xd4,0x7e,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xdc,0xd4,0xf7,0x04,0x02,0x00]
+0x1d,0x00,0xdc,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x14,0xd4,0xf7,0x04,0x02,0x00]
+0x1e,0x00,0x14,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x34,0xd4,0xf7,0x04,0x02,0x00]
+0x1f,0x00,0x34,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x9c,0xd4,0xc1,0x04,0x02,0x00]
+0x20,0x00,0x9c,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x94,0xd4,0xc1,0x04,0x02,0x00]
+0x21,0x00,0x94,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb4,0xd4,0xc1,0x04,0x02,0x00]
+0x22,0x00,0xb4,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_u16_e64 s1, v2 ; encoding: [0x7e,0x00,0xbc,0xd4,0x01,0x04,0x02,0x00]
+0x23,0x00,0xbc,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd4,0xd4,0x01,0x04,0x02,0x00]
+0x24,0x00,0xd4,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_gt_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf4,0xd4,0x02,0x04,0x02,0x00]
+0x25,0x00,0xf4,0xd4,0x02,0x04,0x02,0x00
+
+### le
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xdb,0xd4,0xf7,0x04,0x02,0x00]
+0x26,0x00,0xdb,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x13,0xd4,0xf7,0x04,0x02,0x00]
+0x27,0x00,0x13,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x33,0xd4,0xf7,0x04,0x02,0x00]
+0x28,0x00,0x33,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x9b,0xd4,0xc1,0x04,0x02,0x00]
+0x29,0x00,0x9b,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x93,0xd4,0xc1,0x04,0x02,0x00]
+0x2a,0x00,0x93,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb3,0xd4,0xc1,0x04,0x02,0x00]
+0x2b,0x00,0xb3,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_u16_e64 s1, v2 ; encoding: [0x7e,0x00,0xbb,0xd4,0x01,0x04,0x02,0x00]
+0x2e,0x00,0xbb,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd3,0xd4,0x01,0x04,0x02,0x00]
+0x2f,0x00,0xd3,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_le_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf3,0xd4,0x02,0x04,0x02,0x00]
+0x30,0x00,0xf3,0xd4,0x02,0x04,0x02,0x00
+
+### lg
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lg_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xdd,0xd4,0xf7,0x04,0x02,0x00]
+0x31,0x00,0xdd,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lg_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x15,0xd4,0xf7,0x04,0x02,0x00]
+0x32,0x00,0x15,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lg_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x35,0xd4,0xf7,0x04,0x02,0x00]
+0x33,0x00,0x35,0xd4,0xf7,0x04,0x02,0x00
+
+### lt
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xd9,0xd4,0xf7,0x04,0x02,0x00]
+0x34,0x00,0xd9,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x11,0xd4,0xf7,0x04,0x02,0x00]
+0x35,0x00,0x11,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x31,0xd4,0xf7,0x04,0x02,0x00]
+0x36,0x00,0x31,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x99,0xd4,0xc1,0x04,0x02,0x00]
+0x37,0x00,0x99,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x91,0xd4,0xc1,0x04,0x02,0x00]
+0x38,0x00,0x91,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb1,0xd4,0xc1,0x04,0x02,0x00]
+0x39,0x00,0xb1,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_u16_e64 s1, v2 ; encoding: [0x7e,0x00,0xb9,0xd4,0x01,0x04,0x02,0x00]
+0x3a,0x00,0xb9,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd1,0xd4,0x01,0x04,0x02,0x00]
+0x3b,0x00,0xd1,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_lt_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf1,0xd4,0x02,0x04,0x02,0x00]
+0x3c,0x00,0xf1,0xd4,0x02,0x04,0x02,0x00
+
+### ne
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_i16_e64 -1, v2 ; encoding: [0x7e,0x00,0x9d,0xd4,0xc1,0x04,0x02,0x00]
+0x3d,0x00,0x9d,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x95,0xd4,0xc1,0x04,0x02,0x00]
+0x3e,0x00,0x95,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb5,0xd4,0xc1,0x04,0x02,0x00]
+0x3f,0x00,0xb5,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_u16_e64 s1, v2 ; encoding: [0x7e,0x00,0xbd,0xd4,0x01,0x04,0x02,0x00]
+0x40,0x00,0xbd,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd5,0xd4,0x01,0x04,0x02,0x00]
+0x41,0x00,0xd5,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ne_u64_e64 s[2:3], v[2:3] ; encoding: [0x7e,0x00,0xf5,0xd4,0x02,0x04,0x02,0x00]
+0x42,0x00,0xf5,0xd4,0x02,0x04,0x02,0x00
+
+### neq
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_neq_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xfd,0xd4,0xf7,0x04,0x02,0x00]
+0x43,0x00,0xfd,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_neq_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x1d,0xd4,0xf7,0x04,0x02,0x00]
+0x44,0x00,0x1d,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_neq_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x3d,0xd4,0xf7,0x04,0x02,0x00]
+0x45,0x00,0x3d,0xd4,0xf7,0x04,0x02,0x00
+
+### nge
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nge_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xf9,0xd4,0xf7,0x04,0x02,0x00]
+0x46,0x00,0xf9,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nge_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x19,0xd4,0xf7,0x04,0x02,0x00]
+0x47,0x00,0x19,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nge_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x39,0xd4,0xf7,0x04,0x02,0x00]
+0x48,0x00,0x39,0xd4,0xf7,0x04,0x02,0x00
+
+### ngt
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ngt_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xfb,0xd4,0xf7,0x04,0x02,0x00]
+0x49,0x00,0xfb,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ngt_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x1b,0xd4,0xf7,0x04,0x02,0x00]
+0x4a,0x00,0x1b,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_ngt_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x3b,0xd4,0xf7,0x04,0x02,0x00]
+0x4b,0x00,0x3b,0xd4,0xf7,0x04,0x02,0x00
+
+### nle
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nle_f16_e64 -1, v2 ; encoding: [0x7e,0x00,0xfc,0xd4,0xc1,0x04,0x02,0x00]
+0x4c,0x00,0xfc,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nle_f32_e64 -1, v2 ; encoding: [0x7e,0x00,0x1c,0xd4,0xc1,0x04,0x02,0x00]
+0x4d,0x00,0x1c,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nle_f64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0x3c,0xd4,0xc1,0x04,0x02,0x00]
+0x4e,0x00,0x3c,0xd4,0xc1,0x04,0x02,0x00
+
+### nlg
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlg_f16_e64 -1, v2 ; encoding: [0x7e,0x00,0xfa,0xd4,0xc1,0x04,0x02,0x00]
+0x4f,0x00,0xfa,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlg_f32_e64 -1, v2 ; encoding: [0x7e,0x00,0x1a,0xd4,0xc1,0x04,0x02,0x00]
+0x50,0x00,0x1a,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlg_f64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0x3a,0xd4,0xc1,0x04,0x02,0x00]
+0x51,0x00,0x3a,0xd4,0xc1,0x04,0x02,0x00
+
+### nlt
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlt_f16_e64 -1, v2 ; encoding: [0x7e,0x00,0xfe,0xd4,0xc1,0x04,0x02,0x00]
+0x52,0x00,0xfe,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlt_f32_e64 -1, v2 ; encoding: [0x7e,0x00,0x1e,0xd4,0xc1,0x04,0x02,0x00]
+0x53,0x00,0x1e,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_nlt_f64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0x3e,0xd4,0xc1,0x04,0x02,0x00]
+0x54,0x00,0x3e,0xd4,0xc1,0x04,0x02,0x00
+
+### o_f
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_o_f16_e64 -4.0, v2 ; encoding: [0x7e,0x00,0xdf,0xd4,0xf7,0x04,0x02,0x00]
+0x55,0x00,0xdf,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_o_f32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x17,0xd4,0xf7,0x04,0x02,0x00]
+0x56,0x00,0x17,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_o_f64_e64 -4.0, v[2:3] ; encoding: [0x7e,0x00,0x37,0xd4,0xf7,0x04,0x02,0x00]
+0x57,0x00,0x37,0xd4,0xf7,0x04,0x02,0x00
+
+### t_i
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_t_i32_e64 -1, v2 ; encoding: [0x7e,0x00,0x97,0xd4,0xc1,0x04,0x02,0x00]
+0x58,0x00,0x97,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_t_i32_e64 -4.0, v2 ; encoding: [0x7e,0x00,0x97,0xd4,0xf7,0x04,0x02,0x00]
+0x59,0x00,0x97,0xd4,0xf7,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_t_i64_e64 -1, v[2:3] ; encoding: [0x7e,0x00,0xb7,0xd4,0xc1,0x04,0x02,0x00]
+0x5a,0x00,0xb7,0xd4,0xc1,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: warning: invalid vdst encoding
+# v_cmpx_t_u32_e64 s1, v2 ; encoding: [0x7e,0x00,0xd7,0xd4,0x01,0x04,0x02,0x00]
+0x5b,0x00,0xd7,0xd4,0x01,0x04,0x02,0x00
+
+# GFX10: [[@LINE+2]]:1: w...
[truncated]
|
This is a different solution to the problem addressed by PR 127925. The base class is modified in order to support more specific warning msg. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
const std::string &getErrorOrWarningMsg() const { return ErrorOrWarningMsg; } | ||
void setErrorOrWarningMsg(const std::string &Msg) { ErrorOrWarningMsg = Msg; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this probably isn't the right strategy for improving diagnostics
PR [127925](PR #127925) has been merged upstream. Closing this one. |
For GFX10+ the destination reg of v_cmpx instructions and others is implicitly EXEC, which is encoded as 0x7E. However, the disassembler does not check this field, thus allowing any value. With this patch, if the field is not 0x7E a warning is issued.