This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Preferred registers for integer arithmetic
- From: kevin diggs <diggskevin38 at gmail dot com>
- To: Paul Römer <roemer dot paul at googlemail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 15 Apr 2011 10:13:04 -0500
- Subject: Re: Preferred registers for integer arithmetic
- References: <BANLkTikQr3p4FzgAmfSy9BXsHMfF-9KThQ@mail.gmail.com>
Hi,
On Fri, Apr 15, 2011 at 8:39 AM, Paul Römer <roemer.paul@googlemail.com> wrote:
> Hi,
>
> I'm playing around with the gcc and its generated assembler code for
> some test applications. I recognized that the gcc prefers the use of
> the registers eax, (ebx), ecx and edx (x86) for arithmetic
> instructions like lea, add, mul, etc. I know that the gcc uses several
> register classes to define which registers can be used for which task
> (e.g. FIXED_REGS, GENERAL_REGS).
>
> Is there also a class that explains the described behavior? Or does
> the gcc simply looks for unused registers in a special order?
>
I'll take a stab at this. I would guess that the specialization for
the si and di in string moves make them used ... later than other
available regs. bp is used as the frame pointer unless
-fomit-frame-pointer is used (may be automatically enabled at certain
-O levels).
> Another question: What is meant by the Q_REGS class?
>
Based on a comment from gcc/config/i386/i386.h:
QImode must go into class Q_REGS.
I would guess that Q_REGS are the 8-bit registers.
> Thanks,
> ?Paul
>
kevin