OpenAL

Jakub Bogusz qboosh w pld-linux.org
Śro, 1 Mar 2006, 18:44:47 CET


On Sun, Feb 26, 2006 at 09:02:11PM +0100, Lukasz Glebicki wrote:
> On Sunday 26 February 2006 18:18, Paweł Sikora wrote:
> > > Ktoś ma jakiś pomysł?
> >
> > tak, nauczyć się zgłaszać błedy w kompilatorze do naszej bugziili.
> > hint: --save-temps, .i, użyte flagi.
> 
> Jak prosiłeś, podsyłam. Mam nadzieję, że jest to zgodne z 
> http://gcc.gnu.org/bugs.html#need

Plik x86_floatmul.i był źle wygenerowany - w szczególności bez kodu MMX
(zapewne między jakimiś #ifdefami).
Ten jest właściwy - faktycznie wykłada gcc 3.3.6 z dowolnym -O i -mmmx
(bez -mmmx się nie skompiluje).
Snapshot 4.1.0 to łyka, ale z ostrzeżeniami:

$ gcc -c x86_floatmul.i -O2 -march=athlon
In file included from arch/i386/x86_floatmul.c:26:
arch/i386/x86_simd_support_prk.h:30: warning: specifying vector types with __attribute__ ((mode)) is deprecated
arch/i386/x86_simd_support_prk.h:30: warning: use __attribute__ ((vector_size)) instead
arch/i386/x86_simd_support_prk.h:31: warning: specifying vector types with __attribute__ ((mode)) is deprecated
arch/i386/x86_simd_support_prk.h:31: warning: use __attribute__ ((vector_size)) instead


-- 
Jakub Bogusz    http://qboosh.cs.net.pl/
-------------- następna część ---------
# 1 "arch/i386/x86_floatmul.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "arch/i386/x86_floatmul.c"
# 21 "arch/i386/x86_floatmul.c"
# 1 "al_siteconfig.h" 1
# 11 "al_siteconfig.h"
# 1 "../config.h" 1
# 12 "al_siteconfig.h" 2
# 22 "arch/i386/x86_floatmul.c" 2

# 1 "../common/include/AL/al.h" 1
# 70 "../common/include/AL/al.h"
typedef char ALboolean;


typedef char ALchar;


typedef char ALbyte;


typedef unsigned char ALubyte;


typedef short ALshort;


typedef unsigned short ALushort;


typedef int ALint;


typedef unsigned int ALuint;


typedef int ALsizei;


typedef int ALenum;


typedef float ALfloat;


typedef double ALdouble;


typedef void ALvoid;
# 386 "../common/include/AL/al.h"
extern void alEnable( ALenum capability );

extern void alDisable( ALenum capability );

extern ALboolean alIsEnabled( ALenum capability );





extern const ALchar* alGetString( ALenum param );

extern void alGetBooleanv( ALenum param, ALboolean* data );

extern void alGetIntegerv( ALenum param, ALint* data );

extern void alGetFloatv( ALenum param, ALfloat* data );

extern void alGetDoublev( ALenum param, ALdouble* data );

extern ALboolean alGetBoolean( ALenum param );

extern ALint alGetInteger( ALenum param );

extern ALfloat alGetFloat( ALenum param );

extern ALdouble alGetDouble( ALenum param );






extern ALenum alGetError( void );







extern ALboolean alIsExtensionPresent( const ALchar* extname );

extern void* alGetProcAddress( const ALchar* fname );

extern ALenum alGetEnumValue( const ALchar* ename );
# 450 "../common/include/AL/al.h"
extern void alListenerf( ALenum param, ALfloat value );

extern void alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );

extern void alListenerfv( ALenum param, const ALfloat* values );

extern void alListeneri( ALenum param, ALint value );

extern void alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );

extern void alListeneriv( ALenum param, const ALint* values );




extern void alGetListenerf( ALenum param, ALfloat* value );

extern void alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );

extern void alGetListenerfv( ALenum param, ALfloat* values );

extern void alGetListeneri( ALenum param, ALint* value );

extern void alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );

extern void alGetListeneriv( ALenum param, ALint* values );
# 512 "../common/include/AL/al.h"
extern void alGenSources( ALsizei n, ALuint* sources );


extern void alDeleteSources( ALsizei n, const ALuint* sources );


extern ALboolean alIsSource( ALuint sid );




extern void alSourcef( ALuint sid, ALenum param, ALfloat value );

extern void alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );

extern void alSourcefv( ALuint sid, ALenum param, const ALfloat* values );

extern void alSourcei( ALuint sid, ALenum param, ALint value );

extern void alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );

extern void alSourceiv( ALuint sid, ALenum param, const ALint* values );




extern void alGetSourcef( ALuint sid, ALenum param, ALfloat* value );

extern void alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);

extern void alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );

extern void alGetSourcei( ALuint sid, ALenum param, ALint* value );

extern void alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);

extern void alGetSourceiv( ALuint sid, ALenum param, ALint* values );







extern void alSourcePlayv( ALsizei ns, const ALuint *sids );


extern void alSourceStopv( ALsizei ns, const ALuint *sids );


extern void alSourceRewindv( ALsizei ns, const ALuint *sids );


extern void alSourcePausev( ALsizei ns, const ALuint *sids );






extern void alSourcePlay( ALuint sid );


extern void alSourceStop( ALuint sid );


extern void alSourceRewind( ALuint sid );


extern void alSourcePause( ALuint sid );




extern void alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );

extern void alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
# 606 "../common/include/AL/al.h"
extern void alGenBuffers( ALsizei n, ALuint* buffers );


extern void alDeleteBuffers( ALsizei n, const ALuint* buffers );


extern ALboolean alIsBuffer( ALuint bid );


extern void alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );




extern void alBufferf( ALuint bid, ALenum param, ALfloat value );

extern void alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );

extern void alBufferfv( ALuint bid, ALenum param, const ALfloat* values );

extern void alBufferi( ALuint bid, ALenum param, ALint value );

extern void alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );

extern void alBufferiv( ALuint bid, ALenum param, const ALint* values );




extern void alGetBufferf( ALuint bid, ALenum param, ALfloat* value );

extern void alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);

extern void alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );

extern void alGetBufferi( ALuint bid, ALenum param, ALint* value );

extern void alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);

extern void alGetBufferiv( ALuint bid, ALenum param, ALint* values );





extern void alDopplerFactor( ALfloat value );

extern void alDopplerVelocity( ALfloat value );

extern void alSpeedOfSound( ALfloat value );

extern void alDistanceModel( ALenum distanceModel );




typedef void ( *LPALENABLE)( ALenum capability );
typedef void ( *LPALDISABLE)( ALenum capability );
typedef ALboolean ( *LPALISENABLED)( ALenum capability );
typedef const ALchar* ( *LPALGETSTRING)( ALenum param );
typedef void ( *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
typedef void ( *LPALGETINTEGERV)( ALenum param, ALint* data );
typedef void ( *LPALGETFLOATV)( ALenum param, ALfloat* data );
typedef void ( *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
typedef ALboolean ( *LPALGETBOOLEAN)( ALenum param );
typedef ALint ( *LPALGETINTEGER)( ALenum param );
typedef ALfloat ( *LPALGETFLOAT)( ALenum param );
typedef ALdouble ( *LPALGETDOUBLE)( ALenum param );
typedef ALenum ( *LPALGETERROR)( void );
typedef ALboolean ( *LPALISEXTENSIONPRESENT)(const ALchar* extname );
typedef void* ( *LPALGETPROCADDRESS)( const ALchar* fname );
typedef ALenum ( *LPALGETENUMVALUE)( const ALchar* ename );
typedef void ( *LPALLISTENERF)( ALenum param, ALfloat value );
typedef void ( *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void ( *LPALLISTENERFV)( ALenum param, const ALfloat* values );
typedef void ( *LPALLISTENERI)( ALenum param, ALint value );
typedef void ( *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void ( *LPALLISTENERIV)( ALenum param, const ALint* values );
typedef void ( *LPALGETLISTENERF)( ALenum param, ALfloat* value );
typedef void ( *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
typedef void ( *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
typedef void ( *LPALGETLISTENERI)( ALenum param, ALint* value );
typedef void ( *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
typedef void ( *LPALGETLISTENERIV)( ALenum param, ALint* values );
typedef void ( *LPALGENSOURCES)( ALsizei n, ALuint* sources );
typedef void ( *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
typedef ALboolean ( *LPALISSOURCE)( ALuint sid );
typedef void ( *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
typedef void ( *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void ( *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
typedef void ( *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
typedef void ( *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void ( *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
typedef void ( *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
typedef void ( *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void ( *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
typedef void ( *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
typedef void ( *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void ( *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
typedef void ( *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
typedef void ( *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
typedef void ( *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
typedef void ( *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
typedef void ( *LPALSOURCEPLAY)( ALuint sid );
typedef void ( *LPALSOURCESTOP)( ALuint sid );
typedef void ( *LPALSOURCEREWIND)( ALuint sid );
typedef void ( *LPALSOURCEPAUSE)( ALuint sid );
typedef void ( *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
typedef void ( *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
typedef void ( *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
typedef void ( *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
typedef ALboolean ( *LPALISBUFFER)( ALuint bid );
typedef void ( *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
typedef void ( *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
typedef void ( *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
typedef void ( *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
typedef void ( *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
typedef void ( *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
typedef void ( *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
typedef void ( *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
typedef void ( *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
typedef void ( *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
typedef void ( *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
typedef void ( *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
typedef void ( *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
typedef void ( *LPALDOPPLERFACTOR)( ALfloat value );
typedef void ( *LPALDOPPLERVELOCITY)( ALfloat value );
typedef void ( *LPALSPEEDOFSOUND)( ALfloat value );
typedef void ( *LPALDISTANCEMODEL)( ALenum distanceModel );
# 24 "arch/i386/x86_floatmul.c" 2
# 1 "al_cpu_caps.h" 1



void _alDetectCPUCaps(void);


# 1 "arch/i386/x86_cpu_caps_prk.h" 1
# 23 "arch/i386/x86_cpu_caps_prk.h"
struct x86cpu_caps_s {
        int mmx;
        int sse;
        int sse2;
        int sse3;
        int amd_3dnow;
        int amd_3dnowext;
        int amd_sse_mmx;
        int cyrix_mmxext;
};

extern struct x86cpu_caps_s x86cpu_caps;
extern struct x86cpu_caps_s x86cpu_caps_use;

static __inline int _alHaveMMX(void);
static __inline int _alHaveSSE(void);
static __inline int _alHaveSSE2(void);
static __inline int _alHaveSSE3(void);
static __inline int _alHave3DNOW(void);
static __inline int _alHave3DNOWEXT(void);
static __inline int _alHaveSSEMMX(void);


static __inline int _alHaveMMX(void)
{
        return x86cpu_caps.mmx & x86cpu_caps_use.mmx;
}

static __inline int _alHaveSSE(void)
{
        return x86cpu_caps.sse & x86cpu_caps_use.sse;
}

static __inline int _alHaveSSE2(void)
{
        return x86cpu_caps.sse2 & x86cpu_caps_use.sse2;
}

static __inline int _alHaveSSE3(void)
{
        return x86cpu_caps.sse3 & x86cpu_caps_use.sse3;
}

static __inline int _alHave3DNOW(void)
{
        return x86cpu_caps.amd_3dnow & x86cpu_caps_use.amd_3dnow;
}

static __inline int _alHave3DNOWEXT(void)
{
        return x86cpu_caps.amd_3dnowext & x86cpu_caps_use.amd_3dnowext;
}

static __inline int _alHaveSSEMMX(void)
{
        return x86cpu_caps.amd_sse_mmx & x86cpu_caps_use.amd_sse_mmx;
}
# 8 "al_cpu_caps.h" 2
# 25 "arch/i386/x86_floatmul.c" 2
# 1 "arch/i386/x86_simd_support_prk.h" 1
# 30 "arch/i386/x86_simd_support_prk.h"
typedef short v4hi __attribute__ ((__mode__(__V4HI__)));
typedef int v2si __attribute__ ((__mode__(__V2SI__)));
typedef int di __attribute__ ((__mode__(__DI__)));







typedef unsigned long aint;
# 26 "arch/i386/x86_floatmul.c" 2





void _alFloatMul(ALshort *bpt, ALfloat sa, ALuint len);

void _alFloatMul(ALshort *bpt, ALfloat sa, ALuint len) {
        ALint scaled_sa = sa * (1 << 16);
        ALint iter;


        if (_alHaveMMX()) {
                union {
                        short s[4];
                        v4hi v;
                } v_sa __attribute__((aligned(16)));
                ALuint samples_main;
                ALuint samples_pre;
                ALuint samples_post;
                v4hi temp;


                samples_pre = 8 - (aint)bpt % 8;
                samples_pre /= sizeof(ALshort);
                samples_main = len - samples_pre;
                samples_post = samples_main % 8;
                samples_main = samples_main / 8;
                len = samples_post;

                while(samples_pre--) {
                        iter = *bpt;
                        iter *= scaled_sa;
                        iter >>= 16;
                        *bpt = iter;
                        ++bpt;
                }

                if (scaled_sa < (1 << 15)) {

                        v_sa.s[0] = scaled_sa;
                        v_sa.s[1] = v_sa.s[0];
                        v_sa.s[2] = scaled_sa;
                        v_sa.s[3] = v_sa.s[0];

                        while (samples_main--) {
                                *(v4hi*)bpt = __builtin_ia32_pmulhw(*(v4hi*)bpt, v_sa.v);
                                bpt += 4;
                                *(v4hi*)bpt = __builtin_ia32_pmulhw(*(v4hi*)bpt, v_sa.v);
                                bpt += 4;
                        }
                } else {

                        v_sa.s[0] = scaled_sa >> 1;
                        v_sa.s[1] = v_sa.s[0];
                        v_sa.s[2] = v_sa.s[0];
                        v_sa.s[3] = v_sa.s[0];

                        while (samples_main--) {
                                temp = __builtin_ia32_pmulhw(*(v4hi*)bpt, v_sa.v);
                                *(v4hi*)bpt = __builtin_ia32_psllw(temp, 1LL);
                                bpt += 4;
                                temp = __builtin_ia32_pmulhw(*(v4hi*)bpt, v_sa.v);
                                *(v4hi*)bpt = __builtin_ia32_psllw(temp, 1LL);
                                bpt += 4;
                        }
                }
                __builtin_ia32_emms();
        }


        while(len--) {
                iter = *bpt;
                iter *= scaled_sa;
                iter >>= 16;
                *bpt = iter;
                ++bpt;
        }
}


Więcej informacji o liście dyskusyjnej pld-devel-pl