soft-fp64/fadd: Massively split the live range of zFrac0 and zFrac1
The main purpose of this commit is to prepare for "soft-fp64/fadd: Move common code out of both branches of an if-statement". Results on the 308 shaders extracted from the fp64 portion of the OpenGL CTS: Tiger Lake and Ice Lake had similar results. (Tiger Lake shown) total instructions in shared programs: 822766 -> 817327 (-0.66%) instructions in affected programs: 760943 -> 755504 (-0.71%) helped: 74 HURT: 0 helped stats (abs) min: 8 max: 515 x̄: 73.50 x̃: 51 helped stats (rel) min: 0.58% max: 1.10% x̄: 0.77% x̃: 0.73% 95% mean confidence interval for instructions value: -91.17 -55.83 95% mean confidence interval for instructions %-change: -0.81% -0.74% Instructions are helped. total cycles in shared programs: 6816791 -> 6822826 (0.09%) cycles in affected programs: 6384809 -> 6390844 (0.09%) helped: 0 HURT: 74 HURT stats (abs) min: 6 max: 1179 x̄: 81.55 x̃: 50 HURT stats (rel) min: 0.02% max: 0.17% x̄: 0.09% x̃: 0.09% 95% mean confidence interval for cycles value: 48.99 114.12 95% mean confidence interval for cycles %-change: 0.09% 0.10% Cycles are HURT. Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>
This commit is contained in:
@@ -676,11 +676,11 @@ __fadd64(uint64_t a, uint64_t b)
|
|||||||
uint bFracHi = __extractFloat64FracHi(b);
|
uint bFracHi = __extractFloat64FracHi(b);
|
||||||
int aExp = __extractFloat64Exp(a);
|
int aExp = __extractFloat64Exp(a);
|
||||||
int bExp = __extractFloat64Exp(b);
|
int bExp = __extractFloat64Exp(b);
|
||||||
uint zFrac0 = 0u;
|
|
||||||
uint zFrac1 = 0u;
|
|
||||||
int expDiff = aExp - bExp;
|
int expDiff = aExp - bExp;
|
||||||
if (aSign == bSign) {
|
if (aSign == bSign) {
|
||||||
uint zFrac2 = 0u;
|
uint zFrac0;
|
||||||
|
uint zFrac1;
|
||||||
|
uint zFrac2;
|
||||||
int zExp;
|
int zExp;
|
||||||
bool orig_exp_diff_is_zero = (expDiff == 0);
|
bool orig_exp_diff_is_zero = (expDiff == 0);
|
||||||
|
|
||||||
@@ -736,6 +736,9 @@ __fadd64(uint64_t a, uint64_t b)
|
|||||||
__shortShift64Left(aFracHi, aFracLo, 10, aFracHi, aFracLo);
|
__shortShift64Left(aFracHi, aFracLo, 10, aFracHi, aFracLo);
|
||||||
__shortShift64Left(bFracHi, bFracLo, 10, bFracHi, bFracLo);
|
__shortShift64Left(bFracHi, bFracLo, 10, bFracHi, bFracLo);
|
||||||
if (0 < expDiff) {
|
if (0 < expDiff) {
|
||||||
|
uint zFrac0;
|
||||||
|
uint zFrac1;
|
||||||
|
|
||||||
if (aExp == 0x7FF) {
|
if (aExp == 0x7FF) {
|
||||||
bool propagate = (aFracHi | aFracLo) != 0u;
|
bool propagate = (aFracHi | aFracLo) != 0u;
|
||||||
return mix(a, __propagateFloat64NaN(a, b), propagate);
|
return mix(a, __propagateFloat64NaN(a, b), propagate);
|
||||||
@@ -750,6 +753,9 @@ __fadd64(uint64_t a, uint64_t b)
|
|||||||
return __normalizeRoundAndPackFloat64(aSign, zExp - 10, zFrac0, zFrac1);
|
return __normalizeRoundAndPackFloat64(aSign, zExp - 10, zFrac0, zFrac1);
|
||||||
}
|
}
|
||||||
if (expDiff < 0) {
|
if (expDiff < 0) {
|
||||||
|
uint zFrac0;
|
||||||
|
uint zFrac1;
|
||||||
|
|
||||||
if (bExp == 0x7FF) {
|
if (bExp == 0x7FF) {
|
||||||
bool propagate = (bFracHi | bFracLo) != 0u;
|
bool propagate = (bFracHi | bFracLo) != 0u;
|
||||||
return mix(__packFloat64(aSign ^ 0x80000000u, 0x7ff, 0u, 0u), __propagateFloat64NaN(a, b), propagate);
|
return mix(__packFloat64(aSign ^ 0x80000000u, 0x7ff, 0u, 0u), __propagateFloat64NaN(a, b), propagate);
|
||||||
@@ -770,6 +776,9 @@ __fadd64(uint64_t a, uint64_t b)
|
|||||||
}
|
}
|
||||||
bExp = mix(bExp, 1, aExp == 0);
|
bExp = mix(bExp, 1, aExp == 0);
|
||||||
aExp = mix(aExp, 1, aExp == 0);
|
aExp = mix(aExp, 1, aExp == 0);
|
||||||
|
|
||||||
|
uint zFrac0 = 0;
|
||||||
|
uint zFrac1 = 0;
|
||||||
bool zexp_normal = false;
|
bool zexp_normal = false;
|
||||||
uint sign_of_difference = 0;
|
uint sign_of_difference = 0;
|
||||||
if (bFracHi < aFracHi) {
|
if (bFracHi < aFracHi) {
|
||||||
|
Reference in New Issue
Block a user