Merge pull request #765 from khasinski/fix/f32-source-modifiers-bits

fix(shader): apply f32 abs and neg source modifiers on the sign bit
This commit is contained in:
Dean
2026-10-06 15:12:53 +13:00
committed by GitHub
@@ -151,22 +151,15 @@ IrValue* TranslationContext::readOperand(const RdnaOperand& operand, IrType type
return &ir.ConstructU64(pair[0].Value(), pair[1].Value());
}
IrU32 bits = applyBitSourceModifiers(operand, readRawU32(operand));
if (TypesOverlap(type, IrType::F32) && !TypesOverlap(type, IrType::U32)) {
IrF32 value(ir.BitCastF32(bits.Value()));
if (operand.absolute) {
value = IrF32(ir.Emit(IrOpcode::FPAbs32, IrType::F32, {&value.Value()}));
}
if (operand.negate) {
value = IrF32(ir.Emit(IrOpcode::FPNeg32, IrType::F32, {&value.Value()}));
}
return &value.Value();
}
if (operand.absolute) {
bits = IrU32(ir.BitwiseAnd(bits.Value(), ir.Constant(0x7fffffffu)));
}
if (operand.negate) {
bits = IrU32(ir.BitwiseXor(bits.Value(), ir.Constant(0x80000000u)));
}
if (TypesOverlap(type, IrType::F32) && !TypesOverlap(type, IrType::U32)) {
return &ir.BitCastF32(bits.Value());
}
if (!TypesOverlap(type, IrType::U32)) {
throw std::runtime_error("TranslationContext::readOperand requested unsupported operand type");
}