Linux MIPS Architecture development
 help / color / mirror / Atom feed
* some question about Extended Asm
@ 2010-01-06  7:13 loody
  2010-01-06 12:48 ` Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: loody @ 2010-01-06  7:13 UTC (permalink / raw)
  To: Linux MIPS Mailing List

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)
	);
}

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

end of thread, other threads:[~2010-01-10 17:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06  7:13 some question about Extended Asm loody
2010-01-06 12:48 ` Maciej W. Rozycki
2010-01-10 16:09   ` loody
2010-01-10 17:14     ` Maciej W. Rozycki
2010-01-10 17:17       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox