[mad-user] Compiling LIBMAD for ARM

Karthika karthika_lakshmi at yahoo.co.in
Mon Apr 2 03:48:14 PDT 2007


Helloo,

I am trying to compile LIBMAD for ARM7TDMI on
Metrowerks Codewarrior tool. The processor specific
options for ARM are present in the file fixed.h. I
have taken those options which are specific for ARM
and included them in a new header file called "asm.h"
( given below).I have included this "asm.h" file in my
project. Then, I have removed fixed.h from my project.
Now, when I compile my project I get the errors for
mad_f_mul and MAD_F_MLA. MAD_F_MLA error is only for
III_alias reduce( ) function. A few errors are given
below.

Error   :  #29: expected an expression
layer3.c line 934     return frac ?
mad_f_mul(requantized, root_table[3 + frac]) :
requantized;

Error   :  #18: expected a ")"
layer3.c line 1591    MAD_F_MLA(hi, lo, -b, ca[i]);

Error   :  #18: expected a ")"
layer3.c line 1596    MAD_F_MLA(hi, lo,  a, ca[i]);

Error   :  #29: expected an expression
layer3.c line 1647     m0 = mad_f_mul(a17, -c3);

The "asm.h" file I have included is as follows.


#  define MAD_F_SCALEBITS  28
# define MAD_F_FRACBITS		28
#  define MAD_F(x)		((mad_fixed_t) (x##L))

# define MAD_F_MIN		((mad_fixed_t) -0x80000000L)
# define MAD_F_MAX		((mad_fixed_t) +0x7fffffffL)

# define MAD_F_ONE		MAD_F(0x10000000)

# define mad_f_tofixed(x)	((mad_fixed_t)  \
				 ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5))
# define mad_f_todouble(x)	((double)  \
				 ((x) / (double) (1L << MAD_F_FRACBITS)))

# define mad_f_intpart(x)	((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x)	((x) & ((1L <<
MAD_F_FRACBITS) - 1))
				/* (x should be positive) */

# define mad_f_fromint(x)	((x) << MAD_F_FRACBITS)

# define mad_f_add(x, y)	((x) + (y))
# define mad_f_sub(x, y)	((x) - (y))

#  define mad_f_mul(x, y)  \
    ({ mad_fixed64hi_t __hi;  \
       mad_fixed64lo_t __lo;  \
       mad_fixed_t __result;  \
       asm ("smull	%0, %1, %3, %4\n\t"  \
	    "movs	%0, %0, lsr %5\n\t"  \
	    "adc	%2, %0, %1, lsl %6"  \
	    : "=&r" (__lo), "=&r" (__hi), "=r" (__result)  \
	    : "%r" (x), "r" (y),  \
	      "M" (MAD_F_SCALEBITS), "M" (32 -
MAD_F_SCALEBITS)  \
	    : "cc");  \
       __result;  \
    })
    
    #  define MAD_F_MLX(hi, lo, x, y)  \
    asm ("smull	%0, %1, %2, %3"  \
	 : "=&r" (lo), "=&r" (hi)  \
	 : "%r" (x), "r" (y))

#  define MAD_F_MLA(hi, lo, x, y)  \
    asm ("smlal	%0, %1, %2, %3"  \
	 : "+r" (lo), "+r" (hi)  \
	 : "%r" (x), "r" (y))

#  define MAD_F_MLN(hi, lo)  \
    asm ("rsbs	%0, %2, #0\n\t"  \
	 "rsc	%1, %3, #0"  \
	 : "=r" (lo), "=r" (hi)  \
	 : "0" (lo), "1" (hi)  \
	 : "cc")

#  define mad_f_scale64(hi, lo)  \
    ({ mad_fixed_t __result;  \
       asm ("movs	%0, %1, lsr %3\n\t"  \
	    "adc	%0, %0, %2, lsl %4"  \
	    : "=&r" (__result)  \
	    : "r" (lo), "r" (hi),  \
	      "M" (MAD_F_SCALEBITS), "M" (32 -
MAD_F_SCALEBITS)  \
	    : "cc");  \
       __result;  \
    })
mad_fixed_t mad_f_abs(mad_fixed_t);
mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);


Can anybodu help me?

Thanks,
Karthika Lakshmi.



		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/


More information about the mad-user mailing list