This is the mail archive of the gcc@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]

Re: Projects for beginners


> Date: Tue, 30 Jan 2001 23:49:24 -0800
> From: "Zack Weinberg" <zackw@Stanford.EDU>

> On Wed, Jan 31, 2001 at 08:12:09AM +0100, Hans-Peter Nilsson wrote:
> >    Convert porting-macros definition and usage from
> >      #ifdef MACRO
> >        ... code ...
> >      #endif

> So it can be toggled at runtime when necessary?

Yes.  I think there was also a recent discussion where changing
from preprocessor-only to compile-time/runtime tests was
concluded a Good Thing.  My example "improvement" wasn't thought
through -- as you pointed out, elimination of the
#ifdef-wrapping is better.

> This is where I admit that I have never been able to understand any of
> the multiple different ways of handling condition codes in GCC.
> There's the pure cc0 approach, the every-insn's-a-parallel approach
> taken by the x86 back end, the cbranch stuff which I totally agree
> needs more documentation, and the pure flag registers approach which
> apparently only works on machines where that is the hardware.

You could change cc0-ports to the flags-register approach (as
was done with x86), but your .md would be cluttered with
clobbers for insns that affect cc0 on your machine.  This is
somewhat seen in the x86 back-end, though "luckily" it seems
it's mostly arithmetic insns that set its cc0 (now expressed as
(reg:CC 17)).

> My basic problem is that the comparison RTXes mean different things
> when they're used to set condition registers, from when they're used
> to examine condition registers.  I.e. these are not the same thing:
> 
>   (eq (reg:SI 12) (const_int 0))
>   (eq (cc0) (const_int 0))
> 
> but I've never really been able to understand just what the latter one
> means.

AFAIK the latter is only for cc0-targets, where the former isn't
expressable in a real insn (at least in the "normal"
compare/branch context) -- you always set cc0.  The cc0-users
(branches, sCC) then "test" cc0, not the original operands.

For some machines with "pure flag registers", the contents of
those registers have different meaning depending on the type of
compare (type of compare insn). They use various CCmodes and you
mostly see them use
 (eq (reg:CC 12) (const_int 0))

But it's all in md.texi (right?)
Might need clarification, though.

brgds, H-P

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