From 382431ebcbe74507dce74f75f9d933835d849a46 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Thu, 19 Mar 2009 11:11:30 +0000 Subject: [PATCH] Linux: Make some of the assembly look a bit better. Change the PCSX2_ALIGNED_EXTERN defs a bit. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@820 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/PS2Etypes.h | 4 +- common/include/Pcsx2Defs.h | 6 +-- pcsx2/IPU/yuv2rgb.cpp | 2 +- pcsx2/Linux/memzero.h | 26 +++++------ pcsx2/VifDma.cpp | 12 ++--- pcsx2/x86/iR3000A.cpp | 2 +- pcsx2/x86/ix86-32/iR5900-32.cpp | 2 +- pcsx2/x86/ix86/ix86_cpudetect.cpp | 4 +- pcsx2/x86/ix86/ix86_tools.cpp | 74 +++++++++++++++---------------- 9 files changed, 66 insertions(+), 66 deletions(-) diff --git a/common/include/PS2Etypes.h b/common/include/PS2Etypes.h index 9dceb3cd0a..24ce9f20d0 100644 --- a/common/include/PS2Etypes.h +++ b/common/include/PS2Etypes.h @@ -146,8 +146,8 @@ typedef union _LARGE_INTEGER // fixme - is this needed for recent versions of GCC? Or can we just use the macros // above instead for both definitions (implementations) and declarations (includes)? -- air -#define PCSX2_ALIGNED_EXTERN(alig,x) extern x -#define PCSX2_ALIGNED16_EXTERN(x) extern x +#define PCSX2_ALIGNED_EXTERN(alig,x) extern x __attribute((aligned(alig))) +#define PCSX2_ALIGNED16_EXTERN(x) extern x __attribute((aligned(16))) #endif // _MSC_VER diff --git a/common/include/Pcsx2Defs.h b/common/include/Pcsx2Defs.h index 5d46d7a596..dbaf5ca315 100644 --- a/common/include/Pcsx2Defs.h +++ b/common/include/Pcsx2Defs.h @@ -72,7 +72,7 @@ default: \ // Note: building the 'extern' into PCSX2_ALIGNED16_DECL fixes Visual Assist X's intellisense. #define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED_EXTERN(alig,x) __declspec(align(alig)) x +#define PCSX2_ALIGNED_EXTERN(alig,x) extern __declspec(align(alig)) x #define PCSX2_ALIGNED16(x) __declspec(align(16)) x #define PCSX2_ALIGNED16_EXTERN(x) extern __declspec(align(16)) x @@ -85,8 +85,8 @@ default: \ // instead for both definitions (implementations) and declarations (includes)? -- air #define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) #define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#define PCSX2_ALIGNED_EXTERN(alig,x) extern x -#define PCSX2_ALIGNED16_EXTERN(x) extern x +#define PCSX2_ALIGNED_EXTERN(alig,x) extern x __attribute((aligned(alig))) +#define PCSX2_ALIGNED16_EXTERN(x) extern x __attribute((aligned(16))) #define __naked // GCC lacks the naked specifier #define CALLBACK // CALLBACK is a win32-specific mess diff --git a/pcsx2/IPU/yuv2rgb.cpp b/pcsx2/IPU/yuv2rgb.cpp index 312ff8b845..1d93bc6ba9 100644 --- a/pcsx2/IPU/yuv2rgb.cpp +++ b/pcsx2/IPU/yuv2rgb.cpp @@ -215,7 +215,7 @@ ihatemsvc: jne tworows } #elif defined(__GNUC__) - asm( + __asm__( ".intel_syntax noprefix\n" "mov eax, 1\n" "xor esi, esi\n" diff --git a/pcsx2/Linux/memzero.h b/pcsx2/Linux/memzero.h index 4b1cbebe61..bdc6265c37 100644 --- a/pcsx2/Linux/memzero.h +++ b/pcsx2/Linux/memzero.h @@ -109,14 +109,14 @@ static __forceinline void memset_8( void *dest ) ( ".intel_syntax noprefix\n" "cld\n" -// "mov edi, %0\n" -// "mov eax, %1\n" +// "mov edi, %[dest]\n" +// "mov eax, %[data32]\n" "stosd\n" "stosd\n" "stosd\n" ".att_syntax\n" : - : "D"(dest), "a"(data32) + : [dest]"D"(dest), [data32]"a"(data32) // D - edi, a -- eax, c ecx : ); @@ -127,15 +127,15 @@ static __forceinline void memset_8( void *dest ) ( ".intel_syntax noprefix\n" "cld\n" -// "mov edi, %0\n" -// "mov eax, %1\n" +// "mov edi, %[dest]\n" +// "mov eax, %[data32]\n" "stosd\n" "stosd\n" "stosd\n" "stosd\n" ".att_syntax\n" : - : "D"(dest), "a"(data32) + : [dest]"D"(dest), [data32]"a"(data32) : ); @@ -146,8 +146,8 @@ static __forceinline void memset_8( void *dest ) ( ".intel_syntax noprefix\n" "cld\n" -// "mov edi, %0\n" -// "mov eax, %1\n" +// "mov edi, %[dest]\n" +// "mov eax, %[data32]\n" "stosd\n" "stosd\n" "stosd\n" @@ -155,7 +155,7 @@ static __forceinline void memset_8( void *dest ) "stosd\n" ".att_syntax\n" : - : "D"(dest), "a"(data32) + : [dest]"D"(dest), [data32]"a"(data32) : ); @@ -166,13 +166,13 @@ static __forceinline void memset_8( void *dest ) ( ".intel_syntax noprefix\n" "cld\n" -// "mov ecx, %0\n" -// "mov edi, %1\n" -// "mov eax, %2\n" +// "mov ecx, %[remdat]\n" +// "mov edi, %[dest]\n" +// "mov eax, %\[data32]n" "rep stosd\n" ".att_syntax\n" : - : "c"(remdat), "D"(dest), "a"(data32) + : [remdat]"c"(remdat), [dest]"D"(dest), [data32]"a"(data32) : ); return; diff --git a/pcsx2/VifDma.cpp b/pcsx2/VifDma.cpp index c2a2d13ca5..8f3422e866 100644 --- a/pcsx2/VifDma.cpp +++ b/pcsx2/VifDma.cpp @@ -505,15 +505,15 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma #else if( VIFdmanum ) { __asm__(".intel_syntax noprefix\n" - "movaps xmm6, xmmword ptr [%0]\n" - "movaps xmm7, xmmword ptr [%1]\n" - ".att_syntax\n" : :"r"(g_vifRow1), "r"(g_vifCol1) ); + "movaps xmm6, xmmword ptr [%[g_vifRow1]]\n" + "movaps xmm7, xmmword ptr [%[g_vifCol1]]\n" + ".att_syntax\n" : :[g_vifRow1]"r"(g_vifRow1), [g_vifCol1]"r"(g_vifCol1) ); } else { __asm__(".intel_syntax noprefix\n" - "movaps xmm6, xmmword ptr [%0]\n" - "movaps xmm7, xmmword ptr [%1]\n" - ".att_syntax\n" : : "r"(g_vifRow0), "r"(g_vifCol0) ); + "movaps xmm6, xmmword ptr [%[g_vifRow0]]\n" + "movaps xmm7, xmmword ptr [%[g_vifCol0]]\n" + ".att_syntax\n" : : [g_vifRow0]"r"(g_vifRow0), [g_vifCol0]"r"(g_vifCol0) ); } #endif diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index c754abb6c8..db7ede34c4 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -845,7 +845,7 @@ static void checkcodefn() #ifdef _MSC_VER __asm mov pctemp, eax; #else - __asm__("movl %%eax, %0" : : "m"(pctemp) ); + __asm__("movl %%eax, %[pctemp]" : : [pctemp]"m"(pctemp) ); #endif SysPrintf("iop code changed! %x\n", pctemp); } diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 0fa6402b8b..29b27a460f 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -1165,7 +1165,7 @@ static void checkcodefn() #ifdef _MSC_VER __asm mov pctemp, eax; #else - __asm__("movl %%eax, %0" : "=m"(pctemp) ); + __asm__("movl %%eax, %[pctemp]" : [pctemp]"=m"(pctemp) ); #endif Console::Error("code changed! %x", params pctemp); diff --git a/pcsx2/x86/ix86/ix86_cpudetect.cpp b/pcsx2/x86/ix86/ix86_cpudetect.cpp index 6c0d91838e..bf88feeb32 100644 --- a/pcsx2/x86/ix86/ix86_cpudetect.cpp +++ b/pcsx2/x86/ix86/ix86_cpudetect.cpp @@ -115,7 +115,7 @@ extern s32 iCpuId( u32 cmd, u32 *regs ) "pushf\n" "pop %%eax\n" "xor %%edx, %%eax\n" - "mov %%eax, %0\n" + "mov %%eax, %[flag]\n" "add $0x18, %%esp\n" "cmpl $0x0,%%eax\n" "jne 1f\n" @@ -123,7 +123,7 @@ extern s32 iCpuId( u32 cmd, u32 *regs ) "leave\n" "ret\n" "1:\n" - : "=r"(flag) : + : [flag]"=r"(flag) : ); cpuid(cmd, regs[0], regs[1], regs[2], regs[3]); diff --git a/pcsx2/x86/ix86/ix86_tools.cpp b/pcsx2/x86/ix86/ix86_tools.cpp index 1ea1f9eaa9..5ef532ffcd 100644 --- a/pcsx2/x86/ix86/ix86_tools.cpp +++ b/pcsx2/x86/ix86/ix86_tools.cpp @@ -61,7 +61,7 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR) #ifdef _MSC_VER __asm ldmxcsr g_sseMXCSR; // set the new sse control #else - __asm__("ldmxcsr %0" : : "m"(g_sseMXCSR) ); + __asm__("ldmxcsr %[g_sseMXCSR]" : : [g_sseMXCSR]"m"(g_sseMXCSR) ); #endif //g_sseVUMXCSR = g_sseMXCSR|0x6000; } @@ -108,16 +108,16 @@ __forceinline void FreezeMMXRegs_(int save) #else __asm__( ".intel_syntax noprefix\n" - "movq [%0+0x00], mm0\n" - "movq [%0+0x08], mm1\n" - "movq [%0+0x10], mm2\n" - "movq [%0+0x18], mm3\n" - "movq [%0+0x20], mm4\n" - "movq [%0+0x28], mm5\n" - "movq [%0+0x30], mm6\n" - "movq [%0+0x38], mm7\n" + "movq [%[g_globalMMXData]+0x00], mm0\n" + "movq [%[g_globalMMXData]+0x08], mm1\n" + "movq [%[g_globalMMXData]+0x10], mm2\n" + "movq [%[g_globalMMXData]+0x18], mm3\n" + "movq [%[g_globalMMXData]+0x20], mm4\n" + "movq [%[g_globalMMXData]+0x28], mm5\n" + "movq [%[g_globalMMXData]+0x30], mm6\n" + "movq [%[g_globalMMXData]+0x38], mm7\n" "emms\n" - ".att_syntax\n" : : "r"(g_globalMMXData) + ".att_syntax\n" : : [g_globalMMXData]"r"(g_globalMMXData) ); #endif @@ -148,16 +148,16 @@ __forceinline void FreezeMMXRegs_(int save) #else __asm__( ".intel_syntax noprefix\n" - "movq mm0, [%0+0x00]\n" - "movq mm1, [%0+0x08]\n" - "movq mm2, [%0+0x10]\n" - "movq mm3, [%0+0x18]\n" - "movq mm4, [%0+0x20]\n" - "movq mm5, [%0+0x28]\n" - "movq mm6, [%0+0x30]\n" - "movq mm7, [%0+0x38]\n" + "movq mm0, [%[g_globalMMXData]+0x00]\n" + "movq mm1, [%[g_globalMMXData]+0x08]\n" + "movq mm2, [%[g_globalMMXData]+0x10]\n" + "movq mm3, [%[g_globalMMXData]+0x18]\n" + "movq mm4, [%[g_globalMMXData]+0x20]\n" + "movq mm5, [%[g_globalMMXData]+0x28]\n" + "movq mm6, [%[g_globalMMXData]+0x30]\n" + "movq mm7, [%[g_globalMMXData]+0x38]\n" "emms\n" - ".att_syntax\n" : : "r"(g_globalMMXData) + ".att_syntax\n" : : [g_globalMMXData]"r"(g_globalMMXData) ); #endif } @@ -195,15 +195,15 @@ __forceinline void FreezeXMMRegs_(int save) #else __asm__( ".intel_syntax noprefix\n" - "movaps [%0+0x00], xmm0\n" - "movaps [%0+0x10], xmm1\n" - "movaps [%0+0x20], xmm2\n" - "movaps [%0+0x30], xmm3\n" - "movaps [%0+0x40], xmm4\n" - "movaps [%0+0x50], xmm5\n" - "movaps [%0+0x60], xmm6\n" - "movaps [%0+0x70], xmm7\n" - ".att_syntax\n" : : "r"(g_globalXMMData) + "movaps [%[g_globalXMMData]+0x00], xmm0\n" + "movaps [%[g_globalXMMData]+0x10], xmm1\n" + "movaps [%[g_globalXMMData]+0x20], xmm2\n" + "movaps [%[g_globalXMMData]+0x30], xmm3\n" + "movaps [%[g_globalXMMData]+0x40], xmm4\n" + "movaps [%[g_globalXMMData]+0x50], xmm5\n" + "movaps [%[g_globalXMMData]+0x60], xmm6\n" + "movaps [%[g_globalXMMData]+0x70], xmm7\n" + ".att_syntax\n" : : [g_globalXMMData]"r"(g_globalXMMData) ); #endif // _MSC_VER @@ -237,15 +237,15 @@ __forceinline void FreezeXMMRegs_(int save) #else __asm__( ".intel_syntax noprefix\n" - "movaps xmm0, [%0+0x00]\n" - "movaps xmm1, [%0+0x10]\n" - "movaps xmm2, [%0+0x20]\n" - "movaps xmm3, [%0+0x30]\n" - "movaps xmm4, [%0+0x40]\n" - "movaps xmm5, [%0+0x50]\n" - "movaps xmm6, [%0+0x60]\n" - "movaps xmm7, [%0+0x70]\n" - ".att_syntax\n" : : "r"(g_globalXMMData) + "movaps xmm0, [%[g_globalXMMData]+0x00]\n" + "movaps xmm1, [%[g_globalXMMData]+0x10]\n" + "movaps xmm2, [%[g_globalXMMData]+0x20]\n" + "movaps xmm3, [%[g_globalXMMData]+0x30]\n" + "movaps xmm4, [%[g_globalXMMData]+0x40]\n" + "movaps xmm5, [%[g_globalXMMData]+0x50]\n" + "movaps xmm6, [%[g_globalXMMData]+0x60]\n" + "movaps xmm7, [%[g_globalXMMData]+0x70]\n" + ".att_syntax\n" : : [g_globalXMMData]"r"(g_globalXMMData) ); #endif // _MSC_VER