Upstream instruction fixes: 64-bit literals, exact normalized ends, flat offsets, rare forms
Ports of 7d04943 (a signed 64-bit operand sign-extends its literal), 645391b (a normalized buffer format's ends load as exactly 1.0 and -1.0), 40f30be (FLAT offsets ignore bit 11), 3d71ad1, 344704e, 5d6889e, 78c1267, c3a04e2, e3fe5bf and the tests 259ba31, 8610ffb, 41b2472, 45ed8e3, 8d67fa5. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
25f78a079c
commit
a780306f4c
5 files changed
+529
-14
No files matched your search
@@ -235,19 +235,32 @@ impl Instruction {
|
||||
}
|
||||
Encoding::Sopp => Fields::Sopp { imm: w0 as u16 },
|
||||
Encoding::Smem => {
|
||||
let data = match name {
|
||||
"s_gl1_inv" | "s_dcache_inv" | "s_dcache_wb" => None,
|
||||
n if n.starts_with("s_dcache_discard") => None,
|
||||
"s_memtime" | "s_memrealtime" => Some(2),
|
||||
_ => Some(data_dwords(name)),
|
||||
let sdata = (w0 >> 6 & 0x7F) as u8;
|
||||
// s_atc_probe*: SDATA is a 7-bit immediate, not an SGPR. The
|
||||
// buffer form's resource is 4 dwords. GLC and DLC are not operands.
|
||||
let probe = matches!(name, "s_atc_probe" | "s_atc_probe_buffer");
|
||||
let data = if probe {
|
||||
Some(Operand::Literal(u32::from(sdata)))
|
||||
} else {
|
||||
match name {
|
||||
"s_gl1_inv" | "s_dcache_inv" | "s_dcache_wb" => None,
|
||||
n if n.starts_with("s_dcache_discard") => None,
|
||||
"s_memtime" | "s_memrealtime" => Some(scalar(sdata, 2)),
|
||||
_ => Some(scalar(sdata, data_dwords(name))),
|
||||
}
|
||||
};
|
||||
let base = 2 + 2 * u8::from(name.starts_with("s_buffer_"));
|
||||
let base =
|
||||
2 + 2 * u8::from(name.starts_with("s_buffer_") || name == "s_atc_probe_buffer");
|
||||
Fields::Smem {
|
||||
data: data.map(|d| scalar((w0 >> 6 & 0x7F) as u8, d)),
|
||||
data,
|
||||
base: scalar(((w0 & 0x3F) << 1) as u8, base),
|
||||
offset: (w1 << 11) as i32 >> 11,
|
||||
soffset: scalar((w1 >> 25) as u8, 1),
|
||||
cache: cache(bit(w0, 16), false, bit(w0, 14)),
|
||||
cache: if probe {
|
||||
Cache::default()
|
||||
} else {
|
||||
cache(bit(w0, 16), false, bit(w0, 14))
|
||||
},
|
||||
}
|
||||
}
|
||||
Encoding::Vop1 | Encoding::Vop2 | Encoding::Vopc | Encoding::Vop3 | Encoding::Vop3p => {
|
||||
@@ -405,6 +418,8 @@ impl Instruction {
|
||||
saddr: (self.encoding != Encoding::Flat)
|
||||
.then(|| scalar(saddr, 1 + u8::from(self.encoding == Encoding::Global))),
|
||||
offset: match self.encoding {
|
||||
// GFX10 FLAT offsets are 11-bit and unsigned: the
|
||||
// hardware ignores bit 11.
|
||||
Encoding::Flat => (w0 & 0x7FF) as i16,
|
||||
_ => ((w0 << 4) as i16) >> 4,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user