mirror of https://github.com/PCSX2/pcsx2.git
gsdx: try to ask GCC to generate not dumb code
Unfortunately it requires at least GCC6. If a nice guy can check the generated code on GCC6. I don't know clang status. Here the only example, I have found on the web https://developers.redhat.com/blog/2016/02/25/new-asm-flags-feature-for-x86-in-gcc-6/ Current generated code in GSTextureCache::SourceMap::Add 38b3: bsf eax,esi 38b6: add esp,0x10 38b9: test esi,esi 38bb: jne 387e <GSTextureCache::SourceMap::Add(GSTextureCache::Source*, GIFRegTEX0 const&, GSOffset*)+0x6e> BSF already set the Z flag when input (esi) is 0. So it would be better to not put a silly add before the jump and to skip the test operation.
This commit is contained in:
parent
1fbee92044
commit
8cf3a83dd7
|
@ -391,11 +391,17 @@ using namespace stdext;
|
|||
|
||||
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
|
||||
|
||||
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
|
||||
__forceinline int _BitScanForward(unsigned long* const Index, const unsigned long Mask)
|
||||
{
|
||||
__asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
||||
|
||||
#if defined(__GCC_ASM_FLAG_OUTPUTS__) && 0
|
||||
// Need GCC6 to test the code validity
|
||||
int flag;
|
||||
__asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index), "=@ccz" (flag) : [Mask] "mr" (Mask));
|
||||
return flag;
|
||||
#else
|
||||
__asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask) : "cc");
|
||||
return Mask ? 1 : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
Loading…
Reference in New Issue