public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* assembler error
@ 2004-08-19 15:27 Ankit Jain
  2004-08-19 15:55 ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: Ankit Jain @ 2004-08-19 15:27 UTC (permalink / raw)
  To: gcc

      1 #include<inttypes.h>
      2 int main()
      3 {
      4   uint8_t
a[32]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
       28,29,30,31,32},i=0,b[32],j=0;
      5    for(i=0;i<32;i=i+8)
      6    {
      7       asm("movq (%1), %%mm0 \n\t"
      8           "movq %%mm0, (%0) \n\t"
      9       :"=r"(b[i])
     10       :"r"(a[i])
     11       :"%mm0"
     12       );
     13    while(j<32)
     14     {printf("%d ",b[j]);j++;}
     15   }
     16  return 0;
     17 }

this gives a assembler error?

/tmp/ccO1Jllb.s: Assembler messages:
/tmp/ccO1Jllb.s:68: Error: `(%al)' is not a valid 32
bit base/index expression
/tmp/ccO1Jllb.s:69: Error: `(%al)' is not a valid 32
bit base/index expression

WHY?

ankit jain


________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: assembler error
  2004-08-19 15:27 assembler error Ankit Jain
@ 2004-08-19 15:55 ` Eljay Love-Jensen
  0 siblings, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-08-19 15:55 UTC (permalink / raw)
  To: Ankit Jain, gcc

Hi Ankit,

Your a[32] array and b[32] array are not stored in registers, they are
stored in memory.  But you are using a "r" specifier instead of a "m"
specifier.

I changed your example to use "m", and set b to all 255, and also changed
the printf loop to print each time instead of just the first time, and then
the assembly snippet copied a to b in four iterations.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Assembler Error
  2004-11-21  6:52 Assembler Error Ankit Jain
@ 2004-11-22  5:43 ` Ramana Radhakrishnan
  0 siblings, 0 replies; 4+ messages in thread
From: Ramana Radhakrishnan @ 2004-11-22  5:43 UTC (permalink / raw)
  To: Ankit Jain; +Cc: gcc


Please mention the versions of GCC , binutils that you might be using so 
that someone can verify the problem .Further please provide either a 
preprocessed output or a proper testcase since no one can test your case 
otherwise.




Ankit Jain wrote:
>  uint64_t csae = 0; /* accummulators for difference */
>      58   uint64_t c1 = 0,*c;
>      59   uint8_t *ip, *rp; /* pointers to appropriate
> rows */
> 
>     asm("movq   (%1), %%mm1 \n\t"
>      70           "psadbw (%2), %%mm1 \n\t"
>      71           "movq   8(%1), %%mm0 \n\t"
>      72           "psadbw 8(%2), %%mm0 \n\t"
>      73           "paddd  %%mm0, %%mm1 \n\t" /* might
> use paddd for 32-bit adding */
>      74           "movq   16(%1), %%mm0 \n\t"
>      75           "psadbw 16(%2), %%mm0 \n\t"
>      76           "paddd  %%mm0, %%mm1 \n\t"
>      77           "movq   24(%1), %%mm0 \n\t"
>      78           "psadbw 24(%2), %%mm0 \n\t"
>      79           "paddd  %%mm0, %%mm1 \n\t"
>      80           "movq   %%mm1,%0 \n\t"
>      82           "emms \n\t"                
>      83           : "=g" (c1)
>      84           : "r" (rp), "r" (ip)
>      85           );
> Well due to this module i am getting the following
> error
> {standard input}: Assembler messages:
> {standard input}:4126: Error: suffix or operands
> invalid for `movq'
> {standard input}:4494: Error: suffix or operands
> invalid for `movq'
> 
> if somebody can help
> 
> thanks 
> 
> ankit jain
> 
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping" 
> your friends today! Download Messenger Now 
> http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Assembler Error
@ 2004-11-21  6:52 Ankit Jain
  2004-11-22  5:43 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 4+ messages in thread
From: Ankit Jain @ 2004-11-21  6:52 UTC (permalink / raw)
  To: gcc

 uint64_t csae = 0; /* accummulators for difference */
     58   uint64_t c1 = 0,*c;
     59   uint8_t *ip, *rp; /* pointers to appropriate
rows */

    asm("movq   (%1), %%mm1 \n\t"
     70           "psadbw (%2), %%mm1 \n\t"
     71           "movq   8(%1), %%mm0 \n\t"
     72           "psadbw 8(%2), %%mm0 \n\t"
     73           "paddd  %%mm0, %%mm1 \n\t" /* might
use paddd for 32-bit adding */
     74           "movq   16(%1), %%mm0 \n\t"
     75           "psadbw 16(%2), %%mm0 \n\t"
     76           "paddd  %%mm0, %%mm1 \n\t"
     77           "movq   24(%1), %%mm0 \n\t"
     78           "psadbw 24(%2), %%mm0 \n\t"
     79           "paddd  %%mm0, %%mm1 \n\t"
     80           "movq   %%mm1,%0 \n\t"
     82           "emms \n\t"                
     83           : "=g" (c1)
     84           : "r" (rp), "r" (ip)
     85           );
Well due to this module i am getting the following
error
{standard input}: Assembler messages:
{standard input}:4126: Error: suffix or operands
invalid for `movq'
{standard input}:4494: Error: suffix or operands
invalid for `movq'

if somebody can help

thanks 

ankit jain

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-22  5:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 15:27 assembler error Ankit Jain
2004-08-19 15:55 ` Eljay Love-Jensen
2004-11-21  6:52 Assembler Error Ankit Jain
2004-11-22  5:43 ` Ramana Radhakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).