Commit 4ac8f985 authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by Commit Bot

GCC: fix SSE implicit type conversion errors in web audio

Clang SSE intrinsics do not complain on implicit conversions among
several of the types (i.e. from __m128i to __ m128). But GCC
intrinsics do. So use reinterpret_cast to make them explicit.

Bug: 819294
Change-Id: I7df583459ad17ecfcf161a808d86e949afd4fd05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303716Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/master@{#789498}
parent 9d5cf1fb
......@@ -154,9 +154,9 @@ std::tuple<int, double> OscillatorHandler::ProcessKRateVector(
return std::make_tuple(k, virtual_read_index);
}
static __m128 WrapVirtualIndexVectorPd(__m128d x,
__m128d wave_size,
__m128d inv_wave_size) {
static __m128d WrapVirtualIndexVectorPd(__m128d x,
__m128d wave_size,
__m128d inv_wave_size) {
// Wrap the virtual index |x| to the range 0 to wave_size - 1. This is done
// by computing x - floor(x/wave_size)*wave_size.
//
......@@ -174,7 +174,7 @@ static __m128 WrapVirtualIndexVectorPd(__m128d x,
// cmplt(a,b) returns 0xffffffffffffffff (-1) if a < b and 0 if not. So cmp
// is -1 or 0 depending on whether r < f, which is what we need to compute
// floor(r).
__m128d cmp = _mm_cmplt_pd(r, _mm_cvtepi32_pd(f));
__m128i cmp = reinterpret_cast<__m128i>(_mm_cmplt_pd(r, _mm_cvtepi32_pd(f)));
// Take the low 32 bits of each 64-bit result and move them into the two
// lowest 32-bit fields.
......@@ -226,8 +226,9 @@ double OscillatorHandler::ProcessARateVectorKernel(
// Convert the virtual read index (parts) to an integer, and carefully
// merge them into one vector.
const __m128i v_read0 = _mm_movelh_ps(_mm_cvttpd_epi32(v_read_index_lo),
_mm_cvttpd_epi32(v_read_index_hi));
const __m128i v_read0 = reinterpret_cast<__m128i>(_mm_movelh_ps(
reinterpret_cast<__m128>(_mm_cvttpd_epi32(v_read_index_lo)),
reinterpret_cast<__m128>(_mm_cvttpd_epi32(v_read_index_hi))));
// Get index to next element being sure to wrap the index around if needed.
const __m128i v_read1 =
......
......@@ -208,11 +208,12 @@ void PeriodicWave::WaveDataForFundamentalFrequency(
// Negative frequencies are allowed, in which case we alias to the positive
// frequency. SSE2 doesn't have an fabs instruction, so just remove the sign
// bit of the float numbers, effecitvely taking the absolute value.
const __m128 frequency = _mm_and_ps(_mm_loadu_ps(fundamental_frequency),
_mm_set1_epi32(0x7fffffff));
const __m128 frequency =
_mm_and_ps(_mm_loadu_ps(fundamental_frequency),
reinterpret_cast<__m128>(_mm_set1_epi32(0x7fffffff)));
// pos = 0xffffffff if freq > 0; otherwise 0
const __m128i pos = _mm_cmpgt_ps(frequency, _mm_set1_ps(0));
const __m128 pos = _mm_cmpgt_ps(frequency, _mm_set1_ps(0));
// Calculate the pitch range.
__m128 v_ratio =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment