- Fixed: In gccinlines.h, the alternative for DivScale32 that took idiv's parameter in memory

did not mark eax as an early-clobber register, so GCC might decide to pass the memory address
  in eax, and it would get clobbered by the inline assembly before fetching the value to divide
  by.

  But rather than fix it by adding another '&', I have opted to mark it as in/out and do the
  zeroing outside the inline assembly, so GCC has maximum flexibility for scheduling the code.

SVN r3242 (trunk)
This commit is contained in:
Randy Heit 2011-06-18 05:43:51 +00:00
parent 4b78b07aca
commit 4032b4c307
1 changed files with 3 additions and 4 deletions

View File

@ -279,12 +279,11 @@ MAKECONSTDivScale(31)
static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
SDWORD result, dummy;
SDWORD result = 0, dummy;
asm volatile
("xor %%eax,%%eax\n\t"
"idivl %3"
:"=&a,a" (result),
("idivl %3"
:"+a,a" (result),
"=d,d" (dummy)
: "d,d" (a),
"r,m" (b)