linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sandeep <sandeep@codito.com>
To: Ankit Jain <ankitjain1580@yahoo.com>
Cc: linux-assembly <linux-assembly@vger.kernel.org>
Subject: Re: extended asm+pointers
Date: Wed, 11 Aug 2004 16:21:03 +0530	[thread overview]
Message-ID: <4119FA17.7080704@codito.com> (raw)
In-Reply-To: <20040811090012.14095.qmail@web52905.mail.yahoo.com>

Ankit Jain wrote:
>       4 int main()
>       5 {
>       6   uint8_t
> a[8]={1,2,3,4,5,6,7,8},b[8]={0,0,0,0,0,0},i;
>       7   uint8_t *m,*m1;
>       8 
>       9   m=a;
>      10   m1=b;         //i have pointed m1 to b
>      11   for(i=0;i<8;i++)
>      12      printf("%d ",a[i]);
>      13   printf("\n");

>      14   asm("movq (%1), %%mm0 \n"
>      15       "movq %%mm0, (%0) \n"
>      16       :"=r"(m1)
>      17       :"r"(m)
>      18       );
this asm(...) is effectively achieving "m1=m;" you can verify this by printing 
m1[i] instead of a[i] and b[i]
>      19 
>      20   for(i=0;i<8;i++)
>      21      printf("%d ",b[i]);
>      22   return 0;
>      23 }
> well this problem is not solved yet. because when i
> display b array then it prints all 0's. according to
> me since i have initialised this m1 pointer then by b
> then b whould have all the values which i have moved
> 
> some have advised me to use arrays here as constraint
> but i want to use pointers. i am using r constraint
> and it says it says that m1 will use a register (i
> guess there is no problem in that)

-- 
regards
sandeep
--------------------------------------------------------------------------
Always borrow money from a pessimist; he doesn't expect to be paid
back.
--------------------------------------------------------------------------


  reply	other threads:[~2004-08-11 10:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-11  9:00 extended asm+pointers Ankit Jain
2004-08-11 10:51 ` sandeep [this message]
2004-08-11 18:33 ` Brian Raiter
     [not found] <20040811112319.87376.qmail@web52908.mail.yahoo.com>
2004-08-11 13:04 ` sandeep

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4119FA17.7080704@codito.com \
    --to=sandeep@codito.com \
    --cc=ankitjain1580@yahoo.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).