Bug 1915813 - Fix a crash with Microsoft TTD. a=diannaS

Microsoft TTD has a CPU emulation bug that makes Firefox crash when ran
under TTD. This patch mitigates the issue.

Original Revision: https://phabricator.services.mozilla.com/D220829

Differential Revision: https://phabricator.services.mozilla.com/D221937
This commit is contained in:
Yannis Juglaret 2024-09-12 17:30:11 +00:00
parent d402bf3638
commit fdb6c30571
2 changed files with 5 additions and 5 deletions

View File

@ -118,7 +118,7 @@ unsafe extern "C" fn qcms_transform_data_template_lut_avx<F: Format>(
}
/* crunch, crunch, crunch */
vec_r = _mm256_add_ps(vec_r, _mm256_add_ps(vec_g, vec_b));
vec_r = _mm256_max_ps(min, vec_r);
vec_r = _mm256_max_ps(vec_r, min);
vec_r = _mm256_min_ps(max, vec_r);
result = _mm256_mul_ps(vec_r, scale);
/* store calc'd output tables indices */
@ -160,7 +160,7 @@ unsafe extern "C" fn qcms_transform_data_template_lut_avx<F: Format>(
*dest.add(F::kAIndex + components as usize) = alpha2
}
vec_r = _mm256_add_ps(vec_r, _mm256_add_ps(vec_g, vec_b));
vec_r = _mm256_max_ps(min, vec_r);
vec_r = _mm256_max_ps(vec_r, min);
vec_r = _mm256_min_ps(max, vec_r);
result = _mm256_mul_ps(vec_r, scale);
_mm256_store_si256(output as *mut __m256i, _mm256_cvtps_epi32(result));
@ -189,7 +189,7 @@ unsafe extern "C" fn qcms_transform_data_template_lut_avx<F: Format>(
*dest.add(F::kAIndex) = *src.add(F::kAIndex)
}
vec_r0 = _mm_add_ps(vec_r0, _mm_add_ps(vec_g0, vec_b0));
vec_r0 = _mm_max_ps(_mm256_castps256_ps128(min), vec_r0);
vec_r0 = _mm_max_ps(vec_r0, _mm256_castps256_ps128(min));
vec_r0 = _mm_min_ps(_mm256_castps256_ps128(max), vec_r0);
vec_r0 = _mm_mul_ps(vec_r0, _mm256_castps256_ps128(scale));
_mm_store_si128(output as *mut __m128i, _mm_cvtps_epi32(vec_r0));

View File

@ -93,7 +93,7 @@ unsafe extern "C" fn qcms_transform_data_template_lut_sse2<F: Format>(
}
/* crunch, crunch, crunch */
vec_r = _mm_add_ps(vec_r, _mm_add_ps(vec_g, vec_b));
vec_r = _mm_max_ps(min, vec_r);
vec_r = _mm_max_ps(vec_r, min);
vec_r = _mm_min_ps(max, vec_r);
result = _mm_mul_ps(vec_r, scale);
/* store calc'd output tables indices */
@ -121,7 +121,7 @@ unsafe extern "C" fn qcms_transform_data_template_lut_sse2<F: Format>(
*dest.add(F::kAIndex) = alpha
}
vec_r = _mm_add_ps(vec_r, _mm_add_ps(vec_g, vec_b));
vec_r = _mm_max_ps(min, vec_r);
vec_r = _mm_max_ps(vec_r, min);
vec_r = _mm_min_ps(max, vec_r);
result = _mm_mul_ps(vec_r, scale);
_mm_store_si128(output as *mut __m128i, _mm_cvtps_epi32(result));