Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: loody <miloody@gmail.com>
To: Linux MIPS Mailing List <linux-mips@linux-mips.org>
Subject: some question about Extended Asm
Date: Wed, 6 Jan 2010 15:13:11 +0800	[thread overview]
Message-ID: <3a665c761001052313v36bfeb89v37ada6b76e91c271@mail.gmail.com> (raw)

Dear all:
I write an assembly in c at the end of letter.
I try to
  "or %0, count\n", where count is $a1.
so I write %1 as count and write
  "or %0, %1\n" and assign %1 as count in input section.

But the result is not what I expect.
the result is "   or      v1,v1,v0"
Did I miss something or the only way to meet what I need is directly write
 "or %0, $a1\n"?
appreciate your help,
miloody

void cpuperformanceEvent11_initial(unsigned int mode,unsigned count)
{
bf0106d8:       27bdfff0        addiu   sp,sp,-16
bf0106dc:       afbe0008        sw      s8,8(sp)
bf0106e0:       03a0f021        move    s8,sp
bf0106e4:       afc40010        sw      a0,16(s8)
bf0106e8:       afc50014        sw      a1,20(s8)
        unsigned int temp;
        asm(
bf0106ec:       8fc30010        lw      v1,16(s8)
bf0106f0:       8fc20014        lw      v0,20(s8)
bf0106f4:       4003c801        mfc0    v1,c0_perfcnt,1
bf0106f8:       00621825        or      v1,v1,v0
bf0106fc:       4083c801        mtc0    v1,c0_perfcnt,1
                "mfc0 %0, $25, 1\n"
                "or %0, %1\n"
                "mtc0 %0, $25, 1\n"
                :
                :"r" (mode), "r" (count)
        );
}


void cpuperformanceEvent0_initial(unsigned int mode,unsigned count)
{
	unsigned int temp;
	asm(
		"mfc0 %0, $25, 1\n"
		"or %0, %1\n"
		"mtc0 %0, $25, 1\n"
		:
		:"r" (mode), "r" (count)
	);
}

             reply	other threads:[~2010-01-06  7:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06  7:13 loody [this message]
2010-01-06 12:48 ` some question about Extended Asm Maciej W. Rozycki
2010-01-10 16:09   ` loody
2010-01-10 17:14     ` Maciej W. Rozycki
2010-01-10 17:17       ` Geert Uytterhoeven

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=3a665c761001052313v36bfeb89v37ada6b76e91c271@mail.gmail.com \
    --to=miloody@gmail.com \
    --cc=linux-mips@linux-mips.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