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).
This commit is contained in:
@@ -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;
|
||||
|
||||
+4
-4
@@ -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;
|
||||
|
||||
@@ -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++)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -445,19 +445,6 @@ ELSE()
|
||||
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
int main()
|
||||
{
|
||||
float *ptr;
|
||||
ptr = __builtin_assume_aligned(ptr, 16);
|
||||
return 0;
|
||||
}" HAVE___BUILTIN_ASSUME_ALIGNED)
|
||||
IF(HAVE___BUILTIN_ASSUME_ALIGNED)
|
||||
SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)")
|
||||
ELSE()
|
||||
SET(ASSUME_ALIGNED_DECL "(x)")
|
||||
ENDIF()
|
||||
|
||||
SET(SSE_SWITCH "")
|
||||
SET(SSE2_SWITCH "")
|
||||
SET(SSE3_SWITCH "")
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
/* Define any available alignment declaration */
|
||||
#define ALIGN(x) ${ALIGN_DECL}
|
||||
|
||||
/* Define a built-in call indicating an aligned data pointer */
|
||||
#define ASSUME_ALIGNED(x, y) ${ASSUME_ALIGNED_DECL}
|
||||
|
||||
/* Define a restrict macro for non-aliased pointers */
|
||||
#define RESTRICT ${RESTRICT_DECL}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user