Commit 85f7c2bc authored by Eugeny Aristov's avatar Eugeny Aristov Committed by Commit Bot

GCC: Use proper NEON interfaces and type cast

Unlike Clang GCC doesn't allow implicit conversions
between vectors which differ by size, type, sign
(lax-vector-conversions) by default. Hence introduced
usage of suitable interfaces which return values
corresponding to given types.

Bug: 819294
Change-Id: Iafcf53bc931d5c9ed1b03a79ffb5fbb75828a9f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2501341Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821365}
parent f3c54b3f
...@@ -22,7 +22,7 @@ static float32x4_t WrapVirtualIndexVector(float32x4_t x, ...@@ -22,7 +22,7 @@ static float32x4_t WrapVirtualIndexVector(float32x4_t x,
// vcltq_f32 returns returns all 0xfffffff (-1) if a < b and if if not. // vcltq_f32 returns returns all 0xfffffff (-1) if a < b and if if not.
const uint32x4_t cmp = vcltq_f32(r, vcvtq_f32_s32(f)); const uint32x4_t cmp = vcltq_f32(r, vcvtq_f32_s32(f));
f = vaddq_s32(f, static_cast<int32x4_t>(cmp)); f = vaddq_s32(f, vreinterpretq_s32_u32(cmp));
return vsubq_f32(x, vmulq_f32(vcvtq_f32_s32(f), wave_size)); return vsubq_f32(x, vmulq_f32(vcvtq_f32_s32(f), wave_size));
} }
...@@ -49,8 +49,8 @@ std::tuple<int, double> OscillatorHandler::ProcessKRateVector( ...@@ -49,8 +49,8 @@ std::tuple<int, double> OscillatorHandler::ProcessKRateVector(
const float32x4_t v_wave_size = vdupq_n_f32(periodic_wave_size); const float32x4_t v_wave_size = vdupq_n_f32(periodic_wave_size);
const float32x4_t v_inv_wave_size = vdupq_n_f32(1.0f / periodic_wave_size); const float32x4_t v_inv_wave_size = vdupq_n_f32(1.0f / periodic_wave_size);
const uint32x4_t v_read_mask = vdupq_n_s32(periodic_wave_size - 1); const uint32x4_t v_read_mask = vdupq_n_u32(periodic_wave_size - 1);
const uint32x4_t v_one = vdupq_n_s32(1); const uint32x4_t v_one = vdupq_n_u32(1);
const float32x4_t v_table_factor = vdupq_n_f32(table_interpolation_factor); const float32x4_t v_table_factor = vdupq_n_f32(table_interpolation_factor);
...@@ -187,7 +187,7 @@ double OscillatorHandler::ProcessARateVectorKernel( ...@@ -187,7 +187,7 @@ double OscillatorHandler::ProcessARateVectorKernel(
const uint32x4_t v_read0 = vcvtq_u32_f32(v_virt_index); const uint32x4_t v_read0 = vcvtq_u32_f32(v_virt_index);
// v_read1 = v_read0 + 1, but wrap the index around, if needed. // v_read1 = v_read0 + 1, but wrap the index around, if needed.
const uint32x4_t v_read1 = vandq_s32(vaddq_s32(v_read0, vdupq_n_u32(1)), const uint32x4_t v_read1 = vandq_u32(vaddq_u32(v_read0, vdupq_n_u32(1)),
vdupq_n_u32(read_index_mask)); vdupq_n_u32(read_index_mask));
float sample1_lower[4] __attribute__((aligned(16))); float sample1_lower[4] __attribute__((aligned(16)));
......
...@@ -332,7 +332,7 @@ void PeriodicWave::WaveDataForFundamentalFrequency( ...@@ -332,7 +332,7 @@ void PeriodicWave::WaveDataForFundamentalFrequency(
const uint32x4_t v_index1 = vcvtq_u32_f32(v_pitch_range); const uint32x4_t v_index1 = vcvtq_u32_f32(v_pitch_range);
uint32x4_t v_index2 = vaddq_u32(v_index1, vdupq_n_u32(1)); uint32x4_t v_index2 = vaddq_u32(v_index1, vdupq_n_u32(1));
v_index2 = vminq_u32(v_index2, vdupq_n_f32(NumberOfRanges() - 1)); v_index2 = vminq_u32(v_index2, vdupq_n_u32(NumberOfRanges() - 1));
uint32_t range_index1[4] __attribute__((aligned(16))); uint32_t range_index1[4] __attribute__((aligned(16)));
uint32_t range_index2[4] __attribute__((aligned(16))); uint32_t range_index2[4] __attribute__((aligned(16)));
......
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