]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Merge branch 'master' into v2.1
authorMike Pall <mike>
Sat, 2 Oct 2021 14:58:29 +0000 (16:58 +0200)
committerMike Pall <mike>
Sat, 2 Oct 2021 15:23:51 +0000 (17:23 +0200)
1  2 
src/lj_asm_mips.h

index ba05f193e5e0d3f2aa3af2166061f768047a0a77,ee81e5e0ae4ec66bb4639bd5925f7a39a7511572..21b9f9dbae1a99c680732c7b79ecc3cc8906c8a8
@@@ -968,68 -640,26 +968,61 @@@ static void asm_href(ASMState *as, IRIn
    MCLabel l_end, l_loop, l_next;
  
    rset_clear(allow, tab);
- #if LJ_SOFTFP32
-   if (!isk) {
-     key = ra_alloc1(as, refkey, allow);
-     rset_clear(allow, key);
-     if (irkey[1].o == IR_HIOP) {
 -  if (irt_isnum(kt)) {
++  if (!LJ_SOFTFP && irt_isnum(kt)) {
+     key = ra_alloc1(as, refkey, RSET_FPR);
+     tmpnum = ra_scratch(as, rset_exclude(RSET_FPR, key));
+   } else {
+     if (!irt_ispri(kt)) {
+       key = ra_alloc1(as, refkey, allow);
+       rset_clear(allow, key);
+     }
 -    type = ra_allock(as, irt_toitype(irkey->t), allow);
 -    rset_clear(allow, type);
++#if LJ_32
++    if (LJ_SOFTFP && irkey[1].o == IR_HIOP) {
 +      if (ra_hasreg((irkey+1)->r)) {
 +      type = tmpnum = (irkey+1)->r;
 +      tmp1 = ra_scratch(as, allow);
 +      rset_clear(allow, tmp1);
 +      ra_noweak(as, tmpnum);
 +      } else {
 +      type = tmpnum = ra_allocref(as, refkey+1, allow);
 +      }
 +      rset_clear(allow, tmpnum);
 +    } else {
-       type = ra_allock(as, (int32_t)irt_toitype(irkey->t), allow);
++      type = ra_allock(as, (int32_t)irt_toitype(kt), allow);
 +      rset_clear(allow, type);
 +    }
-   }
- #else
-   if (!LJ_SOFTFP && irt_isnum(kt)) {
-     key = ra_alloc1(as, refkey, RSET_FPR);
-     tmpnum = ra_scratch(as, rset_exclude(RSET_FPR, key));
-   } else if (!irt_ispri(kt)) {
-     key = ra_alloc1(as, refkey, allow);
-     rset_clear(allow, key);
- #if LJ_32
-     type = ra_allock(as, (int32_t)irt_toitype(irkey->t), allow);
-     rset_clear(allow, type);
 +#endif
    }
- #endif
    tmp2 = ra_scratch(as, allow);
    rset_clear(allow, tmp2);
-       k = ((int64_t)irt_toitype(irkey->t) << 47) | irkey[1].tv.u64;
 +#if LJ_64
 +  if (LJ_SOFTFP || !irt_isnum(kt)) {
 +    /* Allocate cmp64 register used for 64-bit comparisons */
 +    if (LJ_SOFTFP && irt_isnum(kt)) {
 +      cmp64 = key;
 +    } else if (!isk && irt_isaddr(kt)) {
 +      cmp64 = tmp2;
 +    } else {
 +      int64_t k;
 +      if (isk && irt_isaddr(kt)) {
-       k = ~((int64_t)~irt_toitype(ir->t) << 47);
++      k = ((int64_t)irt_toitype(kt) << 47) | irkey[1].tv.u64;
 +      } else {
 +      lj_assertA(irt_ispri(kt) && !irt_isnil(kt), "bad HREF key type");
++      k = ~((int64_t)~irt_toitype(kt) << 47);
 +      }
 +      cmp64 = ra_allock(as, k, allow);
 +      rset_clear(allow, cmp64);
 +    }
 +  }
 +#endif
  
 -  /* Key not found in chain: load niltv. */
 +  /* Key not found in chain: jump to exit (if merged) or load niltv. */
    l_end = emit_label(as);
 -  if (destused)
 +  as->invmcp = NULL;
 +  if (merge == IR_NE)
 +    asm_guard(as, MIPSI_B, RID_ZERO, RID_ZERO);
 +  else if (destused)
      emit_loada(as, dest, niltvg(J2G(as->J)));
 -  else
 -    *--as->mcp = MIPSI_NOP;
    /* Follow hash chain until the end. */
    emit_move(as, dest, tmp1);
    l_loop = --as->mcp;