diff options
author | Chris Robinson <[email protected]> | 2018-11-17 17:32:32 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-17 17:35:52 -0800 |
commit | 2d4ff77410d4fe647950c4e06dbe1c5536235796 (patch) | |
tree | 94a6ac1114d2c35222c752c400778192e9254d18 /Alc/mixer | |
parent | e5442db803b5ecac2bbbe45073e01de32431c0a5 (diff) |
Remove ASSUME_ALIGNED
It's become a liability with C++ since it returns void* instead of the input
pointer type, and it doesn't seem to help optimizations anyway (auto-
vectorization still produces unaligned loads and stores).
Diffstat (limited to 'Alc/mixer')
-rw-r--r-- | Alc/mixer/hrtf_inc.c | 6 | ||||
-rw-r--r-- | Alc/mixer/mixer_c.c | 8 | ||||
-rw-r--r-- | Alc/mixer/mixer_neon.c | 13 | ||||
-rw-r--r-- | Alc/mixer/mixer_sse.c | 10 |
4 files changed, 16 insertions, 21 deletions
diff --git a/Alc/mixer/hrtf_inc.c b/Alc/mixer/hrtf_inc.c index 21840abd..1f70242d 100644 --- a/Alc/mixer/hrtf_inc.c +++ b/Alc/mixer/hrtf_inc.c @@ -20,7 +20,7 @@ void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate, ALsizei BufferSize) { - const ALfloat (*Coeffs)[2] = ASSUME_ALIGNED(hrtfparams->Coeffs, 16); + const ALfloat (*Coeffs)[2] = hrtfparams->Coeffs; const ALsizei Delay[2] = { hrtfparams->Delay[0], hrtfparams->Delay[1] }; const ALfloat gainstep = hrtfparams->GainStep; const ALfloat gain = hrtfparams->Gain; @@ -60,11 +60,11 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, MixHrtfParams *newparams, HrtfState *hrtfstate, ALsizei BufferSize) { - const ALfloat (*OldCoeffs)[2] = ASSUME_ALIGNED(oldparams->Coeffs, 16); + const ALfloat (*OldCoeffs)[2] = oldparams->Coeffs; const ALsizei OldDelay[2] = { oldparams->Delay[0], oldparams->Delay[1] }; const ALfloat oldGain = oldparams->Gain; const ALfloat oldGainStep = -oldGain / (ALfloat)BufferSize; - const ALfloat (*NewCoeffs)[2] = ASSUME_ALIGNED(newparams->Coeffs, 16); + const ALfloat (*NewCoeffs)[2] = newparams->Coeffs; const ALsizei NewDelay[2] = { newparams->Delay[0], newparams->Delay[1] }; const ALfloat newGain = newparams->Gain; const ALfloat newGainStep = newparams->GainStep; diff --git a/Alc/mixer/mixer_c.c b/Alc/mixer/mixer_c.c index ea864dbc..dce6daec 100644 --- a/Alc/mixer/mixer_c.c +++ b/Alc/mixer/mixer_c.c @@ -29,10 +29,10 @@ static inline ALfloat do_bsinc(const InterpState *state, const ALfloat *RESTRICT pf = (frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF)); #undef FRAC_PHASE_BITDIFF - fil = ASSUME_ALIGNED(state->bsinc.filter + state->bsinc.m*pi*4, 16); - scd = ASSUME_ALIGNED(fil + state->bsinc.m, 16); - phd = ASSUME_ALIGNED(scd + state->bsinc.m, 16); - spd = ASSUME_ALIGNED(phd + state->bsinc.m, 16); + fil = state->bsinc.filter + state->bsinc.m*pi*4; + scd = fil + state->bsinc.m; + phd = scd + state->bsinc.m; + spd = phd + state->bsinc.m; // Apply the scale and phase interpolated filter. r = 0.0f; diff --git a/Alc/mixer/mixer_neon.c b/Alc/mixer/mixer_neon.c index a035abc7..9bc76987 100644 --- a/Alc/mixer/mixer_neon.c +++ b/Alc/mixer/mixer_neon.c @@ -91,10 +91,10 @@ const ALfloat *Resample_bsinc_Neon(const InterpState *state, #undef FRAC_PHASE_BITDIFF offset = m*pi*4; - fil = ASSUME_ALIGNED(filter + offset, 16); offset += m; - scd = ASSUME_ALIGNED(filter + offset, 16); offset += m; - phd = ASSUME_ALIGNED(filter + offset, 16); offset += m; - spd = ASSUME_ALIGNED(filter + offset, 16); + fil = (const float32x4_t*)(filter + offset); offset += m; + scd = (const float32x4_t*)(filter + offset); offset += m; + phd = (const float32x4_t*)(filter + offset); offset += m; + spd = (const float32x4_t*)(filter + offset); // Apply the scale and phase interpolated filter. r4 = vdupq_n_f32(0.0f); @@ -140,8 +140,7 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2], leftright2 = vset_lane_f32(right, leftright2, 1); leftright4 = vcombine_f32(leftright2, leftright2); } - Values = ASSUME_ALIGNED(Values, 16); - Coeffs = ASSUME_ALIGNED(Coeffs, 16); + for(c = 0;c < IrSize;c += 2) { const ALsizei o0 = (Offset+c)&HRIR_MASK; @@ -172,8 +171,6 @@ void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffe ASSUME(OutChans > 0); ASSUME(BufferSize > 0); - data = ASSUME_ALIGNED(data, 16); - OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); for(c = 0;c < OutChans;c++) { diff --git a/Alc/mixer/mixer_sse.c b/Alc/mixer/mixer_sse.c index 34055001..d9ad2ed3 100644 --- a/Alc/mixer/mixer_sse.c +++ b/Alc/mixer/mixer_sse.c @@ -37,10 +37,10 @@ const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *RESTR #undef FRAC_PHASE_BITDIFF offset = m*pi*4; - fil = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; - scd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; - phd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; - spd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); + fil = (const __m128*)(filter + offset); offset += m; + scd = (const __m128*)(filter + offset); offset += m; + phd = (const __m128*)(filter + offset); offset += m; + spd = (const __m128*)(filter + offset); // Apply the scale and phase interpolated filter. r4 = _mm_setzero_ps(); @@ -85,8 +85,6 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2], __m128 coeffs; ALsizei i; - Values = ASSUME_ALIGNED(Values, 16); - Coeffs = ASSUME_ALIGNED(Coeffs, 16); if((Offset&1)) { const ALsizei o0 = Offset&HRIR_MASK; |