Problem with inline assembly for x86 under win ce 4.1

Problem with inline assembly for x86 under win ce 4.1

Post by Venkates » Fri, 11 Jul 2003 15:06:01



Hi
I have few problems with using inline assembly (__asm ).I
am getting compiler errors.MSDN documentation says inline
assembly is supported for x86 processors.Are there any
pragma statements to be aded to compile inline assembly
code.Please help.

Rgds,
Venkatesh

 
 
 

Problem with inline assembly for x86 under win ce 4.1

Post by Demitri [MS » Fri, 11 Jul 2003 15:16:49


Can you post a snippet of your code?
btw - What CE OS version and what compiler?

--
~Demitri

(This posting is provided "AS IS" with no warranties, and confers no
rights.)


Hi
I have few problems with using inline assembly (__asm ).I
am getting compiler errors.MSDN documentation says inline
assembly is supported for x86 processors.Are there any
pragma statements to be aded to compile inline assembly
code.Please help.

Rgds,
Venkatesh

 
 
 

Problem with inline assembly for x86 under win ce 4.1

Post by Venkates » Fri, 11 Jul 2003 15:39:43


Hi
The code snippet..
This code is part of VLC project.
#ifndef HAVE_MMX1
        /* PREFETCH has effect even for MOVSB
instruction ;) */
        __asm__ __volatile__ (
                PREFETCH" (%0)\n"
                PREFETCH" 64(%0)\n"
                PREFETCH" 128(%0)\n"
                PREFETCH" 192(%0)\n"
                PREFETCH" 256(%0)\n"
                : : "r" (from) );
#endif
        if(len >= MIN_LEN)
        {
          register unsigned long int delta;
          /* Align destinition to MMREG_SIZE -boundary */
          delta = ((unsigned long int)to)&(MMREG_SIZE-1);
          if(delta)
          {
            delta=MMREG_SIZE-delta;
            len -= delta;
            small_memcpy(to, from, delta);
          }
          i = len >> 6; /* len/64 */
          len&=63;
        /*
           This algorithm is top effective when the code
consequently
           reads and writes blocks which have size of
cache line.
           Size of cache line is processor-dependent.
           It will, however, be a minimum of 32 bytes on
any processors.
           It would be better to have a number of
instructions which
           perform reading and writing to be multiple to a
number of
           processor's decoders, but it's not always
possible.
        */
#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
        if(((unsigned long)from) & 15)
        /* if SRC is misaligned */
        for(; i>0; i--)
        {
                __asm__ __volatile__ (
                PREFETCH" 320(%0)\n"
                "movups (%0), %%xmm0\n"
                "movups 16(%0), %%xmm1\n"
                "movups 32(%0), %%xmm2\n"
                "movups 48(%0), %%xmm3\n"
                "movntps %%xmm0, (%1)\n"
                "movntps %%xmm1, 16(%1)\n"
                "movntps %%xmm2, 32(%1)\n"
                "movntps %%xmm3, 48(%1)\n"
                :: "r" (from), "r" (to) : "memory");
                ((const unsigned char *)from)+=64;
                ((unsigned char *)to)+=64;
        }
When I convert to Windows CE 4.1, compiler does not
recognise __asm__, __volatile__. If I change __asm__ to
__asm, which is Microsoft's specific still the errors
persist.Please help.

Rgds,
Venkatesh

>-----Original Message-----
>Can you post a snippet of your code?
>btw - What CE OS version and what compiler?

>--
>~Demitri

>(This posting is provided "AS IS" with no warranties, and
confers no
>rights.)


message

>Hi
>I have few problems with using inline assembly (__asm ).I
>am getting compiler errors.MSDN documentation says inline
>assembly is supported for x86 processors.Are there any
>pragma statements to be aded to compile inline assembly
>code.Please help.

>Rgds,
>Venkatesh

>.

 
 
 

Problem with inline assembly for x86 under win ce 4.1

Post by eMVP » Fri, 11 Jul 2003 17:23:52


The syntax of that isn't correct.
 the syntax for asm is __asm { }

e.g.

__asm{
    mov ax,10
    add ax,2

Quote:}

--
Steve Maillet (eMVP)
Entelechy Consulting
smaillet_AT_EntelechyConsulting_DOT_com