git subrepo pull --force deps/lightrec
[pcsx_rearmed.git] / deps / lightning / lib / jit_x86.c
index c34a117..6472e56 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2019  Free Software Foundation, Inc.
+ * Copyright (C) 2012-2022  Free Software Foundation, Inc.
  *
  * This file is part of GNU lightning.
  *
@@ -1593,8 +1593,8 @@ _emit_code(jit_state_t *_jit)
        jit_regarg_set(node, value);
        switch (node->code) {
            case jit_code_align:
-               assert(!(node->u.w & (node->u.w - 1)) &&
-                      node->u.w <= sizeof(jit_word_t));
+               /* Must align to a power of two */
+               assert(!(node->u.w & (node->u.w - 1)));
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
@@ -1674,6 +1674,16 @@ _emit_code(jit_state_t *_jit)
                case_rrw(gt, _u);
                case_rrr(ne,);
                case_rrw(ne,);
+           case jit_code_casr:
+               casr(rn(node->u.w), rn(node->v.w),
+                    rn(node->w.q.l), rn(node->w.q.h));
+               break;
+           case jit_code_casi:
+               casi(rn(node->u.w), node->v.w,
+                    rn(node->w.q.l), rn(node->w.q.h));
+               break;
+               case_rrr(movn,);
+               case_rrr(movz,);
                case_rr(mov,);
            case jit_code_movi:
                if (node->flag & jit_flag_node) {
@@ -1696,6 +1706,11 @@ _emit_code(jit_state_t *_jit)
                case_rr(hton, _ui);
 #if __X64 && !__X64_32
                case_rr(hton, _ul);
+#endif
+               case_rr(bswap, _us);
+               case_rr(bswap, _ui);
+#if __X64 && !__X64_32
+               case_rr(bswap, _ul);
 #endif
                case_rr(ext, _c);
                case_rr(ext, _uc);
@@ -2012,7 +2027,7 @@ _emit_code(jit_state_t *_jit)
                    if (temp->flag & jit_flag_patch)
                        jmpi(temp->u.w);
                    else {
-                       word = jmpi(_jit->pc.w);
+                       word = jmpi_p(_jit->pc.w);
                        patch(word, node);
                    }
                }
@@ -2027,9 +2042,12 @@ _emit_code(jit_state_t *_jit)
                    temp = node->u.n;
                    assert(temp->code == jit_code_label ||
                           temp->code == jit_code_epilog);
-                   word = calli(temp->u.w);
-                   if (!(temp->flag & jit_flag_patch))
+                   if (temp->flag & jit_flag_patch)
+                       calli(temp->u.w);
+                   else {
+                       word = calli_p(_jit->pc.w);
                        patch(word, node);
+                   }
                }
                else
                    calli(node->u.w);