[DXBC] Fast mul path only for fully identical components because neg is post-abs

This commit is contained in:
Triang3l
2020-10-30 22:31:30 +03:00
parent feb8258a5e
commit ae3b68c7b6
2 changed files with 16 additions and 27 deletions

View File

@@ -212,19 +212,18 @@ struct InstructionOperand {
return false;
}
// Returns which components of two operands are identical, so that
// multiplication of them would result in pow2 with + sign, including in case
// they're zero (because -0 * |-0|, or -0 * +0, is -0), for providing a fast
// path in emulation of the Shader Model 3 +-0 * x = +0 multiplication
// behavior (disregarding component_count for simplicity of usage with
// GetComponent, treating the rightmost component as replicated).
uint32_t GetIdenticalMultiplicandComponents(
const InstructionOperand& other) const {
// Returns which components of two operands will always be bitwise equal
// (disregarding component_count for simplicity of usage with GetComponent,
// treating the rightmost component as replicated). This, strictly with all
// conditions, must be used when emulating Shader Model 3 +-0 * x = +0
// multiplication behavior with IEEE-compliant multiplication (because
// -0 * |-0|, or -0 * +0, is -0, while the result must be +0).
uint32_t GetIdenticalComponents(const InstructionOperand& other) const {
if (storage_source != other.storage_source ||
storage_index != other.storage_index ||
storage_addressing_mode != other.storage_addressing_mode ||
is_absolute_value != other.is_absolute_value ||
(!is_absolute_value && is_negated != other.is_negated)) {
is_negated != other.is_negated ||
is_absolute_value != other.is_absolute_value) {
return 0;
}
uint32_t identical_components = 0;
@@ -234,15 +233,6 @@ struct InstructionOperand {
}
return identical_components;
}
// Returns which components of two operands will always be bitwise equal
// (disregarding component_count for simplicity of usage with GetComponent,
// treating the rightmost component as replicated).
uint32_t GetIdenticalComponents(const InstructionOperand& other) const {
if (is_negated != other.is_negated) {
return 0;
}
return GetIdenticalMultiplicandComponents(other);
}
};
struct ParsedExecInstruction {