tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] RE: [C67] missing "case" in C67_map_regc()?


From: TK
Subject: [Tinycc-devel] RE: [C67] missing "case" in C67_map_regc()?
Date: Thu, 13 Mar 2003 18:54:18 -0800

Background on C6x:  The C6x doesn't have a condition code register, or a
carry bit.  One reason is because theoretically several compares could
be happening in parallel.  The result of any compare can go to any
register on the same side as the functional unit.  There are only 5
special registers that can then be used for conditional branches.  BTW
all instructions on the C6x are conditional.  For simple "if"
statements, for example that conditionally store a result like:

if (condition)
   i=0;

It is many times faster to do a conditional store rather than branch
around it. Anyway, regarding the condition code I tried several
different approaches on where to put the condition result, currently I
think it is always put in one register B2 that TCC doesn't even know
about.  The main disadvantage in this is that in some cases if the
operands are on the A side then the dst can't go to the B side so one of
them needs to be moved to the B side first.

So I guess what I'm trying to say is that we might want to use various
regs in the future. The comment attempts to describe which 3 of the 4
(currently) normal "TCC regs" could be used

TK

> -----Original Message-----
> From: Peter "Firefly" Lund [mailto:address@hidden
> Sent: Thursday, March 13, 2003 3:49 PM
> To: Tom Kerekes
> Subject: [C67] missing "case" in C67_map_regc()?
> 
> // mapping from tcc reg number to
> // C67 register to condition code field
> //
> // valid condition code regs are:
> //
> // tcc reg 2 ->B0 -> 1
> // tcc reg 3 ->B1 -> 2
> // tcc reg 0 -> A2 -> 5
> // tcc reg 1 -> A3 -> X
> // tcc reg      B2 -> 3
> 
> int C67_map_regc(int r)
> {
>       if (r==0)   // normal tcc regs
>               return 0x5;
>       else if (r==2)   // normal tcc regs
>               return 0x1;
>       else if (r==3)   // normal tcc regs
>               return 0x2;
>       else if (r==C67_B2)   // normal tcc regs
>               return 0x3;
>       else if (r==C67_CREG_ZERO)
>               return 0; // Special code for no condition reg test
>       else
>               ASSERT(FALSE);
> 
>       return 0;
> }
> 
> The comments before the function seem to indicate that r can be 1.
That
> case doesn't occur in the code, though.
> 
> Is that a bug?  Or are the comments wrong?
> 
> -Peter
> 
> "Of course, I'm not unbiased, but in my humble opinion, I've
>  gotten close to something that I can be really proud of."
>  -- Knuth on The Art of Computer Programming.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]