This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preferred registers for integer arithmetic


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]