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]
Other format: [Raw text]

How to handle SCmode.


Hi,

I have a 32bit processor . My arithmetic and float operations confine to SImode(32) and SFmode (32).
But for the test case mentioned below, my compiler gives internal compiler error: in init_move_cost, at regclass.c:323 in gcc-4.3.3 version source.
compiler crashes at code gcc_assert (have_regs_of_mode[m]);implies gcc_assert(have_regs_of_mode[SCmode] ).


My concerned macro definitions are

#define MODES_TIEABLE_P(MODE1, MODE2) \
       ((MODE1 == QImode && MODE2 == HImode) ||  \
               (MODE1 == HImode && MODE2 == QImode)||  \
               (MODE1 == QImode && MODE2 == SImode)||  \
               (MODE1 == SImode && MODE2 == QImode)||  \
               (MODE1 == HImode && MODE2 == SImode)||  \
               (MODE1 == SImode && MODE2 == HImode))

#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
 if (GET_MODE_CLASS (MODE) == MODE_INT                 \
     && GET_MODE_SIZE (MODE) < 4)\
   (UNSIGNEDP) = ((MODE) == SImode ? 0 : (UNSIGNEDP)), \
   (MODE) =  SImode


#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
if ((GET_MODE_CLASS (MODE) == MODE_INT \
|| GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \
&& GET_MODE_SIZE (MODE) < 4) \
(MODE) = SImode;


#define HARD_REGNO_NREGS(REGNO, MODE) hard_regno_nregs(REGNO, MODE)

#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok(REGNO, MODE)



int hard_regno_nregs (reg, mode)
    enum machine_mode mode;
    int reg;
{
   int width = (GET_MODE_SIZE(mode) * BITS_PER_UNIT);
   if (width <= 32)
   {
       return 1;
   }
   else
   {
       return 2; // 2 because of complex_float
   }
}

int hard_regno_mode_ok (reg, mode)
    enum machine_mode mode;
    int reg;
{
   int width = GET_MODE_SIZE(mode) * BITS_PER_UNIT;
   if (width == 32 || width == 16 || width == 8)
   {
       return 1;
   }
   return 0;
}


Can any one point me to solution. Thanks in advance, Sumanth G



Testcase;
__complex__ float
__attribute__ ((noinline)) foo (__complex__ float x)
{
 return x;
}

__complex__ float
__attribute__ ((noinline)) bar (__complex__ float x)
{
 return foo (x);
}

int main()
{
 __complex__ float a, b;
 __real__ a = 9;
 __imag__ a = 42;

b = bar (a);

 if (a != b)
   abort ();

 return 0;
}


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