Menu

#2329 long long mul / mod broken on gbz80

closed-fixed
None
GBZ80
6
2017-11-07
2014-12-04
No

Tests longlong.c and gcc-torture-execute-20080529-1.c fail with the new version of long long multiplication. Since gbz80 probably has much fewer long long users than stm8, I don't want to revert to the old one. And the gbz80 issue needs to be fixed anyway.

Philipp

Discussion

  • Ben Shi

    Ben Shi - 2016-03-02

    The mod operation also fails (only) for gbz80 with the following tests (if added in longlong.c).

      y = 0x1122334455667700ull;
      x = 0x7ll;
      ASSERT (y % x == 0x1122334455667700ull % 0x7ll);
      x = 0x1122334455667700ll;
      ASSERT (x % 0x7ll == 0x1122334455667700ll % 0x7ll);
    
     
  • Ben Shi

    Ben Shi - 2016-03-02
    • summary: long long multiplication broken on gbz80 --> long long mul / mod broken on gbz80
     
  • Ben Shi

    Ben Shi - 2016-04-10

    other failed longlong test cases on gbz80 besides longlong.c

    gcc-torture-execute-20000717-2.c
    gcc-torture-execute-20001108-1.c
    gcc-torture-execute-20011126-1.c
    gcc-torture-execute-20041011-1.c
    gcc-torture-execute-20050104-1.c
    gcc-torture-execute-20060110-2.c
    gcc-torture-execute-20080529-1.c
    gcc-torture-execute-920829-1.c
    gcc-torture-execute-921202-2.c
    gcc-torture-execute-950511-1.c
    gcc-torture-execute-950612-1.c
    gcc-torture-execute-950704-1.c
    gcc-torture-execute-961122-1.c
    gcc-torture-execute-961213-1.c
    gcc-torture-execute-961213-1.c

     
  • Philipp Klaus Krause

    THis is an issue due to the use of ldhl overwriting the carry byte. It can also be reproduced with long:

    long acc2;
    
    addhi2 (short a)
    {
      acc2 += (long) a << 16;
    }
    

    is affected by the same issue. I.e. regtest gcc-torture-execute-961122-1.c would fail for gbz80, even if it used long instead of longlong.

    Philipp

     
    • Philipp Klaus Krause

      I fixed the ldhl carry issues. As of revision #9563 everything except for multiplication works.

      Philipp

       
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     
  • Philipp Klaus Krause

    The remaining issue turned out to be a bug in register tracking for shifts by 0. It is fixed in [r10170].

    Philipp

     

Log in to post a comment.