This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

asm needs too many reloads



I got the following error when compiling a large C file with -O3 
optimization: (gcc version 2.95.2 19991024 (release))

emulation.c: In function `execute':
isa.file:8374: `asm' needs too many reloads

The error was not reported  when I commented out this particular inline asm 
in my code.

/* op1, op2, fl, __temp are global variable set elsewhere in the
  program */

#define FADD_EMU                                           \
{                                                          \
						   	   \
   __asm__ __volatile__(" pushl %%eax\n                    \
  			 fldt %3\n                         \
  			 fldt %2\n                         \
			 faddp %%st(0), %%st(1)\n          \
			 fstpt %0\n                        \
			 fstsw\n		           \
			 movw %%ax, %1\n                   \
			 popl %%eax"                       \
			 :"=g" (__temp), "=g" (fl)         \
			 :"g" (op1), "g" (op2)             \
			 : "st(0)", "st(1)", "ax", "memory"\
			 );                                \
}


Another problem is that I'm unable to reproduce the bug for a program with 
just the above piece of code. (See src code below).

What does this error exactly mean? And what should I do to fix this error?

Thanks in Advance,
jon


---Src code illustrating the use of the above macro---
/* This code snippet works fine...but the problem shows up when
* this macro is included from a large c file with many such macros
*/

#include <stdio.h>
unsigned short fl;
long double  __temp, op1, op2;

#define FADD_EMU                                           \
{                                                          \
						   	   \
   __asm__ __volatile__(" pushl %%eax\n                    \
  			 fldt %3\n                         \
  			 fldt %2\n                         \
			 faddp %%st(0), %%st(1)\n          \
			 fstpt %0\n                        \
			 fstsw\n		           \
			 movw %%ax, %1\n                   \
			 popl %%eax"                       \
			 :"=g" (__temp), "=g" (fl)         \
			 :"g" (op1), "g" (op2)             \
			 : "st(0)", "st(1)", "ax", "memory"\
			 );                                \
}

int main()
{
  op1 = 5.6;
  op2 = 6.4;
  FADD_EMU
  printf("Sum:%llf\n",__temp);
  printf("Status:%d\n"fl);
}

---End of src code---

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]