graphics: sign-extend vector bitfield extracts

This commit is contained in:
nmzik
2026-08-16 14:22:57 +02:00
parent 4e343408dc
commit 93398d6d0f
2 changed files with 20 additions and 20 deletions
@@ -548,12 +548,10 @@ bool Translator::TranslateExtendedInteger(const IR::Instruction& inst) {
const auto count =
IR::U32(ir.Emit(IR::ValueOpcode::UMin32,
{mask(ReadU32(inst.src[2]), 31u), ir.ISub(imm(32), offset)}));
if (inst.op == IR::Opcode::BitFieldExtract3I32) {
result =
ir.BitwiseAnd(ir.ShiftRightArithmetic(source, offset), right_mask32(count));
} else {
result = ir.Emit(IR::ValueOpcode::BitFieldUExtract, {source, offset, count});
}
const auto opcode = inst.op == IR::Opcode::BitFieldExtract3I32
? IR::ValueOpcode::BitFieldSExtract
: IR::ValueOpcode::BitFieldUExtract;
result = ir.Emit(opcode, {source, offset, count});
break;
}
case IR::Opcode::BitFieldInsertSelectU32: {