pre-processor symbols and gcc -v

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

If a pre-processor macro, say __m68k__ is defined shouldn't it show up
in gcc -v? gcc version is 3.4.6.

int main(int argc, char **argv)
{
void *handle;
double (*cosine)(double),arg,res;
char *error,*msg="cos(%f)=%.7f\n";

        handle = dlopen ("libm.so", RTLD_LAZY);
        if (!handle)
        {
                fputs (dlerror(), stderr);
                exit(1);
        }

        cosine = dlsym(handle, "cos");
        if ((error = dlerror()) != NULL)
        {
                fprintf (stderr, "%s\n", error);
                exit(1);
        }

        arg=2.0;
        res=(*cosine)(arg);
        printf(msg,arg,res);
        dlclose(handle);

        /*
         * 680x0 constraints are:
         *      a       address register
         *      d       data register
         *      f       floating point
         *      I       integer [1,8]
         *      J       16-bit signed integer
         *      K       signed number whose magnitude is > 0x80
         *      L       integer [-1,-8]
         *      M       signed number whose magnitude is > 0x100
         *      G       non 68881 rom float constant
         * '=' is used to indicate output, '&' means noclobber
         * Some floating point examples are:
         *      ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp))
         *      ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)")
         */
#ifdef __i386__
        __asm__ __volatile ("fldl (%%edi); fld %%st(0); fcos; "
                "leal -8(%%esp),%%esp; fstpl (%%esp); leal -8(%%esp),%%esp; "
                "fstpl (%%esp); pushl %%esi; call printf; leal 20(%%esp),%%esp"
                :
                :"D" (&arg), "S" (msg));
#elif defined(__m68k__)
#ifdef __HAVE_FPU__
#if defined(__mc68020__) || defined(__mc68030__)
        __asm__ __volatile ("fcos.x %1,%0"
                :"=f" (res)
                :"f" (arg));

        printf(msg,arg,res);
#elif defined(__mc68040__) || defined(__mc68060__)
        __asm__ __volatile ("fcos.x %1,%0"
                :"=f" (res)
                :"f" (arg));

        printf("Instruction implemented by trap:  ");
        printf(msg,arg,res);
#endif
#endif
#endif

#ifdef __m68k__
#error __m68k__ is defined!
#endif

        return 0;
}

Thanks!

kevin

P.S.:  Anyone point me to an example of how to use the 68k 'Q' constraint?

And while I'm here, anyway to see when an instruction causes an
unimplemented instruction trap (like fcos on a 68040)?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux