#32 [RFC,PIC16] simplified genCmp

closed
None
5
2005-01-04
2004-12-21
Raphael Neider
No

I developed a new, simpler and easier understandable
version of genCmp(). I did this because I tried to fix
an issue with genCmp with while (a < HIDDEN) in
/device/lib/_ulong2fs.c but could not pinpoint the error...

Furthermore the current version fails to assign the
result of the comparison to the desired result register
(producing wrong code for e.g. device/lib/_divslong.c).

My version aims at readability trying to avoid too many
special cases. I admit that it is in some cases less
efficient than the current version but maybe we could
use the new plan as a starting point for a better version?

Proposal/patch attached.

Regards,
Raphael Neider

Discussion

  • Raphael Neider
    Raphael Neider
    2004-12-21

    RFC: new version of genCmp()

     
    Attachments
  • Vangelis Rokas
    Vangelis Rokas
    2004-12-22

    • assigned_to: nobody --> vrokas
     
  • Vangelis Rokas
    Vangelis Rokas
    2004-12-22

    Logged In: YES
    user_id=770505

    Does the new version cover all the necessery cases?

     
  • Raphael Neider
    Raphael Neider
    2004-12-22

    Logged In: YES
    user_id=1115835

    The new version has been tested with my current sources
    (rather large project, 50% program memory used) and all
    seems to work -- and it compiles (without assertions).
    My version should fail with assertions in all unsupported
    cases, namely:
    - bits as operands
    - if left and right aer of different sizes
    - if neither operand is a register (or the like: AOP_DIR or
    AOP_PCODE)
    - if the other operand is not register-like or a literal

    All other cases (sizes 1 to 4, signed and unsigned
    comparisons between registers or register vs. literal, store
    to result or not) are supported.

    Raphael

     
  • Raphael Neider
    Raphael Neider
    2005-01-04

    Logged In: YES
    user_id=1115835

    Added a (fixed) version of the simplified genCmp to the
    sources (#920).

    All regression tests (especially the one about boundary
    checks, compare9.c ;-)) pass using it.

    Raphael

     
  • Raphael Neider
    Raphael Neider
    2005-01-04

    • status: open --> closed