This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: question on mips embedded asm instructions
- From: Ian Lance Taylor <iant at google dot com>
- To: "Amker.Cheng" <amker dot cheng at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 29 Jul 2010 01:23:43 -0700
- Subject: Re: question on mips embedded asm instructions
- References: <AANLkTinx1okOYXwkC6UM8mitma8Y1wLBjnzC7SyiC8Bn@mail.gmail.com>
"Amker.Cheng" <amker.cheng@gmail.com> writes:
> On mips target, mult insns normally modify and refer to hi/lo regs.
> Giving following two embedded asm insns:
>
> 1 __asm__ ("mult %0, $1" : : "r"(a), "r"(b) : "lo");
> 2 __asm__ ("mflo %0" : "=r"(c) );
>
> the mult modify specific hard reg lo, and I can describe this by "lo"
> after the third colon.
> But what about the mflo? how could I describe that the insn will refer
> to the "lo" reg?
I don't think there is a way to do that. Fortunately, you don't need to
write mflo as an asm. Instead, give your mult instruction an output
with register class "l". When you copy that value somewhere, gcc should
generate the mflo for you.
Ian