]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
x86/x64: Fix loop realignment.
authorMike Pall <mike>
Sun, 2 Feb 2020 17:19:44 +0000 (18:19 +0100)
committerMike Pall <mike>
Sun, 2 Feb 2020 17:19:44 +0000 (18:19 +0100)
src/lj_asm_x86.h

index 2c38d1ec8d090aceb214d66508c0c326b9ea0186..68b40b312d9c4f89e9efc49bb32c089711779607 100644 (file)
@@ -1836,8 +1836,9 @@ static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa)
   int32_t k = 0;
   if (as->flagmcp == as->mcp) {  /* Drop test r,r instruction. */
     MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2);
-    if ((p[1] & 15) < 14) {
-      if ((p[1] & 15) >= 12) p[1] -= 4;  /* L <->S, NL <-> NS */
+    MCode *q = p[0] == 0x0f ? p+1 : p;
+    if ((*q & 15) < 14) {
+      if ((*q & 15) >= 12) *q -= 4;  /* L <->S, NL <-> NS */
       as->flagmcp = NULL;
       as->mcp = p;
     }  /* else: cannot transform LE/NLE to cc without use of OF. */