shader: drop BFM mask bits shifted past bit 31 instead of an out-of-range bit-field insert

This commit is contained in:
nmzik
2026-10-21 22:59:56 +02:00
parent 2862ad5b25
commit fa32940d14
2 changed files with 28 additions and 3 deletions
@@ -380,9 +380,8 @@ void Translator::S_QUADMASK_B64(const Decoder::Instruction& inst) {
void Translator::BFM_B32(const Decoder::Instruction& inst) {
const auto count = ir.BitwiseAnd(ReadU32(inst.src0), IR::U32(IR::Value(31u)));
const auto offset = ir.BitwiseAnd(ReadU32(inst.src1), IR::U32(IR::Value(31u)));
const auto result = ir.Emit(IR::ValueOpcode::BitFieldInsert,
{IR::Value(0u), IR::Value(0xffffffffu), offset, count});
WriteOperand(DestinationOperand(inst), result);
// Mask bits shifted past bit 31 are dropped.
WriteOperand(DestinationOperand(inst), ir.ShiftLeftLogical(RightMask32(count), offset));
}
IR::U32 Translator::RightMask32(IR::U32 count) {