lightning
[Top][All Lists]
Advanced

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

[Lightning] bug in aarch64 bcci ?


From: Andy Wingo
Subject: [Lightning] bug in aarch64 bcci ?
Date: Tue, 14 May 2019 15:03:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hi!

Could it be there's a bug here:

     static jit_word_t
     _bcci(jit_state_t *_jit, jit_int32_t cc,
           jit_word_t i0, jit_int32_t r0, jit_word_t i1)
     {
         jit_int32_t         reg;
         jit_word_t          w, d;
         jit_word_t          is =  i1 >> 12;
         jit_word_t          in = -i1;
         jit_word_t          iS =  in >> 12;
         if (      i1 >= 0 && i1 <= 0xfff)
             CMPI   (r0, i1);
         else if ((is << 12) == i0 && is >= 0 && is <= 0xfff)
             CMPI_12(r0, is);

I.e. I think the compare only makes sense against i1, not i0.

         else if ( in >= 0 && in <= 0xfff)
             CMNI   (r0, in);
         else if ((iS << 12) == is && iS >= 0 && iS <= 0xfff)
             CMNI_12(r0, iS);
         else {
             reg = jit_get_reg(jit_class_gpr);
             movi(rn(reg), i1);
             CMP(r0, rn(reg));
             jit_unget_reg(reg);
         }
         w = _jit->pc.w;
         d = (i0 - w) >> 2;
         B_C(cc, d);
         return (w);
     }

Cheers,

Andy



reply via email to

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