- Simplify some inline assembly so that clang can compile ZDBSP. (Linking is failing for me

because MinGW's GCC 4.5.0 made some seemingly-dumb-to-me changes to their default link
  settings, so I've removed all traces of GCC 4.5.0 and am currently rebuilding clang to see
  if that fixes it.)

SVN r2387 (trunk)
This commit is contained in:
Randy Heit 2010-06-25 03:55:18 +00:00
parent 983dcc08d4
commit b486edd60e

34
zdbsp.h
View file

@ -120,6 +120,39 @@ inline fixed_t DMulScale32 (fixed_t a, fixed_t b, fixed_t c, fixed_t d)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#ifdef __clang__
inline fixed_t Scale (fixed_t a, fixed_t b, fixed_t c)
{
fixed_t result, dummy;
asm volatile
("imull %3\n\t"
"idivl %4"
: "=a" (result),
"=&d" (dummy)
: "a" (a),
"r" (b),
"r" (c)
: "%cc"
);
return result;
}
inline fixed_t DivScale30 (fixed_t a, fixed_t b)
{
fixed_t result, dummy;
asm volatile
("idivl %4"
: "=a" (result),
"=d" (dummy)
: "a" (a<<30),
"d" (a>>2),
"r" (b) \
: "%cc");
return result;
}
#else
inline fixed_t Scale (fixed_t a, fixed_t b, fixed_t c) inline fixed_t Scale (fixed_t a, fixed_t b, fixed_t c)
{ {
fixed_t result, dummy; fixed_t result, dummy;
@ -151,6 +184,7 @@ inline fixed_t DivScale30 (fixed_t a, fixed_t b)
: "%cc"); : "%cc");
return result; return result;
} }
#endif
inline fixed_t MulScale30 (fixed_t a, fixed_t b) inline fixed_t MulScale30 (fixed_t a, fixed_t b)
{ {